CHALLENGE: EMACS IN 2 PAGES SOME NECESSARY NOTATION. Any ordinary character goes into the buffer (no insert command needed). In commands, use carriage return, shown as , after a string unless the chart shows $, meaning to use ESCAPE. C- A control character. C-f means "control f". M- A two-character command sequence where the first character is ESCAPE. M-f means "ESCAPE then F", or "Meta-f". RUBOUT Normally the DELETE key, but you can configure it to be the BACKSPACE key if you prefer M-x string A command designated "by hand". M-x recover-file means: ESCAPE then "x" then type "revert-file" then point EMACS term for cursor position in current buffer GETTING OUT. C-x C-s Write the current buffer into a new version of the current file name C-x C-w Write the current buffer into a file with a different name C-x C-c Finish by exiting to the exec C-z Push to a lower exec fork (the same one each time) BUFFER OPERATIONS. C-x C-f Get a file into a buffer for editing C-x b Select a different buffer (prompts; default is the last one) C-x C-b Display the list of available buffers C-x k Kill a buffer (prompts for which one; default is current one) M-< Move to the top of the current buffer M-> Move to the end of the current buffer HELP AND HELPER FUNCTIONS. C-g Abort anything at any time (it beeps, sometimes you need 2) C-h a string Show every command containing string (try C-H A Paragr) C-h c x What does this key do? (try C-h c C-k as an example) C-h d string Describe a command (try C-h d query-replace) C-y Yank back the last thing killed (kill and delete are different) M-n Provide a numeric argument of n for the command that follows C-q Inserts a control character in the buffer (e.g. C-q C-l) C-x d Directory editing subsystem (use h to see its documentation) CHARACTER OPERATIONS. C-b Move left (Back) C-f Move right (Forward) C-p Move up (Previous) C-n Move down (Next) RUBOUT Delete left C-d Delete right C-t Transpose previous 2 characters (ht -> th) WORD OPERATIONS. M-b Move left (Back) M-f Move right (Forward) M-RUBOUT Kill left (C-y yanks it back at point) M-d Kill right (C-y yanks it back at point) M-t Transpose 2 words around point (if only -> only if) M-c Capitalize word M-u Uppercase word LINE OPERATIONS. C-a Move to the beginning C-e Move to the end C-o Open up a line for typing C-x C-o Close up any blank lines around point M-0 C-k Kill from beginning to point (C-y yanks it back at point) C-k Kill from point to end (C-y yanks it back at point) SENTENCE OPERATIONS. M-a Move to the beginning M-e Move to the end C-x RUBOUT Kill from beginning to point (C-y yanks it back at point) M-k Kill from point to end (C-y yanks it back at point) PARAGRAPH OPERATIONS. M-[ Move to beginning M-] Move to end M-q Fill the current paragraph M-n C-x f Set the fill column to n (e.g. M-60 C-x F) SCREEN OPERATIONS. C-v Show next screen M-v Show previous screen C-l Redisplay screen M-0 C-l Move the line where point is to line 0 (top) of the screen PAGE OPERATIONS. C-x [ Move to beginning (last ^L) C-x ] Move to end (next ^L) SEARCH AND REPLACE. (note: EMACS has other search commands, all of which I prefer to incremental search, but we are just describing defaults here) C-s "Incremental" search searches while you enter string (C-s string$) C-r "Incremental" backward search (C-r string$) M-x replace-string Replace one string with another (M-x replace-string$one string$another string) M-x query-replace Replace one string with another, wants SPACE meaning "do it" or RUBOUT to skip (M-x query-replace$one$another) REGION OPERATIONS. Region is area of buffer between point and mark (or mark and point). Some commands set the mark, so check it before using. C-@ Set the mark (for use with REGION commands) C-x C-x Interchange point and mark (i.e. go to the other end of the current region) C-w Kill region (C-y yanks it back at point) WINDOW OPERATIONS. C-x 2 Split the screen in two windows (same buffer shown in each) C-x 1 Resume single window (using buffer from top window) C-x O Move cursor to other window (all the usual commands apply) M-C-v Display the next screen in the other window ================================================== EMACS SEMINAR, 11/11/92, Stephen G. Simpson Welcome to EMACS! These seminar notes are available on-line as /usr/local/doc/emacs/seminar.notes Any questions, send mail to ``simpson''. EMACS is basically a text editor, like TEXTEDIT or VI, but much more powerful. EMACS can edit many files at the same time. EMACS can run on any Unix workstation or terminal. EMACS is fast and easy to learn and to use. EMACS has complete on-line and printed documentation. EMACS has extensive interactive help facilities. EMACS has special editing modes for many special kinds of text files, including: TeX, LaTeX, Nroff, C, C++, Fortran, Pascal, Lisp, Perl, Shell, Scheme, ML, Prolog, and Mathematica. EMACS has special facilities to help you: read and compose mail, read and post news read man pages, browse info documentation interact with programming environments manipulate files and directories access remote file systems All of these capabilities are seamlessly integrated with powerful text editing. EMACS is completely customizable and programmable. The EMACS programming language is a dialect of Lisp. In short, EMACS can do everything! To start EMACS, issue a Unix command like this: boole:~> emacs & Here ``boole:~> '' is my Unix command prompt. The Unix command to run EMACS is ``emacs''. The ``&'' tells Unix to run EMACS as a separate process. Use this if you want to issue other Unix commands at the same time as you run EMACS. Cursor motion commands are bound to control keys. EXAMPLE: C-p is bound to the ``previous-line'' command. This means that C-p causes the ``previous-line'' command to be executed. C-p stands for the Control-p key, i.e. hold down the Ctrl key while you hit p (or P). ``previous-line'' C-p ^ | ``backward-char'' C-b <-- --> C-f ``forward-char'' | v C-n ``next-line'' If Emacs has been set up correctly for your terminal, the ``previous-line'' command will also be bound to the Up Arrow key, etc. The advantage of C-p et al. is that they will work on any terminal or workstation. Some additional cursor motion keys: C-v is bound to ``scroll-up'' (i.e. go ahead one screen) M-v is bound to ``scroll-down'' (i.e. go back one screen) NOTE: M-v stands for Meta-v, i.e. hit v (or V) while holding down the Meta key. On the Sun keyboard, there are two Meta keys -- the diamond keys to the left and right of the space bar. NOTE: Another way to achieve the same effect as M-v is ``ESC v'' or ``ESC V''. This means that you first hit the ESC key, then you hit v or V. An advantage of the ESC key is that it is available on all keyboards, even those which do not have a Meta key. Actually, throughout EMACS, Meta is equivalent to an ESC prefix. This is part of the internal structure of EMACS. For example: M-< or ``ESC <'' is bound to ``beginning-of-buffer'' M-> or ``ESC >'' is bound to ``end-of-buffer'' M-x or ``ESC x'' is bound to ``execute-extended-command'' Some important EMACS concepts: The ``point'' is the current location of the cursor. The ``mark'' is an invisible marker in the text. The ``region'' is the text between point and mark. Some essential EMACS editing keys: C-@ is bound to ``set-mark-command'' (i.e. put the mark where the cursor is now) C-x C-x is bound to ``exchange-point-and-mark'' C-w is bound to ``kill-region'' C-y is bound to ``yank'' (i.e. insert the last block of killed text) IF YOU GET INTO TROUBLE: C-g is bound to ``quit'' (This will usually abort an ongoing command.) C-x u is bound to ``undo'' (This will undo the previously executed command.) HOW TO EDIT AND SAVE FILES: C-x C-f is bound to ``find-file'' (NOTE: To ``find'' a file means to bring it into its own buffer for editing.) C-x i is bound to ``insert-file'' (i.e. insert a file into the current buffer) C-x b is bound to ``switch-to-buffer'' C-x C-s is bound to ``save-buffer'' EMACS WINDOWS The EMACS screen can be split into several windows, each of which can be used to edit a different file or different parts of the same file. C-x 2 is bound to ``split-current-window'' C-x o is bound to ``other-window'' C-x 1 is bound to ``delete-other-windows'' INSTANT HELP ON EMACS COMMANDS, KEYSTROKES, ETC. The help key is C-h. The first time you press it, it gives you a small help menu. To see details on what kinds of help are available, press it twice more. Or, just hit the letter corresponding to the kind of help you want. For example: C-h A is bound to ``command-apropos'' C-h F is bound to ``describe-function'' C-h K is bound to ``describe-key'' C-h M is bound to ``describe-mode'' etc. etc. etc. AN EMACS TUTORIAL To enter a self-guided EMACS tutorial, hit C-h T. This will teach you the basics of EMACS. EMACS ON-LINE DOCUMENTATION -- the Info system C-h I is bound to ``info'' Hit C-h I to enter the Info system. The Info system is an elaborate, tree-structured documentation system. It contains the complete EMACS reference manual plus documentation on many other topics. The Info system has its own set of keystroke commands. To learn about these commands, first hit C-h I to enter the Info system, then hit h (bound to ``info-help''). SOME ADDITIONAL TOPICS How to get help on Emacs commands and keystrokes How to read Info documentation within Emacs How to read Unix man pages within Emacs How to manipulate files and directories (Dired) How to access remote file systems (Ange-FTP) SOME FURTHER ADDITIONAL TOPICS How to use Mathematica under Emacs How to read and send mail within Emacs How to read and post news within Emacs How to customize Emacs How to program in Emacs Lisp How to use Chinese Emacs, Chinese TeX, ... ANSWERS TO FREQUENTLY ASKED QUESTIONS A list of Frequently Asked Questions about Emacs, together with answers to those questions, is in /usr/local/doc/emacs/FAQ There is additional Emacs documentation in /usr/local/doc/emacs THE END