I sometimes use Textmate to view readonly files. I'll never want to change the files, just view, navigate, fold, etc. Is there a way to tell Textmate that the files are read-only, so that Textmate prevents me from accidentally modifying the edit buffer? Just remembering to click "Don't save" when I exit Textmate isn't really what I want.
-- Pete
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?
- Cliff
On Jul 18, 2007, at 1:53 PM, Pete Siemsen wrote:
I sometimes use Textmate to view readonly files. I'll never want to change the files, just view, navigate, fold, etc. Is there a way to tell Textmate that the files are read-only, so that Textmate prevents me from accidentally modifying the edit buffer? Just remembering to click "Don't save" when I exit Textmate isn't really what I want.
-- Pete
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On Jul 19, 2007, at 10:20 AM, Cliff Pruitt wrote:
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 use it pretty extensively when searching for the use of specific variables in a huge Java codebase. Even though I rarely make edits to the code base (I'm mostly responsible for the graphic skins), I haven't found any tool better than TextMate's ability to dynamically create projects by opening file folders (and so to specify scope specifically for one search) and then quickly pinpoint lines of code using Find in Project.
Is there a better tool for that?
On Jul 19, 2007, at 10:51 AM, Ian Smith-Dahl wrote:
I use it pretty extensively when searching for the use of specific variables in a huge Java codebase. Even though I rarely make edits to the code base (I'm mostly responsible for the graphic skins), I haven't found any tool better than TextMate's ability to dynamically create projects by opening file folders (and so to specify scope specifically for one search) and then quickly pinpoint lines of code using Find in Project.
Is there a better tool for that?
grep and find are pretty good in conjunction for that sort of thing:
grep -l <search term> `find <starting directory> -name *.java`
-Mat
On 7/19/07, Mat Schaffer schapht@gmail.com wrote:
grep -l <search term> `find <starting directory> -name *.java`
Simpler (and won't flake out on paths with spaces in):
grep -r --include *.java <search term> <starting directory>
Robin
On Jul 19, 2007, at 11:33 AM, Robin Houston wrote:
On 7/19/07, Mat Schaffer schapht@gmail.com wrote:
grep -l <search term> `find <starting directory> -name *.java`
Simpler (and won't flake out on paths with spaces in):
grep -r --include *.java <search term> <starting directory>
Touché
On Jul 19, 2007, at 11:11 AM, Mat Schaffer wrote:
On Jul 19, 2007, at 10:51 AM, Ian Smith-Dahl wrote:
I use it pretty extensively when searching for the use of specific variables in a huge Java codebase. Even though I rarely make edits to the code base (I'm mostly responsible for the graphic skins), I haven't found any tool better than TextMate's ability to dynamically create projects by opening file folders (and so to specify scope specifically for one search) and then quickly pinpoint lines of code using Find in Project.
Is there a better tool for that?
grep and find are pretty good in conjunction for that sort of thing:
grep -l <search term> `find <starting directory> -name *.java`
Thanks, Mat. That's definitely another way to do it... but I don't think it's better. Since textmate jumps me to the line while showing me the whole docco, I have a lot more freedom to explore the context. I can even execute finds in the docco I'm looking at, while preserving the results of the find in the project. Plus, I get highlighting and folding (as mentioned by Andy). Grep (and doxygen) are definitely powerful for what they do, but what they do is filter out matches. I don't necessarily want the filter, I just want the find.
I personally don't have any problems with not making edits, but I wanted to back up the original poster that Textmate is a great browse- only tool.
I would like to see a couple of preferences show up in the Tiger version.
- Abide RW permissions on files - Open files by default Read-Only
The first one is so if a file is read only (like under revision control) this is preserved. The second one so if managers like to review code they don't mess up developers code.
---
Steven M. Klass
Strategic Manager, Design Automation - Analog Mixed Signal
SMSC 3930 East Ray Road, Suite 200 Phoenix, Arizona 85044 (480) 704-7046 (Desk) (480) 225-1112 (Mobile) steven.klass@smsc.com
Ian Smith-Dahl isd@strangetower.com Sent by: textmate-bounces@lists.macromates.com 07/19/07 08:45 AM Please respond to TextMate users textmate@lists.macromates.com
To TextMate users textmate@lists.macromates.com cc
Subject Re: [TxMt] opening a file readonly
On Jul 19, 2007, at 11:11 AM, Mat Schaffer wrote:
On Jul 19, 2007, at 10:51 AM, Ian Smith-Dahl wrote:
I use it pretty extensively when searching for the use of specific variables in a huge Java codebase. Even though I rarely make edits to the code base (I'm mostly responsible for the graphic skins), I haven't found any tool better than TextMate's ability to dynamically create projects by opening file folders (and so to specify scope specifically for one search) and then quickly pinpoint lines of code using Find in Project.
Is there a better tool for that?
grep and find are pretty good in conjunction for that sort of thing:
grep -l <search term> `find <starting directory> -name *.java`
Thanks, Mat. That's definitely another way to do it... but I don't think it's better. Since textmate jumps me to the line while showing me the whole docco, I have a lot more freedom to explore the context. I can even execute finds in the docco I'm looking at, while preserving the results of the find in the project. Plus, I get highlighting and folding (as mentioned by Andy). Grep (and doxygen) are definitely powerful for what they do, but what they do is filter out matches. I don't necessarily want the filter, I just want the find.
I personally don't have any problems with not making edits, but I wanted to back up the original poster that Textmate is a great browse- only tool.
______________________________________________________________________ For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On Jul 19, 2007, at 10:57 AM, Ian Smith-Dahl wrote:
I use it pretty extensively when searching for the use of specific variables in a huge Java codebase. Even though I rarely make edits to the code base (I'm mostly responsible for the graphic skins), I haven't found any tool better than TextMate's ability to dynamically create projects by opening file folders (and so to specify scope specifically for one search) and then quickly pinpoint lines of code using Find in Project.
Is there a better tool for that?
Doxygen?
Presumably the code base you're viewing is in a revision control system. It's generally not the editor's job to prevent you from making accidental edits. For that the filesystem has permissions and ACLs. That being said, vi/vim does have view/vim -R and I don't disagree that an "open read-only" mode wouldn't be useful. But it's probably at the absolute bottom of my feature request list. :-)
j.
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.
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@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
On Jul 19, 2007, at 1:11 PM, Pete Siemsen wrote:
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, Yeah I know what you're saying & of course Emacs & vim are "text editors". :-) But honestly how many "editors" of any kind have a read-only mode? (This is where someone emails me a list of like 3,000 read-only editors & I look like a jerk... happens every time.) It's just a non-standard feature both happen to have. I don't discount that it's useful, I just wanted to pose the question that maybe something else would work. I think it's just comparatively infrequent that the need to to completely prevent the buffer from changing at all. Usually most people have smaller tasks & just "not saving" is sufficient even though that's not your need.
- Cliff
Cliff,
Ok, I see your point. Perhaps a readonly mode isn't a feature found in many editors, but it con be useful the reasons I've described.
I couldn't find anything about such a feature in the TextMate docs or the book, so I assume that TextMate doesn't have the feature. Is this email posted to this list sufficient to request it as a future enhancement?
-- Pete
On Jul 19, 2007, at 4:52 PM, Cliff Pruitt wrote:
On Jul 19, 2007, at 1:11 PM, Pete Siemsen wrote:
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, Yeah I know what you're saying & of course Emacs & vim are "text editors". :-) But honestly how many "editors" of any kind have a read-only mode? (This is where someone emails me a list of like 3,000 read-only editors & I look like a jerk... happens every time.) It's just a non-standard feature both happen to have. I don't discount that it's useful, I just wanted to pose the question that maybe something else would work. I think it's just comparatively infrequent that the need to to completely prevent the buffer from changing at all. Usually most people have smaller tasks & just "not saving" is sufficient even though that's not your need.
- Cliff
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Ideally an attempt to type (or otherwise modify) into a TextMate window for a read-only file should trigger a special 'Attempt to modify read-only file' command.
If no such command can be found (or all commands found decline to handle this situation) a panel should appear.
One reason to have such a command is Perforce (an SCM system) which manages checkout state by changing the 'w' flag of a file, eg you have to check out a file before you can modify it.
I could imagine other scenarios where such a script might be useful.
Gerd
On Jul 20, 2007, at 2:37 PM, Pete Siemsen wrote:
Cliff,
Ok, I see your point. Perhaps a readonly mode isn't a feature found in many editors, but it con be useful the reasons I've described.
I couldn't find anything about such a feature in the TextMate docs or the book, so I assume that TextMate doesn't have the feature. Is this email posted to this list sufficient to request it as a future enhancement?
-- Pete
On Jul 19, 2007, at 4:52 PM, Cliff Pruitt wrote:
On Jul 19, 2007, at 1:11 PM, Pete Siemsen wrote:
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, Yeah I know what you're saying & of course Emacs & vim are "text editors". :-) But honestly how many "editors" of any kind have a read-only mode? (This is where someone emails me a list of like 3,000 read-only editors & I look like a jerk... happens every time.) It's just a non-standard feature both happen to have. I don't discount that it's useful, I just wanted to pose the question that maybe something else would work. I think it's just comparatively infrequent that the need to to completely prevent the buffer from changing at all. Usually most people have smaller tasks & just "not saving" is sufficient even though that's not your need.
- Cliff
_ For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
1.
On Jul 20, 2007, at 3:37 PM, Pete Siemsen wrote:
Perhaps a readonly mode isn't a feature found in many editors, but it con be useful the reasons I've described.
Hey, no argument from me. From what you said you were doing it makes sense.
Is this email posted to this list sufficient to request it as a future enhancement?
I suppose that all depends on weather or not Allan read it. :-) I'd say the thread made a pretty strong case for the usefulness of the feature but I don't know where it'd rank on his list of priorities.
2.
On Jul 20, 2007, at 9:02 AM, Dave Winzler wrote:
One feature of BBEdit that I've missed since moving to TextMate a couple years ago is the ability to open a file Read Only, [...] Don't know about the other 2,999 editors that off that feature, tho, so I'll let others chime in about that ;)
Dave, Yeah, I kinda figured BBedit would have it. Somehow I kinda lump BBedit into the Emacs / vim category in my mind anyway. I was more thinking "editor" in the broader sense like, a graphic, audio or video editor in addition to just text. There's usually a pretty clear distinction between reader/player and creator/editor. Again, that's *usually* the case but I'd completely agree it can be useful at times.
- Cliff
On 20. Jul 2007, at 21:37, Pete Siemsen wrote:
[...] I couldn't find anything about such a feature in the TextMate docs or the book, so I assume that TextMate doesn't have the feature. Is this email posted to this list sufficient to request it as a future enhancement?
It is enough -- it’s rare I miss a message on this list.
Read-only is an area where potential improvements has been discussed in the past (as Gerd mentions, there is more to read-only than just a simple “lock buffer”)
On Jul 21, 2007, at 1:00 PM, Allan Odgaard wrote:
On 20. Jul 2007, at 21:37, Pete Siemsen wrote:
[...] I couldn't find anything about such a feature in the TextMate docs or the book, so I assume that TextMate doesn't have the feature. Is this email posted to this list sufficient to request it as a future enhancement?
It is enough -- it’s rare I miss a message on this list.
Read-only is an area where potential improvements has been discussed in the past (as Gerd mentions, there is more to read-only than just a simple “lock buffer”)
I'm not a developer - wouldn't it be "enough" to disable the save- function for a file that is opened with a "read-only"-option? Or is this just not possible?
Niels
On 21. Jul 2007, at 13:12, Niels Kobschätzki wrote:
[...] I'm not a developer - wouldn't it be "enough" to disable the save- function for a file that is opened with a "read-only"-option? Or is this just not possible?
Well, enough for the user to not be able to save explicitly, but saving can still be done if he has “save when focus is lost” on, if he clicks “save changes” when closing the window, or if he runs a command that saves the current file. And should we also disable Save All Files?
So we probably want to prevent an edit of the buffer, not the actual saving (although we may want that as well).
We also need some visual indication for why things are as they are, an easy way for the user to change it, the ability for a hook to handle editing a read-only file (as is the case with Perforce, where an edit of a read-only file should result in a checkout), etc.
On Jul 19, 2007, at 11:30 AM, Andy Armstrong wrote:
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
Hey Andy, I hear where you're coming from and I wont argue with the point that TM has a lot of features that are useful when you have no interest in editing. I use it all the time without saving so I sure never claimed that it didn't and I'm sure a read only feature is useful to many people. I did claim that TM an editor, not a reader. To me (and I know my opinion is only an opinion) an editor doesn't specifically imply a read-only mode. The vast majority of "editors" (Photoshop, Final Cut, Pages, etc...) have no real concept of a read-only mode, hence my "... you'd not really *expect* ...". vim may have one, but that doesn't really make that feature an inherent part of a text editor. If it did, I'm sure TM would have it already.
When Pete sent his first email, he gave no real indication of what he was doing with the file, or what he was even reading. That's why I didn't give him a "go find something else" answer, but asked "Is there maybe a better tool for what you're trying to do?". The answer might very well be "No" but given the fact that he didn't state what the task was, it may very well have been "Yes". If he's searching files, maybe grep would indeed be better. If he's reading some free .txt e-book and doesn't want to alter the content maybe he'd rather convert it to a PDF.
I completely get what you're saying, but it's not that I missed the point, I just asked the first reasonable (imo) question.
I'm honestly not putting down the desire for the feature, it's just not an "expected" feature in an editor. Am I making sense?
- Cliff