Emac Tricks -- auto-logging your shell buffer
I make silly mistakes when coding that I don't notice right away, and then a few days later I'll notice that something's not working as expected and it could take hours for me to figure out what's wrong. So...how do I save me from myself? Good question," says daveb, "Keep logs of what you do" (As in, backed up postgres. fixed bug 22. Installed photo-albem, and so on.) Even better, those who run a command-line through the emacs editor, can auto-log their shell buffers to file. After you enter shell-mode with "M-x shell" or "C-x C-m" or "C-x RET" or whatever (To see what the keyboard short-cut is on any of the command names, "M-x where-is"), the buffer is called "*shell*" and it has no file associated with it. All you have to do is write that buffer into a file that you pick and you'll have a complete log of what you did -- I usually save the file as ~/log/20050605_shell or something. Optionally, you can then rename the buffer back to "*shell*" (because writing to a file will automatically rename the buffer name to the file name.) To write a file, "M-x write-file" which is usually bound to "C-x C-w". To rename the buffer, "M-x rename-buffer". You need to make sure that your file is in auto-save-mode and that you have selected an appropriate value of auto-save-interval which is, I think, the number of key strokes between auto saves. I use 100.
09:28 AM, 06 Jun 2005
by Eric Wolfram
Permalink
| Comments (0)