How to open files read-only?

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

How to open files read-only?

Martin Wilhelm Leidig
Hi *,

sometimes I open some text file just for reference or to copy something from it.  I’d like to open those read-only to avoid erronously introducing changes.  Could not find some easy way up to now.  Which bright red button in front of me did I miss?


-Moss-
--
Debugging?  Klingons do not debug.  Our software does not coddle the weak.
                                – not by Peter Dyballa (as he vows)



_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How to open files read-only?

Allan Odgaard-4

On 2 Oct 2019, at 16:17, Martin Wilhelm Leidig wrote:

sometimes I open some text file just for reference or to copy something from it. I’d like to open those read-only to avoid erronously introducing changes. Could not find some easy way up to now. Which bright red button in front of me did I miss?

There is no way to open a file as read-only.

Partly for technical reasons, as we support running commands, and TextMate can’t be sure that a command won’t make changes to the file, but not allowing to run commands at all (for r/o files) would remove things like Git actions, word statistics, diff’ing, etc.

But I’m currently doing some refactoring and will consider how feasible it is to at least have a read-only mode that disallows the built-in mutating actions; the problem here is only that such mode is rarely used so I don’t want hundreds of actions to have special code to test for read-only mode, hence only if the impact on code can be minimal would I want to support this.



_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

Re: How to open files read-only?

Martin Wilhelm Leidig


> Am 19-10-14 um 09:15 schrieb Allan Odgaard <[hidden email]>:
>
> On 2 Oct 2019, at 16:17, Martin Wilhelm Leidig wrote:
>
> sometimes I open some text file just for reference or to copy something from it. I’d like to open those read-only to avoid erronously introducing changes. Could not find some easy way up to now. Which bright red button in front of me did I miss?
>
> There is no way to open a file as read-only.
>
> Partly for technical reasons, as we support running commands, and TextMate can’t be sure that a command won’t make changes to the file, but not allowing to run commands at all (for r/o files) would remove things like Git actions, word statistics, diff’ing, etc.

Why would forbidding to write the file back remove anything?

> But I’m currently doing some refactoring and will consider how feasible it is to at least have a read-only mode that disallows the built-in mutating actions; the problem here is only that such mode is rarely used so I don’t want hundreds of actions to have special code to test for read-only mode, hence only if the impact on code can be minimal would I want to support this.

Well … how many subroutines are there in TM2 that write a file from memory back to the medium it was read from?  Hardly more than one; my mileage may vary.  But if so, and if that one would look at some r/o flag of the file in question and just not do anything if TRUE I’d be completely happy … I think.


Regards,

-Moss-
--
Martin Wilhelm Leidig



_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How to open files read-only?

Dr Eberhard W Lisse

Personally I am on occasion irritated by Apple's Nanny-Behaviour, but
there is really nothing (much) wrong with jumping through a few hoops

        reboot
        disable SIP
        reboot
        remount / as Read and Write
        modify the Postfix Plist
        reboot
        enable SIP
        reboot

once for every major MacOS revision :-)-O

el

On 15/10/2019 12:57, Allan Odgaard wrote:
> On 14 Oct 2019, at 20:11, Martin Wilhelm Leidig wrote:
>
>> Why would forbidding to write the file back remove anything?
>
> That is not what I understand by a read-only mode.  If a file is
> opened as read-only, the user should not be allowed to make any edits.
[...]

_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

Re: How to open files read-only?

Matt Neuburg
In reply to this post by Martin Wilhelm Leidig
I was going to suggest just Finder-locking the file. m. 

--
matt neuburg, phd = http://www.apeth.net/matt/
pantes anthropoi tou eidenai oregontai phusei
Programming iOS 13! http://shop.oreilly.com/product/0636920310075.do
iOS 13 Fundamentals! http://shop.oreilly.com/product/0636920310068.do
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html

On Oct 15, 2019, at 9:00 AM, Martin Wilhelm Leidig <[hidden email]> wrote:

Allan,

am 19-10-15 um 12:57 schrieb Allan Odgaard <[hidden email]>:

You can make a command that toggles the w flag for the current file and bind it to a hotkey,
[…]
Set the command’s output to show as tool tip, then you get informed about the new state of the current file after toggling ro/rw mode.

Neat.  Exactly what I want.  Thank you!


Regards,

-Moss-
--
Martin Wilhelm Leidig


_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate


_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

Re: How to open files read-only?

Martin Wilhelm Leidig
In reply to this post by Martin Wilhelm Leidig
Am 19-10-15 um 18:00 schrieb Martin Wilhelm Leidig <[hidden email]>:
> Exactly what I want.

Reconsidering, it’s not what I want.  This manipulates the file mode, so  it is locked globally (for it’s owner), and if I unlock it there it’s unlocked again for TM (and globally).

Just inhibiting to save the file would do the trick locally in TM.  One might call that a more/less mode.

Hmm.  Maybe I’d just use Alpha for that.


