<<

XEmacs Reference Card Motion Multiple Windows (for version 21.0+) entity to move over backward forward delete all other windows tag">C-x 1 character C-b C-f delete this C-x 0 Starting word M-b M-f split window in two vertically C-x 2 line C-p C-n split window in two horizontally C-x 3 To enter XEmacs, just type its name: go to line beginning (or end) C-a C-e scroll other window C-M- To read in a file to edit, see Files, below. sentence M-a M-e switch cursor to another window C-x o paragraph M-{ M-} shrink window shorter M-x shrink-window page C-x [ C-x ] grow window taller C-x ^ Leaving Emacs sexp C-M-b C-M-f shrink window narrower C-x { function C-M-a C-M-e grow window wider C-x } suspend Emacs (or iconify frame under X) C-z go to buffer beginning (or end) M-< M-> exit Emacs permanently C-x C-c select buffer in other window C-x 4 b scroll to next screen C-v display buffer in other window C-x 4 C-o scroll to previous screen M-v find file in other window C-x 4 f Files scroll left C-x < find file read-only in other window C-x 4 scroll right C-x > run in other window C-x 4 read a file into Emacs C-x C-f scroll current line to center of screen C-u C-l find tag in other window C-x 4 . save a file back to disk C-x C-s save all files C-x s Killing and Deleting Formatting insert contents of another file into this buffer C-x i replace this file with the file you really want C-x C-v indent current line (-dependent) entity to kill backward forward write buffer to a specified file C-x C-w indent region (mode-dependent) C-M-\ character (delete, not kill) DEL C-d indent sexp (mode-dependent) C-M-q word M-DEL M-d indent region rigidly arg columns C-x TAB Getting Help line (to end of) M-0 C-k C-k sentence C-x DEL M-k insert newline after point C-o The Help system is simple. Type C-h and follow the directions. sexp M-- C-M-k C-M-k move rest of line vertically down C-M-o If you are a first-time user, type C-h t for a tutorial. delete blank lines around point C-x C-o kill region C-w join line with previous (with arg, next) M-^ quit Help window q copy region to kill ring M-w delete all white space around point M-\ scroll Help window space kill through next occurrence of char M-z char put exactly one space at point M-SPC apropos: show commands matching a string C-h a yank back last thing killed C-y fill paragraph M-q show the function a key runs C-h c replace last yank with previous kill M-y set fill column C-x f describe a function C-h f set prefix each line starts with C-x . get mode-specific information C-h m Marking Case Change Error Recovery C-@ C-SPC set mark here or uppercase word M-u exchange point and mark C-x C-x abort partially typed or executing command C-g lowercase word M-l arg words recover a file lost by a system crash M-x recover-file set mark away M-@ capitalize word M-c paragraph recover files from a previous Emacs sessionM-x recover-session mark M-h uppercase region C-x C-u page C-x C-p undo an unwanted change C-x u or C-_ mark lowercase region C-x C-l sexp restore a buffer to its original contents M-x revert-buffer mark C-M-@ capitalize region M-x capitalize-region function redraw garbaged screen C-l mark C-M-h mark entire buffer C-x h The Minibuer Incremental Search Query Replace The following keys are defined in the minibuffer. search forward C-s complete as much as possible TAB search backward C-r interactively replace a text string M-% complete up to one word SPC search C-M-s using regular expressions M-x query-replace-regexp complete and execute RET reverse regular expression search C-M-r Valid responses in query-replace mode are show possible completions ? fetch previous minibuffer input M-p select previous search string M-p replace this one, go on to next SPC or y fetch next later minibuffer input M-n select next later search string M-n replace this one, don’t move , regexp search backward through history M-r exit incremental search RET skip to next without replacing DEL or n regexp search forward through history M-s undo effect of last character DEL replace all remaining matches ! abort command C-g abort current search C-g back up to the previous match ^ Type C-x ESC ESC to edit and repeat the last command that exit query-replace ESC Use C-s or C-r again to repeat the search in either direction. used the minibuffer. The following keys are then defined. If Emacs is still searching, C-g cancels only the part not done. enter recursive edit (C-M-c to exit) C-r delete match and enter recursive edit C-w previous minibuffer command M-p c 1998 Foundation, Inc. Permissions on back. v2.0 XEmacs next minibuffer command M-n 1 2 3 XEmacs Reference Card Regular Expressions Keyboard Macros

