garvin@uhccux.uhcc.hawaii.edu (Jay Garvin) (07/27/88)
The Grey Wolf <greywolf@unisoft.uucp> writes: > Since vi starts up almost instantly... If you like, you can start emacs only once when you log in in the morning. Then you don't need to quit until you logoff for the day. o Here's some stuff you can do w/out leaving emacs: read your mail, write some C programs, read usenet news, type up some TeX docements, get directory listings (ls), compress and uncompress some files, copy some files from here over to there, give some files new names, see the time, day, and date, write some lisp programs or prolog programs, compile the programs, debug some programs, disassemble some lisp code, telnet to a remote site, and then pay a visit to the 'doctor' without having to pay his bill. :-) o Ok, ok, I hear the other folks saying they want to issue some *real* unix commands... Ok... You can issue the Shell function and spawn a session right in one of your editing buffers. You'll get a % or $ prompt where you can grep, awk, sed, ls, who, finger, cat,...or whatever. This comes in handy if you want to keep a log of your session because you can edit it like any other buffer and save it as a file. Or you can divide your screen into two windows, code a program in the left hand emacs window and run it in the right hand one. o Ok, still need the real shell for something? Suspend emacs and you're at the shell prompt. 'fg' and you're back in emacs. If you quit emacs and bring it back up each time, vi will definitely beat the pants off emacs. It's funny, though, but whenever I'm at home reading a book or something after a while I'll get the munchies. I plop the book down and go for a refridgerator run. I'll come back with my PBJ and open up the book to where my bookmark is and continue reading. Usually I don't reshelve the book in its bookcase and yank the bookmark each time I go to the 'fridge. Even if I go out for the whole day I'll usually keep the book out somewhere until I've finished reading it. Likewise, you don't really need to reshelve emacs if you don't want to. Just put it down for now and pick it back up again after you get back from the fridge. :-) Zipping in and out by suspending is pretty fast (probably as fast as it gets), and whether you're zipping with vi or zipping with emacs doesn't matter: It's a tie. > ... It is a royal pain in the /dev/null to have to alternate between > command and insert mode, at least for me (you are entitled to your own opin- > ions; I can't very well hold them against you...:-). Forget to hit that ESC key, eh? Yep. I've cursored up to the top of the screen a few times to find: Hi Laura! How are yokkkkkkkkkkkkkkkkkkkkkkkku doing today? and my arrow keys and PF keys emit vi-offending escape characters, so one time I looked up from my paper to see what all the beeping was about and found some nice [$D[$D[$D[$A[$A's. :) > ...There is one thing that vi has that no other (non-vi, non- ed related) > editor seems to have: An UNDO feature! Maybe you'd like to know about these then... (This is from Emacs' on-line help.) Function: undo Action: Undo some previous changes. Repeat this command to undo more changes. A numeric argument serves as a repeat count. Function: undo-more: Action: Undo back N undo-boundaries beyond what was already undone recently. Call undo-start to get ready to undo recent changes, then call undo-more one or more times to undo them. You can undo multiple levels backward. 'Undo' remembers 8,000 characters, so unless you edited a *lot* before you found your mistake, you could probably 'undo' enough times that you could get back to your original file. This is 8,000 characters for each of your editing buffers, not 8,000 in total. Try Control-X plus 'u' for undo. (If you undo too far, and you want to get it back, you can 'undo' your undo's, too.:-) Here are some other things that might save your day.... Vi has crash recovery in case your system crashes on you. Invoke vi with the -r option. For Emacs, you might like to know: -Emacs makes a backup of your original file for you. (On unix systems, this one will be indicated by the tilde (~) at the end.) -Emacs has an autosave feature that will automatically save your file after a certain number of keystrokes. You can set the number of keystrokes to whatever you like. A few if you're nervous, a lot if you're not. -Emacs has a 'recover-file' function that will restore the file you were editing from the autosave file if you're unfortunate enough to encounter a system crash. -Emacs has a 'revert-buffer' function that will replace your buffer with a clean fresh copy of your original file from disk if you somehow manage to really mess up. This will discard all changes since the last save. Or you can grab from the autosave file. Emacs will tell you if the autosave file is more recent and ask you if you want to get that one instead. -Emacs has a 'view-lossage' function which lets you see your last 100 input keystrokes. -Emacs keeps a buffer of deleted 'killed' lines which you can 'yank' back into your document. (This works like Cut & Paste.) You can yank back lines you killed a long time ago. Emacs keeps your kills in a kill-ring buffer. You can for example yank back the thing-before-last or 5-things-ago if you want. How much emacs can keep for you is determined by the size of the kill-ring buffer. If you need more than emacs keeps by default, you can set the size as you wish. Well, hope this information is of some use. Perhaps it can enable someone to recover a file that might otherwise have been lost. 'Remember: the File you save, could be your own.' :) ---- P.S. Personally I don't see what the fuss is about between Emacs and Vi. Use whichever you are comfortable with. Emacs doesn't have anything against Vi. Emacs likes Vi. Die-hard Vi-ers might like to know that Emacs can pretend it's Vi for you if you want to try it out. There are in fact two Vi emulations: One where it wears a pretty convincing disguise and another for us folks who like to walk around while we're in input mode (command mode is like Vi, input mode is emacs.) Don't cry 'imposter' if you can spot Emacs' fake beard, though, Emacs knows who it is, and so do you. :-) egrep `echo "yaj|morf^|ahola" |rev` `echo sdrow/tcid/rsu/ |rev` -Jay /\ /\ /\ /\ ____/\ ____/\ / / / / / / / / /\___\/ /\___\/ / / / / /_/ / / / / / / Jay Garvin * / / / / ____ / / / / / / Computer Specialist * /_/ / / / __/ / / /_/ /_/ Computer Consultant * ______/ / __/ / __/ / ______/\ ______/\ \_____\/ \_\/ \_\/ \_____\/ \_____\/ University of Hawaii Computing Center garvin@uhccux.uhcc.hawaii.edu * "A whole wide world around us, an endless Universe, Yet we keep looking through the Eyeglass in reverse.." -Peart