Regards,

-Moss-
--
Martin Wilhelm Leidig



_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How to open files read-only?

Matt Neuburg
Maybe the script should save a read only *copy* into temp and open that? m. 

--
matt neuburg, phd = http://www.apeth.net/matt/
pantes anthropoi tou eidenai oregontai phusei
Programming iOS 13! http://shop.oreilly.com/product/0636920310075.do
iOS 13 Fundamentals! http://shop.oreilly.com/product/0636920310068.do
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html

On Oct 15, 2019, at 1:56 PM, Martin Wilhelm Leidig <[hidden email]> wrote:

Am 19-10-15 um 18:00 schrieb Martin Wilhelm Leidig <[hidden email]>:
Exactly what I want.

Reconsidering, it’s not what I want.  This manipulates the file mode, so  it is locked globally (for it’s owner), and if I unlock it there it’s unlocked again for TM (and globally).

Just inhibiting to save the file would do the trick locally in TM.  One might call that a more/less mode.

Hmm.  Maybe I’d just use Alpha for that.


Regards,

-Moss-
--
Martin Wilhelm Leidig


_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate


_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

Status Bar Context PopUp

Dr Eberhard W Lisse
In reply to this post by Martin Wilhelm Leidig
Allan,

I don't know how to capture an open pulldown so I took a photo :-)-O

When I right click perl (to tidy up) I see that there is an additional
line between items on the second pull down and there are run ins between
long text and commands.

This is the case for all selection.

I have increased the font size of the status bar, in terms of our
previous conversation after which you added this feature in December
last year.

But resetting it

        defaults write com.macromates.TextMate statusBarFontSize 12

makes no difference.

Is a feature?

greetings, el

--
Dr. Eberhard W. Lisse   \         /      Obstetrician & Gynaecologist
[hidden email]             / *      | Telephone: +264 81 124 6733 (cell)
PO Box 8421              \      /
Bachbrecht 10007, Namibia ;____/



_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate

popup.jpg (223K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Status Bar Context PopUp

Rafał Komorowski
Wiadomość napisana przez Dr Eberhard W Lisse <[hidden email]> w dniu 17/10/2019, o godz. 08:58:

I don't know how to capture an open pulldown so I took a photo :-)-O

Command-Control-3 takes screenshot of the whole screen, regardless of menus open etc.
Command-Control-4 allows to choose a part of the screen.

-- 

Rafał Komorowski
[hidden email]



_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

Re: Status Bar Context PopUp

Walter Lee Davis
In reply to this post by Dr Eberhard W Lisse
I'm seeing this too. It's not happening to every single menu item, but quite a lot of them.

Walter

> On Oct 17, 2019, at 2:58 AM, Dr Eberhard W Lisse <[hidden email]> wrote:
>
> Allan,
>
> I don't know how to capture an open pulldown so I took a photo :-)-O
>
> When I right click perl (to tidy up) I see that there is an additional
> line between items on the second pull down and there are run ins between
> long text and commands.
>
> This is the case for all selection.
>
> I have increased the font size of the status bar, in terms of our
> previous conversation after which you added this feature in December
> last year.
>
> But resetting it
>
> defaults write com.macromates.TextMate statusBarFontSize 12
>
> makes no difference.
>
> Is a feature?
>
> greetings, el
>
> --
> Dr. Eberhard W. Lisse   \         /      Obstetrician & Gynaecologist
> [hidden email]             / *      | Telephone: +264 81 124 6733 (cell)
> PO Box 8421              \      /
> Bachbrecht 10007, Namibia ;____/
>
> <popup.jpg>
> _______________________________________________
> TextMate mailing list
> [hidden email]
> https://lists.macromates.com/listinfo/textmate


_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate
Reply | Threaded
Open this post in threaded view
|

Re: Status Bar Context PopUp

Dr Eberhard W Lisse
In reply to this post by Rafał Komorowski
On my 12 inch Catalina it's Shift-Command-3/4

:-)-O


el

On 2019-10-19 12:08 , Rafał Komorowski wrote:

>> Wiadomość napisana przez Dr Eberhard W Lisse <[hidden email]> w dniu 17/10/2019, o godz. 08:58:
>>
>> I don't know how to capture an open pulldown so I took a photo :-)-O
>
> Command-Control-3 takes screenshot of the whole screen, regardless of menus open etc.
> Command-Control-4 allows to choose a part of the screen.
>
>
>
> _______________________________________________
> TextMate mailing list
> [hidden email]
> https://lists.macromates.com/listinfo/textmate
>

--
Dr. Eberhard W. Lisse          / Obstetrician & Gynaecologist (Saar)
[hidden email]            / *     |   Telephone: +264 81 124 6733 (cell)
PO Box 8421                  /
Bachbrecht, Namibia     ;____/

_______________________________________________
TextMate mailing list
[hidden email]
https://lists.macromates.com/listinfo/textmate