any single character except a newline . (dot) start defining a keyboard C-x ( Buers zero or more repeats * end keyboard macro definition C-x ) one or more repeats + execute last-defined keyboard macro C-x e select another buffer C-x b zero or one repeat ? edit keyboard macro C-x C-k list all buffers C-x C-b any character in the set [ . . . ] append to last keyboard macro C-u C-x ( kill a buffer C-x k any character not in the set [^ . . . ] name last keyboard macro M-x name-last-kbd-macro beginning of line ^ insert Lisp definition in buffer M-x insert-kbd-macro Transposing end of line $ quote a special character c \c alternative (“or”) \| Commands Dealing with characters transpose C-t grouping \( . . . \) transpose words M-t nth group \n eval sexp before point C-x C-e transpose lines C-x C-t beginning of buffer \‘ eval current defun C-M-x sexps transpose C-M-t end of buffer \’ eval region M-x eval-region word break \b eval entire buffer M-x eval-current-buffer Spelling Check not beginning or end of word \B read and eval minibuffer M-ESC beginning of word \< re-execute last minibuffer command C-x ESC ESC end of word \> read and eval Emacs Lisp file M-x load-file check spelling of current word M-$ any word-syntax character \w load from standard system M-x load-library check spelling of all words in region M-x -region any non-word-syntax character \W check spelling of entire buffer M-x ispell-buffer character with syntax c \sc character with syntax not c \Sc Simple Customization Tags Here are some examples of binding global keys in Emacs Lisp. Registers find a tag (a definition) M-. (global-set-key [(control c) g] ’goto-line) find next occurrence of tag C-u M-. (global-set-key [(control x) (control k)] ’kill-region) save region in register C-x r s specify a new tags file M-x visit-tags-table (global-set-key [(meta #)] ’query-replace-regexp) insert register contents into buffer C-x r i regexp search on all files in tags table M-x tags-search An example of setting a variable in Emacs Lisp: save value of point in register C-x r SPC run query-replace on all the files M-x tags-query-replace jump to point saved in register C-x r j (setq backup-by-copying-when-linked t) continue last tags search or query-replace M-, Writing Commands Shells enter the Info documentation reader C-h i (defun command-name (args) execute a shell command M-! "documentation" run a shell command on the region M-| Moving within a node: (interactive "template") filter region through a shell command C-u M-| scroll forward SPC body) start a shell in window *shell* M-x shell scroll reverse DEL An example: beginning of node . (dot) (defun this-line-to-top-of-window (line) Rectangles Moving between nodes: "Reposition line point is on to top of window. next node n With ARG, put point on line ARG. copy rectangle to register C-x r r previous node p Negative counts from bottom." kill rectangle C-x r k move up u (interactive "P") yank rectangle C-x r y select menu item by name m (recenter (if (null line) open rectangle, shifting text right C-x r o select nth menu item by number (1–5) n 0 blank out rectangle M-x clear-rectangle follow cross reference (return with l) f (prefix-numeric-value line)))) prefix each line with a string M-x string-rectangle return to last node you saw l select rectangle with mouse M-button1 The argument to interactive is a string specifying how to get return to directory node d the arguments when the function is called interactively. Type go to any node by name g C-h f interactive for more information. Abbrevs Other: Copyright c 1998 , Inc. run Info tutorial h designed by Stephen Gildea, April 1998 v2.0 XEmacs add global abbrev C-x a g list Info commands ? for GNU Emacs version 19 on systems add mode-local abbrev C-x a l quit Info q Updated for XEmacs in February 1995 by Ben Wing add global expansion for this abbrev C-x a i g search nodes for regexp s Permission is granted to make and distribute copies of this card pro- add mode-local expansion for this abbrev C-x a i l vided the copyright notice and this permission notice are preserved on explicitly expand abbrev C-x a e all copies. expand previous word dynamically M-/ For copies of the GNU Emacs manual, write to the Free Software Foun- dation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 4 5 6