|
|
1.1 ! root 1: .ds Tm \ \ ! 2: .TH EMACS 1 exptools ! 3: .SH NAME ! 4: emacs - interactive screen editor ! 5: .SH SYNOPSIS ! 6: .nf ! 7: emacs [-i init_file] [+line_number] [-x] [file] ! 8: .SH DESCRIPTION ! 9: .ad b ! 10: .fi ! 11: Emacs is an interactive screen editor which can be used to construct ! 12: and edit files on UNIX. A window of text from the file being edited ! 13: is displayed on the terminal screen, along with a status line ! 14: describing the editor version and file being edited. Ordinary ! 15: characters typed are inserted in the file, while escape sequences ! 16: and control characters are used to invoke editing functions. ! 17: Several files can be edited at the same time in different editing ! 18: buffers, and two of the active buffers can be displayed on the same ! 19: screen. ! 20: .PP ! 21: If given a \fIfile\fP argument, emacs reads the file into the buffer ! 22: "Main". Otherwise, an empty buffer is created. If a \fIline_number\fP is ! 23: given, emacs moves to that line number in the specified file. If ! 24: \fI-x\fP is specified, emacs asks for an encryption key and uses ! 25: \fBcrypt(1)\fP to read or write any files edited in that session. ! 26: (See also the ^Xk command.) If an \fIinit_file\fP is specified, ! 27: emacs will treat the contents of that file as emacs commands to be ! 28: executed on startup. Emacs also looks in your home directory for a ! 29: file named \fI.emacs_init\fP and interprets commands from it before ! 30: those in the specified \fIinit_file\fP are executed. This option ! 31: can also be specified with \fB.i\fP, in which case it suppresses the ! 32: processing of \fI.emacs_init\fP. ! 33: If an \fI.emacs_init\fP does not exist, emacs looks in the emacs ! 34: library directory (see below) for a standard \fI.emacs_init\fP. ! 35: .PP ! 36: Emacs can be customized by the user through user defined macro ! 37: commands, which can re-define the effect of the basic editing ! 38: commands. Emacs has a number of built in editing modes that ! 39: customize some of the commands to support editing of particular ! 40: types of files, such as C source programs or word processing source ! 41: documents. ! 42: .PP ! 43: There are a number of self-help features in emacs to aid in learning ! 44: how to use the editor. Complete documentation appears in: ! 45: .sp ! 46: .ti +10 ! 47: An Interactive Screen Editor for Unix ! 48: .br ! 49: and ! 50: .ti +10 ! 51: Writing macros for EMACS. ! 52: .PP ! 53: Emacs supports editing on most of the commonly used dislay ! 54: terminals including vt100, vt52, adm (adm3a), adm31, and most of the ! 55: Hewlett-Packard and Teletype terminals. The terminal type can be ! 56: entered when emacs is invoked, or set in the environment variable ! 57: TERM. On some systems, the \fBttype(1)\fP command can be used to ! 58: set your terminal type automatically by putting ! 59: .sp ! 60: .ti +10 ! 61: TERM=`ttype` ! 62: .br ! 63: .ti +10 ! 64: export $TERM ! 65: .sp ! 66: in your .profile. ! 67: .sp ! 68: If TERM is a given as a full path name, it will use a user ! 69: supplied terminal descriptor file. ! 70: .PP ! 71: .SH MISCELLANEOUS CONVENTIONS ! 72: .PP ! 73: Emacs treats the following characters specially in filenames: ! 74: .nf ! 75: ! 76: $NAME Evaluate NAME as an environment variable and substitute ! 77: ~USER Substitute the home directory of USER. ! 78: ~EMACS Specifies the emacs library directory. (contains ! 79: standard macros, etc.) ! 80: *,? Can be used for matching in partially specified ! 81: filenames. ! 82: `COMMAND` Substitute the output of running COMMAND. ! 83: {,[ Used as they are with the shell. ! 84: .fi ! 85: .sp ! 86: Emacs uses the following notation to display and input non-printing ! 87: characters: ! 88: .sp ! 89: .nf ! 90: ^X Control-X, where X is any character. These ! 91: characters are input by holding down the control key ! 92: and another key simultaneously on your terminal. ! 93: Emacs also provides a special mode (controlify) to ! 94: allow you to input control characters that your ! 95: terminal cannot send to your system (see the ! 96: discussion of modes). Some of the control ! 97: characters displayed are not very intuitive: ! 98: ^? Rubbout ! 99: ^[ Escape ! 100: ^] Control-right-bracket ! 101: ^\e Control-backslash ! 102: ^_ Control-underline ! 103: ^@ Null ! 104: ^H Backspace (Displays as ^H when ! 105: backspace mode is off, see below). ! 106: ^I Tab (Displays as ^I when notabs mode ! 107: is on.) ! 108: ^J Newline (Displays as ^J in searches) ! 109: ^M Carriage return ! 110: ! 111: M-x Meta-x, where x is any character (including a ! 112: control character. Meta characters are entered by ! 113: typing escape followed by another character. ! 114: .fi ! 115: .PP ! 116: Many emacs commands take an optional numeric argument. The argument ! 117: for a command precedes the command itself, and can be specified a ! 118: number of ways. Typing ^U specifies an argument of 4, or 4 times ! 119: the current argument. Typing escape followed by a sequence of ! 120: digits with or without a leading '-' specifies a decimal value. ! 121: Some examples: ! 122: .nf ! 123: .sp ! 124: ^U^U^N Go forward 16 lines ! 125: M-123^N Go forward 123 lines ! 126: M--12^N Go forward -12 lines (goes back 12 lines). ! 127: ! 128: .fi ! 129: .PP ! 130: Some emacs commands prompt for a string parameter, such as a file ! 131: name. Some of the normal emacs commands can be used to edit the ! 132: parameter while it is being entered. These include: ! 133: ^F,^B,^D,^H,^A,^E,^K,^U. In addition, typing your kill character ! 134: (usually @) deletes the string, typing ^X substitutes the ! 135: contents of the current line in the buffer, and ^Y substitutes the ! 136: current file name. (The latter is a very convenient way of finding ! 137: files with similar names.) ! 138: .SH REGULAR EXPRESSIONS ! 139: Emacs uses an extension of the regular expression syntax used by ! 140: \fBed\fP(1) and \fBgrep\fP(1) for regular expression searches and query replace. ! 141: The following character sequences have special meaning: ! 142: .nf ! 143: ! 144: . Matches any single character ! 145: [xyz] Matches one character among the set enclosed in ! 146: brackets. (If the first character is ^, it matches ! 147: all but the specified characters.) ! 148: * Matches 0 or more of the preceding expression (a ! 149: single character, specified as such or * or []) ! 150: + Matches 1 or more of the preceding expression ! 151: \e{x,y\e} Matches x through y occurrences of the preceding ! 152: expression. If y is omitted, it defaults to 255. ! 153: If x is omitted it defaults to 0. ! 154: \e(expr\e) Matches expr, and saves the text so matches for ! 155: later reference. ! 156: \e< Matches 0 characters at the beginning of a word. ! 157: \e> Matches 0 characters at the end of a word. ! 158: ^ Matches 0 characters at the beginning of a line ! 159: $ Matches 0 characters at the end of a line. ! 160: \en Matches on newline at end of a line, must be last ! 161: character in the expression. ! 162: ! 163: The following special sequences apply in the strings to replace with ! 164: in query replace. ! 165: ! 166: & Specifies the entire string matched by the from ! 167: string. ! 168: % Specifies the previous from string. ! 169: \e\fIn\fR Specifies the string matched by the \fIn\fRth occurrence ! 170: of \e(expr\e) (Regular expression replace only). ! 171: ^J Specifies a newline is to be inserted at this point. ! 172: ! 173: .fi ! 174: .SH COMMAND SUMMARY ! 175: The following chart summarizes the available commands by category. ! 176: Some commands appear in more than one category. Commands that are ! 177: marked with '*' take a numeric argument that indicates how many ! 178: times to do the command. Commands that are marked with '+' take a ! 179: numeric argument that changes the behavior of the command in some ! 180: other way. ! 181: .nf ! 182: ! 183: \fBGeneral Commands\fP ! 184: ^G Quit (Stops commands that prompt for things) ! 185: ^Z Exit one level (Usually exits emacs) ! 186: ^X^C Exit emacs ! 187: M-^Z Suspend emacs, (Requires a second ^Z on System 5 Unix) ! 188: M-? Help - Prompts for a command and displays its function. ! 189: M-w Put a wall chart of command explanations in the current buffer ! 190: +^L Refresh the screen. (Argument indicates where to put the ! 191: current line) ! 192: ! 193: \fBCharacter oriented commands\fP ! 194: *^F Move forward one character ! 195: *^B Move backward one character ! 196: *^D Delete the character under the cursor ! 197: *^H,^? Delete the previous character ! 198: *^T transpose the current and next character, move forward. ! 199: *^C Capitalize the current character ! 200: M-i Insert mode (macro, usually loaded from ~EMACS/.emacs_init) ! 201: M-o Overwrite mode (macro, usually loaded from ~EMACS/.emacs_init) ! 202: ! 203: \fBWord oriented commands\fP ! 204: *M-f move forward one word ! 205: *M-b move backward one word ! 206: *M-d delete forward one word ! 207: *M-^?,M-^h delete backwards one word ! 208: *M-c Capitalize the next word ! 209: *M-_ Underline the next word ! 210: M-a Move to the beginning of the sentence ! 211: M-e Move to the end of the sentence ! 212: ! 213: \fBLine oriented commands\fP ! 214: ^A move to beginning of line ! 215: ^E move to end of line ! 216: ^M-< Move to beginning of file ! 217: ^M-> Move to end of file ! 218: *^P move back one line ! 219: *^N move forward one line ! 220: +M-g Go to the line specified by the argument ! 221: *^O Create a blank line in front of the cursor ! 222: *^J,^M Make a new line (Just moves through empty lines). ! 223: *^K Kill (delete) to the end of line (with argument, kills whole lines) ! 224: ! 225: \fBDelete commands\fP ! 226: *^D Delete the character under the cursor ! 227: *^H,^? Delete the previous character ! 228: *M-d delete forward one word ! 229: *M-^?,M-^h delete backwards one word ! 230: *^K Kill (delete) to the end of line (with argument, kills whole lines) ! 231: +^W Delete the marked region (argument specifies a mark number) ! 232: *^Y Restore the last deletion (sets mark in front of it). ! 233: *M-Y Replace the marked region with the previous deletion ! 234: (Use only immediately ofter ^Y) ! 235: ! 236: \fBDisplay commands\fP ! 237: ^L Redraw the screen ! 238: *^V Display the next page ! 239: *M-v Display the previous page ! 240: M-< Move to beginning of file ! 241: M-> Move to end of file ! 242: M-^L redraw with the current line at the top of the screen ! 243: ! 244: \fBBuffer commands\fP ! 245: (Most prompt for a buffer name, entering return gets a list of active ! 246: buffers). ! 247: ^X^B change working buffer ! 248: +^X^F Find file (does change buffer if file is in one, creates a new ! 249: buffer and reads the file if not). ! 250: ^X^K Kill buffer ! 251: +^X^N Change buffer name (with argument, changes file name) ! 252: ^X^T Send region to buffer ! 253: ^X= Display statistics on buffer ! 254: ^X2 Enter two window mode (prompts for buffer name for second window) ! 255: ^X1 Make current window the only window ! 256: ^X^O Switch windows. ! 257: ! 258: \fBFile commands\fP ! 259: +^X^R Read file into current buffer (with an argument, inserts the ! 260: file at the current position) ! 261: +^X^W Write buffer to file (With an argument, appends to the file) ! 262: ^X^S Save current buffer into current file. ! 263: +^X^F Find file (does change buffer if file is in one, creates a new ! 264: buffer and reads the file if not). ! 265: +^X^N Change buffer name (with argument, changes file name) ! 266: +^X^L Load macros from file. (With an argument, undefines all ! 267: previously defined macros.) ! 268: ! 269: \fBRegion commands\fP ! 270: +M-(space) Set mark at position (argument the mark number) ! 271: +^X^X Exchange mark and cursor position (argument is mark number) ! 272: +^W Delete the region and put it on the kill stack ! 273: +M-p Put the marked region in the kill stack without deleting it. ! 274: ! 275: \fBSearch and Replace commands\fP ! 276: (All prompt for search and replace strings.) ! 277: ! 278: ^S,^R Forward and reverse incremental search. (Both display the ! 279: string currently matched. ^S moves to next occurrence, ^R ! 280: moves to previous occurrence. ^H deletes last character, ^G ! 281: quits search, escape exits search at currently displayed ! 282: position. See below on regular expression search. ! 283: ! 284: M-^S Regular expression search. (waits for whole expression to ! 285: be typed). ^S following M-^S goes to next occurrence. ! 286: ! 287: M-r,M-^R Ordinary and regular expression query replace. (Prompts at ! 288: each occurrence of from string for the following: ! 289: ! 290: y Replace with "to" string and move on. ! 291: n Do not replace this occurrence and move on. ! 292: r Replace all of the rest, showing each replacement. ! 293: R Replace the rest silently ! 294: p Move to previous occurrence of from string. ! 295: . Replace this one and stop ! 296: ^G Quit query replace ! 297: ^[ Prompt for new to string, and replace this ! 298: occurrence with it. ! 299: ! 300: \fBWindow commands\fP ! 301: ^X2 Enter two window mode (prompts for buffer name for second window) ! 302: ^X1 Make current window the only window ! 303: ^X^O Switch windows. ! 304: *^X^^ Make current window grow by one line. ! 305: ! 306: \fBSpecial input commands\fP ! 307: *^Q Takes the next input character and inserts it, even if it is ! 308: a control character ! 309: *M-Q Takes the next input character, makes it a meta character, ! 310: and inserts it. ! 311: +M-\e Converts it's argument to an ascii character and inserts it. ! 312: ! 313: \fBInteraction with Unix\fP ! 314: +M-! Prompt for a unix command and execute it (with an argument, ! 315: passes the buffer as standard input. ! 316: +M-$ Execute unix command, put output in .exec (with an argument, ! 317: appends to .exec., with an argument of 0, starts a ! 318: sub-process). ! 319: +^X^G Interrupt sub-process. ! 320: ^X^D Change working directory ! 321: M-^M Send the current buffer as mail. (Lines starting To: or Cc: ! 322: are taken as destinations.) ! 323: M-S Run \fBspell\fP(1) on current buffer (macro, usually ! 324: loaded from ~EMACS/.emacs_init). ! 325: ! 326: \fBMiscellaneous commands\fP ! 327: +^X^M Specifies modes (See below) ! 328: M-s Prints emacs statistics ! 329: M-z Kill emacs and produce a dump (DOES NOT SAVE BUFFERS) ! 330: +M-" Re-adjusts line boundaries in the whole buffer to fill lines ! 331: evenly. (With an argument, it works only on the current ! 332: region. ! 333: M-/ Start a C comment. ! 334: ! 335: ! 336: .SH Modes ! 337: Mode parameters allow you to customize the behavior of certain ! 338: commands. Some modes are switches, indicating only that something ! 339: is either off or on, while others are numeric parameters. Modes can ! 340: be set by the ^X^M command. Typing ^X^M followed by the name of a ! 341: switch mode turns it on, typing ^U^X^M followed by the name turns it ! 342: off. To set numeric modes, give the value you want as an argument ! 343: to ^X^M. (i.e. M-500^X^Msave). Modes can be set automatically by ! 344: putting ^X^M commands in your .emacs_init. Modes can also be ! 345: attached to a file by putting the string "EMACS_MODES: " followed by ! 346: a list of mode settings in the first 10 lines of the file. (The mode ! 347: settings can be preceded or followed by anything, to allow you to ! 348: make them look like a comment to other software processing the file.) ! 349: The mode settings are separated by commas and can be of the ! 350: following form: ! 351: .nf ! 352: .sp ! 353: modename: set this switch mode ! 354: !modename: Turn this switch mode off ! 355: modename=x: Set this numeric parameter to x. ! 356: .fi ! 357: .sp ! 358: The following indicates the modes and their default settings. ! 359: Switches are listed as either ON or OFF, while numeric parameters ! 360: have specified values. \fINote that the system default .emacs_init may ! 361: alter these settings on your local machine\fP ! 362: .nf ! 363: \fBsave\fP (OFF) Automatically saves each buffer after savetype ! 364: characters of input or when you change buffers ! 365: \fBsavetype\fP (256) Number of characters between automatic saves ! 366: \fBmailtype\fP (100) Number of characters between checks for new mail ! 367: \fBc\fP (OFF) Automatically indents during typing for C programs ! 368: \fBverbose\fP (ON) provides prompts for meta and control-x commands. ! 369: \fBfill\fP (ON) Automatically replaces a space with a newline when ! 370: you type past the end of line or past fillcol ! 371: characters. ! 372: \fBfillcol\fP (72) column beyond which lines are wrapped. ! 373: \fBeofnl\fP (ON) Causes a newline to be appended to any file that ! 374: doesn't end in one. ! 375: \fBend_newline\fP (OFF) Causes attempts to move beyond the end of the file ! 376: to add newlines. ! 377: \fBkeepscroll(0)\fP Number of lines kept from previous screen during ^V ! 378: and M-v ! 379: \fBreadonly\fP (OFF) Prevents saving the current buffer ! 380: \fBpicture\fP (OFF) Enables 2-dimensional editing (See the manual) ! 381: \fBtabstop\fP (8) Width of a tab character ! 382: \fBoverwrite\fP (OFF) Causes input to replace characters already there, ! 383: rather than insert. ! 384: \fBnodelete\fP (OFF) Causes deletions to replace the characters with ! 385: whitespace rather than deleting them. ! 386: \fBrigid_newline\fP (OFF) Causes newline to always insert a new line, even ! 387: if the next line is empty. ! 388: \fBnotabs\fP (OFF) Causes tabs to be expanded to spaces on input, and ! 389: tabs in files to display as ^I ! 390: \fBcomcol\fP (40) Column where the M-/ commands starts a comment. ! 391: \fBbackspace\fP (?) Causes backspaces to appear as cursor motion, not ! 392: ^H. This mode is set ON if your terminal handles ! 393: underscored characters, OFF otherwise. ! 394: \fBnobell\fP (OFF) Causes emacs not to ring the terminal bell on an error ! 395: \fBcaseless\fP (OFF) Causes all searches to ignore upper/lower case distinctions ! 396: \fBusilent\fP (OFF) Causes output from unix commands run from emacs to ! 397: be discarded. ! 398: \fBnoecho\fP (OFF) Causes output from M-$ commands not to be ! 399: echoed. ! 400: \fBcontrolify\fP (OFF) Causes a sequence of ctl_char followed by another ! 401: character to translate into the second character made ! 402: a control character. ! 403: \fBctl_char\fP (30) Prefix for controlify (This is an integer specifying ! 404: the ascii code of the character, the default is ^^. ! 405: \fBlnumb\fP (ON) Displays line numbers ! 406: \fBlnowid\fP (4) Width of line numbers. ! 407: \fBtime\fP (OFF) Displays a clock ! 408: \fBdisplay_percent\fP (OFF) Displays current position as a percentage of ! 409: the whole file. ! 410: \fBflow_lim\fP (0) If non-zero, flow control will be enabled whenever ! 411: flow_lim characters are sent to the terminal in a ! 412: burst. ! 413: \fBheight\fP (?) Height of screen area for buffer display (set automatically) ! 414: \fBwidth\fP (?) width of screen ! 415: \fBtspeed\fP (?) Describes your terminal to host speed. ! 416: \fBautoload\fP (ON) Automatically loads macros when first referenced. ! 417: ! 418: .fi ! 419: .SH ENVIRONMENT ! 420: The environment variable TERM if set is used to determine the ! 421: terminal type. The variable MAIL is the file name that emacs looks ! 422: at for newly arrived mail. If your mail is forwarded to some other ! 423: system, MAIL should not be exported. The environment variable ! 424: MAILER optionally specifies the name of a mail command to use for ! 425: sending mail. The environment variable SHELL specifies the shell to ! 426: use to execute shell commands. ! 427: .ne 5 ! 428: .SH FILES ! 429: .nf ! 430: $HOME/.emacs_init ! 431: ~EMACS/.emacs_init ! 432: $HOME/emacs[0-11] ! 433: ~EMACS/macros ! 434: ~EMACS/terminals ! 435: ~EMACS/helpfile ! 436: ~EMACS/errfile ! 437: .fi ! 438: The .emacs_init files, if present, contain a standard set of ! 439: initializations to be made when you start emacs. The characters in ! 440: the file will be interpreted as if you had entered them as commands ! 441: from your terminal. The most common application of this is to set ! 442: modes different from the default modes. ! 443: .PP ! 444: When emacs is killed by an internal error, the \fBkill\fP(1) command, or ! 445: by hanging up during an editing session, it saves your buffers in ! 446: the files emacs0-emacs11 in your home directory. You will receive ! 447: \fBmail\fP(1) notifying you of what buffers were saved. ! 448: .PP ! 449: The directory ~EMACS is the emacs library, the location of which ! 450: depends on your local installation. Pathnames starting with ~EMACS ! 451: will be translated to the local path of this directory by emacs (but ! 452: \fInot\fP by other tools). ~EMACS/macros contains a number of ! 453: useful macro packages that can be loaded. ~EMACS/terminals contains ! 454: terminal information for emacs. The other two files contain ! 455: internal data for emacs. ! 456: .sp ! 457: On exptools machines, if $TOOLS is set, ~EMACS is set ! 458: to $TOOLS/lib/emacs. If $TOOLS is not set, ~EMACS is ! 459: set to ~exptools/lib/emacs. ! 460: .SH SEE ALSO ! 461: .in +15 ! 462: .ti -15 ! 463: dired (1), ! 464: .br ! 465: .ti -15 ! 466: .I An Interactive Screen Editor for UNIX, ! 467: by Warren Montgomery ! 468: TM-5343-80-2 (Updated copy may be maintained in ! 469: ~EMACS/emacs.tm.x ! 470: .br ! 471: .ti -15 ! 472: .I Writing Macros for EMACS, ! 473: by Warren Montgomery (Updated copy may be maintained in ! 474: ~EMACS/macro.mm.x ! 475: .in
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.