hi guys somehow one of my old .php files was encoded as a BBEdit document so when I double-clicked BB opened up... what a shock! Like travelling back in time. Honestly I wondered if it had booted Classic up, the menu looked so old :)
[Disclaimer, that's BB 7.x not 8.0, so maybe they freshened it up.]
Anyway that shows how fast TM has progressed. Just about the only thing I miss (because I screwed up a bunch o' code today ;) is the autosave feature where each file is backed up before each change. Can we please have that in TM for us klutzes?
p.
On Jan 14, 2005, at 9:59, Paul Nordstrom August wrote:
Anyway that shows how fast TM has progressed. Just about the only thing I miss (because I screwed up a bunch o' code today ;) is the autosave feature where each file is backed up before each change. Can we please have that in TM for us klutzes?
With a flattering introduction like yours, I can't possibly turn that request down ;)
So should I do it *nix style and append ~ to the backup-files, or a prefix like .backup?
When saving the new file there are two options, rename the old and write the new, or copy the old (into the backup) and overwrite the new. While the first seems to be the obvious solution, it will give the “new” file a new inode, which will break hardlinks. Aliases should still work because they use the path before the inode, so maybe it's okay (just thinking out load here)...
well as you can guess I'm not the expert here ;)
But the *functionality* I'd like is an action so each time I save a file the previous version gets put in a designated backup folder with a datestamp, e.g. "index.php.20050114_2015" or the like. Really whatever's easiest!
thanks! Paul
On 14 Jan 2005, at 19:36, Allan Odgaard wrote:
On Jan 14, 2005, at 9:59, Paul Nordstrom August wrote:
Anyway that shows how fast TM has progressed. Just about the only thing I miss (because I screwed up a bunch o' code today ;) is the autosave feature where each file is backed up before each change. Can we please have that in TM for us klutzes?
With a flattering introduction like yours, I can't possibly turn that request down ;)
So should I do it *nix style and append ~ to the backup-files, or a prefix like .backup?
When saving the new file there are two options, rename the old and write the new, or copy the old (into the backup) and overwrite the new. While the first seems to be the obvious solution, it will give the “new” file a new inode, which will break hardlinks. Aliases should still work because they use the path before the inode, so maybe it's okay (just thinking out load here)...
On 14 Jan 2005, at 10:42, Paul Nordstrom August wrote:
But the *functionality* I'd like is an action so each time I save a file the previous version gets put in a designated backup folder with a datestamp, e.g. "index.php.20050114_2015" or the like. Really whatever's easiest!
Sorry, didn't get this e-mail until after my other reply, so some of my questions are unnecessary. Having some problems with e-mail access today it seems.
Kind regards,
Mats
---- "TextMate, coding with an incredible sense of joy and ease" - www.macromates.com -
But the *functionality* I'd like is an action so each time I save a file the previous version gets put in a designated backup folder with a datestamp, e.g. "index.php.20050114_2015" or the like. Really whatever's easiest!
It seems to me, that this isn't really autosave, it's more of an automated versioning. I know it seems like sort of a semantic argument, but an actual autosave feature, where you can set it to save to a temp file every 5 minutes or something, would be really really nice. I know it has saved my butt in programs like Word a couple of times (granted it was because the PC I was on crashed before I had saved; who worries about that with TM? ;) and I personally would love to have that feature.
PS. And I don't think this is really something controllable with a command, since it needs to be invoked without you. Actually, that would be really cool too - have a way to invoke commands on time intervals - so say, update cvs every 10 minutes, or save every 5 minutes, or whatever you wish, whenever you wish. Just a thought. Something like this would remove the necessity of autosave, and give a whole bunch of other functionality at the same time.
- Jon
Jonathan Raphaelson University of Colorado at Boulder --
Home: 303-469-3442 Cell: 720-937-4372
jonathan.raphaelson@colorado.edu jonraphaelson@gmail.com
I agree with Jon on the autosave thing. Your text editor is not the place to do versioning. The correct tool for versioning is CVS or even better, SVN. If there are issues that cause TM to not play well with those repositories, then that should be the focus of dev IMHO.
On Jan 14, 2005, at 8:02 AM, Jon Raphaelson wrote:
But the *functionality* I'd like is an action so each time I save a file the previous version gets put in a designated backup folder with a datestamp, e.g. "index.php.20050114_2015" or the like. Really whatever's easiest!
It seems to me, that this isn't really autosave, it's more of an automated versioning. I know it seems like sort of a semantic argument, but an actual autosave feature, where you can set it to save to a temp file every 5 minutes or something, would be really really nice. I know it has saved my butt in programs like Word a couple of times (granted it was because the PC I was on crashed before I had saved; who worries about that with TM? ;) and I personally would love to have that feature.
PS. And I don't think this is really something controllable with a command, since it needs to be invoked without you. Actually, that would be really cool too - have a way to invoke commands on time intervals - so say, update cvs every 10 minutes, or save every 5 minutes, or whatever you wish, whenever you wish. Just a thought. Something like this would remove the necessity of autosave, and give a whole bunch of other functionality at the same time.
- Jon
Jonathan Raphaelson University of Colorado at Boulder --
Home: 303-469-3442 Cell: 720-937-4372
jonathan.raphaelson@colorado.edu jonraphaelson@gmail.com
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 14. jan 2005, at 20:11, Lang Riley wrote:
I agree with Jon on the autosave thing. Your text editor is not the place to do versioning. The correct tool for versioning is CVS or even better, SVN. If there are issues that cause TM to not play well with those repositories, then that should be the focus of dev IMHO.
I agree with that, although a simple one-file backup ala ~ or another suffix, would probably be a good idea to include.
On 14.01.2005, at 17:02, Jon Raphaelson wrote:
But the *functionality* I'd like is an action so each time I save a file the previous version gets put in a designated backup folder with a datestamp, e.g. "index.php.20050114_2015" or the like. Really whatever's easiest!
I guess you could use stakeout (<http://michael-mccracken.net/blog/blosxom.pl/computers/mac/ programming/meetWatch.html>) to do this. Whip up a TM bundle that includes stakeout (if licensing permits this, of course) and a TM command that triggers it, like "start/stop backups on save".
It seems to me, that this isn't really autosave, it's more of an automated versioning. I know it seems like sort of a semantic argument, but an actual autosave feature, where you can set it to save to a temp file every 5 minutes or something, would be really really nice. I know it has saved my butt in programs like Word a couple of times (granted it was because the PC I was on crashed before I had saved; who worries about that with TM? ;) and I personally would love to have that feature.
PS. And I don't think this is really something controllable with a command, since it needs to be invoked without you. Actually, that would be really cool too - have a way to invoke commands on time intervals - so say, update cvs every 10 minutes, or save every 5 minutes, or whatever you wish, whenever you wish. Just a thought. Something like this would remove the necessity of autosave, and give a whole bunch of other functionality at the same time.
Along the same lines, a TM command could create a cron job that makes periodic backups of your file.
For both scenarios, I'd personally prefer to have this done outside TM, and have it work on directories instead of individual files, with all editors and file types.
Cheers, -Ralph.
On 14-01-2005 11:36, Allan Odgaard wrote:
So should I do it *nix style and append ~ to the backup-files, or a prefix like .backup?
User configurable is best option here I think. Everyone has a different taste about it.
Perhaps also an option to keep a backup, but to remove it once the window is closed, application is quit, or.... ?
When saving the new file there are two options, rename the old and write the new, or copy the old (into the backup) and overwrite the new. While the first seems to be the obvious solution, it will give the “new” file a new inode, which will break hardlinks. Aliases should still work because they use the path before the inode, so maybe it's okay (just thinking out load here)...
It seems to me that the action you are doing is *editing* a file, not *copying* and working on the new copy. So I'd say, copy the file and work on the original one.
On the other hand, just did some experimentation with vim and it seems to change inode every time the file is saved...
Jeroen.
According to Allan Odgaard:
While the first seems to be the obvious solution, it will give the ?new? file a new inode, which will break hardlinks. Aliases should
It should be subject to the 'break hard links' setting you've added recently methinks.
Ollivier, hard link breaker :)
On 14 Jan 2005, at 08:59, Paul Nordstrom August wrote:
somehow one of my old .php files was encoded as a BBEdit document so when I double-clicked BB opened up... what a shock! Like travelling back in time. Honestly I wondered if it had booted Classic up, the menu looked so old :)
Yes, Paul, I too just worked in BBEdit and hated it. v8.0.3 (looks as bad as 7 really) and it was SLOW when I was typing text into the document, and that's on an iMac G5 so it wasn't on some slow old banger either. TM ROCKS !!
Just about the only thing I miss (because I screwed up a bunch o' code today ;) is the autosave feature where each file is backed up before each change. Can we please have that in TM for us klutzes?
I tried that feature in BB a long time ago and found it very badly executed to be honest, so I wouldn't really advocate for something like that in TM. In my mind it's sort of putting a 32bhp diesel engine in a Ferrari.
I'm a bit uncertain about what it is you really would like. Either you want a straight copy of BBEdit's implementation where you can choose to have a backup file in the same directory or else a copy of your file in another directory.
Either way, I think I know a better alternative solution to the whole request that we can 'easily' implement quickly; only needs a little bit of learning from you; and a bit of assistance from the more clever guys on the ML. Yes, Allan et al, that's you guys. (I've been thinking about it for a while and been planning to do something like it myself, just haven't got around to it yet due to a TM bug that Allan seems to have sorted out today)
Before I go on, let me make it clear that I hate having extra files in the working copy such as .bak files etc, so my solution below only addresses a secondary repository, but you can make it work with a new file in same dir as your TM_FILE if you want.
I just did a test where pressing Cmd+S also triggers a Command with the same trigger, so if you create a command that does what you want to do with each save, then that command will also be executed at the same time.
On to The concept: Create a new command that saves the file on execution, with Cmd+S as the trigger, and then in the command do something like this: (NEEDS WORK)
1. Set path to where your file repos is: /Users/<name>/TMBackups/ and set the name of the current project if you are working on several.
2. Get hold of the short TM_FILE_PATH. (remove /Volumes/... from it)
3. Create a LogEntry variable that holds the divider text and file content: (something like this) LogEntry=" ===== version saved: <datetime> by <UserName> =========
<file content>
================================================== "
3b. Allan, what's the TM_VAR for the whole document content? or can I get to it other than [ echo `cat $TM_FILE_NAME > $TM_BACKUP_FILE `] ?? 3c. How do you retain the Newline/ CR in this when you redirect it into a new file ?? Losing them in my test command.
4. Then use a simple Unix redirect command that appends the entry to the logfile: echo "$LogEntry" >> $BackUpLogFile
OK, so what do you get out of this in the end. Well, you get sort of a log of all changes in an individual file in a single backup file for that file with dividers that sets the date etc info as you wish to have it and the code as it was at that time. Each file in your project would have it's own backup log file in the BackUp repos.
If you don't want a single log file but multiple files, well then that can be done just as easy, although I think it's pointless to be honest, because you will have to open loads of files to see what changes you have made. In my version your last saved version is always at the bottom of the backup file. Now this is NOT as good as you using CVS or SVN, but I'm working on solving that problem as well on each save.
Give us (me) your spec's and I'll see what we can do about it.
This command based workaround would only require Allan's mind for only a few minutes to implement (I'm sure) versus something that will take longer time to implement, and would not have a much better result. (at least in my mind)
I hope the above is ample illustration of how BBEdit can't compare to TM, and how we all need to "Think Different(ly)" about TM, since many things can be achieved with Commands and a bit of Unix knowledge.
On 14 Jan 2005, at 10:36, Allan Odgaard wrote:
With a flattering introduction like yours, I can't possibly turn that request down ;)
Please note my flattery and requests above and below ;-)
So should I do it *nix style and append ~ to the backup-files, or a prefix like .backup? When saving the new file there are two options, rename the old and write the new, or copy the old (into the backup) and overwrite the new. While the first seems to be the obvious solution, it will give the “new” file a new inode, which will break hardlinks. Aliases should still work because they use the path before the inode, so maybe it's okay (just thinking out load here)...
Allan, Although I may have misunderstood some parts of your thinking there, it seems to me that you are complicating the whole thing. A couple of 'simple' commands that uses TM & Unix power will do that job well.
Allan, IF you'd like a challenge, then please consider binding Commands with Menu choices as well. So that using either the menu or the keyboard shortcut executes the Command. Also, could you please make it so that we can remove a trigger from a command and leave it empty. Now it captures any key stroke you do, and the (x) button don't work.
Kind regards,
Mats
---- "TextMate, coding with an incredible sense of joy and ease" - www.macromates.com -
On Jan 14, 2005, at 16:35, Mats Persson wrote:
3b. Allan, what's the TM_VAR for the whole document content? or can I get to it other than [ echo `cat $TM_FILE_NAME > $TM_BACKUP_FILE `] ??
You'll need to read it from the file.
3c. How do you retain the Newline/ CR in this when you redirect it into a new file ?? Losing them in my test command.
I think they are lost because you run the document through echo. Using cat alone with '>>' should be enough.
So should I do it *nix style and append ~ to the backup-files, or a prefix like .backup? [...]
Allan, Although I may have misunderstood some parts of your thinking there, it seems to me that you are complicating the whole thing. A couple of 'simple' commands that uses TM & Unix power will do that job well.
My thinking is that those people who'd like to have .backup files are probably not the same who'll role their own solution using the existing functionality (no offense meant to Paul ;) ).
Allan, IF you'd like a challenge, then please consider binding Commands with Menu choices as well. So that using either the menu or the keyboard shortcut executes the Command.
Yes -- I'd like to have some sort of hooks on various actions (like save). The other day Jeroen asked for some indication about the find having wrapped, personally I'd probably favor sound and Jeroen thought it was a job for Growl, and in the end I'll probably use the status bar. But this should probably be one of many events that can be captured by user scripts (adding pre/post behavior and/or suppressing the default action).
I must confess that I know very little about AppleScript, but I think it supports something like this (event handler). It's something I will investigate further.
Also, could you please make it so that we can remove a trigger from a command and leave it empty. Now it captures any key stroke you do, and the (x) button don't work.
The (x) button works for me!?!
On 14 Jan 2005, at 16:12, Allan Odgaard wrote:
3b. Allan, what's the TM_VAR for the whole document content? or can I get to it other than [ echo `cat $TM_FILE_NAME > $TM_BACKUP_FILE `] ?? How do you retain the Newline/ CR in this when you redirect it into a new file ?? Losing them in my test command.
I think they are lost because you run the document through echo. Using cat alone with '>>' should be enough.
OK, that works now. Thanks.
My thinking is that those people who'd like to have .backup files are probably not the same who'll role their own solution using the existing functionality (no offense meant to Paul ;) ).
1. .backup extension is used by Apple's BackUp software, so maybe not good choice. Maybe .tmbackup instead.
2. I understand that user shouldn't have to roll their own solutions, but I thought that by creating commands into bundles that they could then double-click to install easily together with a "How to use this ..." manual (or up on the wiki) would overcome that issue. The bundles/commands would then be a sort of cheap-mans plug-ins.
As for Paul's original request, well I have in less than an hour created 90% of his wish using a Command & bash, just need to spend some more time with a few other bits, and then it's ready to ship.
However, my point here is really a bigger one, so let me explain. IF you produce a back up solution (or any other solution) within TM - using Cocoa/GUI etc - it is a fixed solution that's difficult to override by the users. However, if the solution is done with a Command (or something similar Plug-ins ?) then it's still modifiable by the end user. Now I do understand quite a few issues relating to that wish, but I just prefer it that way. The last thing I'd like is to be locked into BBEdit like crap implementations. (Although I doubt you would ever implement something like that bad anyway)
Also, could you please make it so that we can remove a trigger from a command and leave it empty. Now it captures any key stroke you do, and the (x) button don't work.
The (x) button works for me!?!
Nope, it does not work for me. Only once in a 100 clicks does it register. Might be an issue with my mouse. Perhaps you could make ESC clear the field ??
Kind regards,
Mats
---- "TextMate, coding with an incredible sense of joy and ease" - www.macromates.com -
hi Mats This is a brilliant idea and as you say is better than a bunch of cumbersome .bak files lying around. I haven't had too much time to explore the Commands (alas!) but it also sounds very feasible.
Could it be built into TM so when a project ("myproject") is created, a separate "myproject.log" or something is automatically created? Then there could be a way to "flush project log" (like flushing cache in Safari or Firefox)...
p.
On 15 Jan 2005, at 00:35, Mats Persson wrote:
OK, so what do you get out of this in the end. Well, you get sort of a log of all changes in an individual file in a single backup file for that file with dividers that sets the date etc info as you wish to have it and the code as it was at that time. Each file in your project would have it's own backup log file in the BackUp repos.
If you don't want a single log file but multiple files, well then that can be done just as easy, although I think it's pointless to be honest, because you will have to open loads of files to see what changes you have made. In my version your last saved version is always at the bottom of the backup file. Now this is NOT as good as you using CVS or SVN, but I'm working on solving that problem as well on each save.
Give us (me) your spec's and I'll see what we can do about it.
This command based workaround would only require Allan's mind for only a few minutes to implement (I'm sure) versus something that will take longer time to implement, and would not have a much better result. (at least in my mind)
I hope the above is ample illustration of how BBEdit can't compare to TM, and how we all need to "Think Different(ly)" about TM, since many things can be achieved with Commands and a bit of Unix knowledge.
Paul Nordstrom August wrote:
Anyway that shows how fast TM has progressed. Just about the only thing I miss (because I screwed up a bunch o' code today ;) is the autosave feature where each file is backed up before each change. Can we please have that in TM for us klutzes?
I'm a bit late in on the discussion, but I'll throw this quick one in:
If we're considering saving files to the same directory but with a modified extension (.backup), keep in mind that this is very dangerous for web site projects. If a backup of a PHP file (for example) got accidentally uploaded to a web server, then source of the script would be revealed, as .backup would not be processed as PHP.
Kinda obvious, but worth noting :)
drew.
It seems nobody has mentioned the autosave implementation that I find best:
While a document is open and "dirty" the editor saves a copy of the file periodically in a temporary location (probably in something like ~/Library/ApplicationSupport/AppName/TemporaryFiles). Even after such an auto-save, the document still appears to the user to be dirty, and behaves the same way as it would without autosave. When the user asks to save the file, it actually gets saved to its real location. Clicking the close box asks if you want to save, as usual. Closing a document also removes the temporary file.
The point of this is to prevent data loss in the event of application crash or power loss. The next time the editor opens, it checks its temporary file directory and opens any that are still there, and they appear exactly the way they did last time the app was open -- as dirty windows, and if the user saves them, they go where they originally were.
I think Mail.app has got a pretty good implementation of this. Of course it's adapted to emails, not files. In Mail.app it makes sense, if you're composing an email and quit without saving or sending, that it auto-saves this mail to the Drafts folder, and the next time you open Mail.app it auto-opens the mail again. That doesn't make sense in an editor. But the save-a-copy-to-save-my-ass-if-my-Mac-crashes feature has merit.
As some others have already said, littering the directory with .bak files is a bad idea, for the can-be-read-from-a-webserver reason as well as the wreaks-havoc-on-the-version-control-system reason, not to mention making it impossible to find the file you need. Creating backup files with dates in the name is equally bad; if that's what you want, then you need to read about and use a version control system.
On Jan 18, 2005, at 18:23, Ryan Schmidt wrote:
I think Mail.app has got a pretty good implementation of this. Of course it's adapted to emails, not files. [...]
I also love Mail.app for that! I was actually considering it for TextMate, because then it could take the job of stickies, which I do on occasion want it to -- but there should be some way to control it of course.