[TxMt] Re: How to open files read-only?

Martin Wilhelm Leidig listwatch at moss.in-berlin.de
Mon Oct 14 18:11:12 UTC 2019



> Am 19-10-14 um 09:15 schrieb Allan Odgaard <mailinglist at textmate.org>:
> 
> 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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <https://lists.macromates.com/textmate/attachments/20191014/5fdc4372/attachment.asc>


More information about the TextMate mailing list