[TxMt] opening a file readonly

Pete Siemsen siemsen at UCAR.EDU
Thu Jul 19 17:11:25 UTC 2007


Thanks, Andy, you expressed it well.  Others on this thread missed my  
point - grep and find are great, but they solve other problems.

I spend a lot of time configuring routers and switches.  We have  
software which regularly copies the configuration files for these  
devices to a server.  Many of these files are thousands of lines  
long.  I view them in an editor window, while in another window I'm  
logged into the device, making changes.
The config files are protected readonly on disk, because it makes no  
sense to modify them.

Until recently, I used Emacs to open them.  Emacs supports "open file  
readonly", which means "open the file but disable all commands that  
change the edit buffer".  If I accidentally do anything that would  
change the buffer, Emacs beeps and does nothing.  This is quite  
useful when there are several editor windows open, as it helps keep  
me from accidentally changing the wrong buffer.  Obviously, when I  
exit Emacs, it obviously doesn't ask me if I want to save any of the  
readonly buffers.

Cliff, I think it's probably safe to call Emacs and vim "text  
editors" :-)  It's very useful to view, seach and navigate a huge  
config file with a text editor, and I prefer to browse readonly files  
with the same tool that I use to edit files.  A few days ago I wrote  
a TextMate language grammar for Juniper router configs, so now  
TextMate does syntax highlighting and folding of these config files.   
It's surprisingly useful.

-- Pete



On Jul 19, 2007, at 9:30 AM, Andy Armstrong wrote:

> Cliff Pruitt wrote:
>> Well, you can mark the file itself as being read-only which will  
>> apply
>> system wide and you wont be able to save it.
>>
>> If you're wanting to actually prevent being able to modify the open
>> document then I'd say probably no.  TextMate is a "text editor" by
>> definition so you'd not really expect to find an option that  
>> removes the
>> ability to edit.
>>
>> I'f you're wanting a strict text-reader, why specifically are you you
>> using TextMate?  Is there maybe a better tool for what you're  
>> trying to do?
>
> I think you've missed the point Cliff. There are all sorts of reasons
> why you'd want to open a document read-only. Other editors have great
> r/o support (vim/gvim springs to mind). In general just because you
> don't want to change the document doesn't mean you don't want to work
> with it in a familiar user interface will all the syntax highlighting,
> clever selection modes, folding etc that TextMate brings.
>
> -- 
> Andy Armstrong, Hexten
>
> ______________________________________________________________________
> For new threads USE THIS: textmate at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20070719/d4d68f74/attachment.html>


More information about the textmate mailing list