|
|
1.1 ! root 1: .tr ~ ! 2: .\" EMACS_MODES: fill !c ! 3: .TL 126010-2200 40158-100 ! 4: An Interactive Screen Editor for Unix (Issue 2) ! 5: .AU "Warren Montgomery" WAM IH 55235 2494 6C-501 85-55235-? ! 6: .TM ?? ! 7: .SA 1 ! 8: .NR Pt 0 ! 9: .AS 2 ! 10: High speed data communication and display screen terminals make ! 11: possible a fundamentally different mode of entering and editing text ! 12: to a computer system. An interactive screen editor allows a user to ! 13: enter and edit files, and to see the effects of the editing ! 14: immediately. ! 15: .P ! 16: A good screen editor can improve productivity in several ways. The ! 17: need for paper listings, and thus the expense and delay in dealing ! 18: with them, is greatly reduced with the availability of a screen ! 19: editor. The editor can provide a customized environment for ! 20: particular tasks, such as editing program source or word processing, ! 21: which can relieve the user of the mechanical parts of the task (such ! 22: as maintaining proper indentation). The immediate feedback provided ! 23: reduces mistakes, and speeds up their detection. A simple set of editing ! 24: commands can be used ! 25: effectively by relatively unskilled users, because of the feedback ! 26: obtained by seeing the effects of editing. ! 27: .P ! 28: This memorandum describes an interactive screen editor for UNIX\*F ! 29: .FS ! 30: Unix is a Trademark of AT&T Bell Laboratories ! 31: .FE ! 32: known as EMACS. The editor is patterned after a very popular screen ! 33: editor originally developed at the Artificial Intelligence ! 34: Laboratory M.I.T. It was developed by the ! 35: author as a tool for his own work and is currently used by a large ! 36: number of users in Bell Laboratories. Emacs is available through ! 37: the experimental tools facility within Bell Labs, and through the ! 38: Toolchest package to outside customers. The editor provides a ! 39: friendly editing environment with the advantages outlined above, ! 40: while running in the small address space provided to the UNIX user ! 41: on the PDP\*F-11/70. This memorandum describes the commands and ! 42: editing environment of EMACS, and some experience with its use. ! 43: It obsoletes the first users manual published in 1980. ! 44: .FS ! 45: PDP is a Trademark of Digital Equipment Corporation ! 46: .FE ! 47: .AE ! 48: .MT "TECHNICAL MEMORANDUM" ! 49: .H 1 "INTRODUCTION" ! 50: Text editing is the most common task of many computer users. The ! 51: creation and modification of programs, data bases, and memoranda ! 52: occupies much of the time that a user spends with a computer system. ! 53: The ability to edit programs and recompile them was one of the ! 54: primary reasons for the success of early time-sharing systems over ! 55: batch processing systems. ! 56: .P ! 57: Many of the text editing tools now in use are based on the editors ! 58: for the early timesharing systems. These editors were developed for ! 59: an environment that included mostly low-speed (110 baud) printing ! 60: terminals, and expensive computer systems that were not prepared to ! 61: interact with the user on a character at a time basis. In such a ! 62: environment, it was appropriate to minimize the amount of output ! 63: produced by the editor, and to allow the user to specify a lot of ! 64: changes to be made by a single editor "command". Editors such as ! 65: the standard UNIX\*F editor (ed) are ideal for this environment. ! 66: .FS ! 67: Unix is a Trademark of AT&T Bell Laboratories ! 68: .FE ! 69: .P ! 70: In recent years, printing terminals have been repaced by display ! 71: terminals capable of handling high data rates in many applications. ! 72: The cost of ! 73: computing has steadily dropped. The text editing tools made ! 74: available to users must evolve to take advantage of these changes. ! 75: With a high-speed display terminal, minimizing output is no longer ! 76: appropriate. Instead, the display can be used to provide feedback ! 77: for the user on the results of editing. The lower cost of ! 78: computing, and better hardware support for terminals, make character ! 79: at a time interaction with the computing system feasible. The EMACS ! 80: editor described in this report is one attempt to take advantage of ! 81: these effects in order to provide the user with a simple and ! 82: powerful editing environment. ! 83: .P ! 84: EMACS is a screen editor that can be used to build or to edit files ! 85: using a display terminal, such as the hp2621, vt-100, or teletype ! 86: 5420. The user ! 87: interface to this editor is quite simple. The user is presented ! 88: with a display of the contents of a portion of the buffer being ! 89: edited. This display indicates \fIexactly\fP what is ! 90: in the area being displayed, including any non-printing characters. ! 91: The contents of the buffer being edited can be read from or written ! 92: to a UNIX file. ! 93: Characters typed by the user will be inserted into the buffer ! 94: (and reflected in the display) at the point indicated by the ! 95: terminal's cursor. This is the primary mechanism for entering and ! 96: modifying text. ! 97: .P ! 98: Control characters and escape sequences can be used to perform other ! 99: editing functions, such as moving the cursor to a different position ! 100: in the buffer, deleting text, replacing text, or searching. Thus ! 101: there is only one mode of interpretation of characters typed to ! 102: EMACS, in which either text to be entered or commands can be ! 103: entered. This simple interface relieves the user of the need to ! 104: remember what mode he is in, and prevents the disastrous ! 105: mistakes that can occur when text to be inserted is evaluated as an ! 106: editor command. A simple mechanism is provided to allow a user to ! 107: insert control and escape characters when needed. ! 108: .P ! 109: Although there is a rich vocabulary of commands available, ! 110: including commands that perform functions tailored to a particular ! 111: application (such as indenting a C program), the most common way in ! 112: which EMACS is used to edit is simply to position the cursor ! 113: over the area to be changed, and enter the changes. The immediate ! 114: feedback provided by the visual display appears to be very important ! 115: to the user. ! 116: .P ! 117: This editor was written by the author as an aide to his other work, ! 118: and patterned after the EMACS editor written for the PDP\*F-10 systems ! 119: .FS ! 120: PDP is a Trademark of Digital Equipment Corporation ! 121: .FE ! 122: at the M.I.T. Artificial Intelligence Laboratory. The interface to the ! 123: user closely follows that provided by the M.I.T. version, because ! 124: the author was familiar with that version. The implementation of ! 125: EMACS for UNIX described in this report was done by the author, and ! 126: is independent of any other implementations of Emacs. ! 127: .P ! 128: The author and his organization are not supporting EMACS. The ! 129: author is, however, willing to distribute copies of the software for ! 130: use within Bell Laboratories, and is interested in comments ! 131: regarding features or problems with EMACS. The author will repair ! 132: problems as time allows, but makes no guarantees to fix problems ! 133: promptly. ! 134: .P ! 135: The remainder of this report contains a user's manual for the EMACS ! 136: editor, and a discussion of the experience that we have had with ! 137: EMACS in our department. EMACS continues to evolve to provide more ! 138: commands and remove implementation restrictions. The users manual ! 139: here describes EMACS version 4.9, which was in use in March, 1985. ! 140: .P ! 141: This document is intended to serve the needs of a number of ! 142: different kinds of readers. Briefly, here is a guide on how to read ! 143: it for various kinds of readers. ! 144: .VL 40 ! 145: .LI "Getting Started as a New User:" ! 146: Read Chapters 2, 3, and 6. As you need to, refer to the information ! 147: in Chapters 4, 5, and 7. ! 148: .LI "Getting Started as an Experienced User:" ! 149: Users of other Emacs like editors will probably find the material in ! 150: chapters 6 to be most useful to start. ! 151: .LI "Referring to Specific Commands:" ! 152: All users will find the command and mode descriptions in chapters 4, ! 153: 5, and 6 to be useful to refer back to specific command ! 154: descriptions. ! 155: .LI "Learning about Editors in General:" ! 156: People interested in the general flavor of emacs and in our ! 157: experiences with it should read chapters 2 and 8 to get an ! 158: introduction and to see a discussion of how the features are used. ! 159: .LE ! 160: .H 1 "Basic concepts" ! 161: Before going into the editing commands of EMACS, some basic concepts ! 162: should be learned. EMACS operates rather differently from ! 163: line oriented editors, and even from other screen oriented editors ! 164: in the way that it treats the screen and the keyboard. Some of it's ! 165: conventions for displaying and inputing characters are not like ! 166: other Unix tools, primarily because they were originally developed ! 167: for another environment. ! 168: .H 2 "The Character Set" ! 169: EMACS operates on characters from an alphabet of 256 different ! 170: characters. These include the 128 ASCII characters that can be entered ! 171: from a terminal, and 128 "Meta" characters. A Meta character is ! 172: entered by preceding it with an escape (ESC key). ! 173: .P ! 174: In this document and in the displays produced by emacs, control ! 175: characters are indicated by the character '^' followed by the ! 176: equivalent printable character (usually capitalized). Thus '^X' ! 177: represents a control-x, which is typed by hitting the control ! 178: and 'x' keys simultaneously. For some ! 179: unusual non-printing characters, the display is not obvious: ! 180: .VL 10 ! 181: .LI "^?" ! 182: Rubout or delete (ASCII 0177) ! 183: .LI "^@" ! 184: Null (ASCII 0) ! 185: .LI "^[" ! 186: Escape (ASCII 033) ! 187: .LI "^\e" ! 188: The "fs" character (ASCII 034) ! 189: .LI "^]" ! 190: The "gs" character (ASCII 035) ! 191: .LI "^^" ! 192: The "rs" character (ASCII 036) ! 193: .LI "^_" ! 194: The "us" character (ASCII 037) ! 195: .LE ! 196: .P ! 197: Meta characters are typed to Emacs by hitting the escape character, ! 198: and then any second character (including a control character.) They ! 199: are displayed by emacs as "M-" followed by the equivalent ASCII ! 200: character. Thus "M-a" (Meta - a) is the character obtained by typing escape ! 201: followed by a, and "M-^B" (Meta - control-b) is the character ! 202: obtained by typing escape followed by control-b. ! 203: .H 2 "The display" ! 204: The display screen contains a window showing a view of the buffer ! 205: being edited, which contains about 20 lines on a typical display ! 206: terminal. The terminal cursor is positioned at the ! 207: point where the editor cursor (the current position where editing is ! 208: taking place) is in the buffer. Each line of the buffer ! 209: (delimited by a newline character) begins at the beginning of a display ! 210: line. A line that exceeds the screen width is normally continued on ! 211: the next screen line. Whenever a line must be continued on the next ! 212: screen line an exclamation mark (!) is displayed in the last column ! 213: of the first screen line. If the editor is in line number (lnumb) ! 214: mode, then a line number is printed at the beginning of each line in the buffer. ! 215: .P ! 216: Printable characters are displayed normally, while tabs are displayed as ! 217: white space that fills up the space on the screen until the next ! 218: position at a multiple of eight. ! 219: Non printing control characters and meta characters are printed with ! 220: the conventions outlined above. ! 221: .SP ! 222: If you edit a file which contains characters that have the high ! 223: order (parity) bit set, they will display as "M-" followed by the ! 224: display of the character. You will only run into this when trying ! 225: to edit files containing binary information. ! 226: .P ! 227: In addition to the display buffer, several lines of the screen are used ! 228: for status information and for displaying parameters entered into EMACS, ! 229: such a file name. One of these lines known as the status line contains the ! 230: editor name, editor version, buffer number and name, and file name. Some ! 231: of the more recently introduced commands described in this document ! 232: indicate the version in which they were introduced, so that you can ! 233: determine whether or not a particular command is in the version that ! 234: you are running. ! 235: If the buffer has not been modified since the file was read or written, ! 236: an '=' will be displayed between the buffer and file names. Otherwise, ! 237: a '>' will appear. ! 238: .P ! 239: The lines below the status line are used for the time of day display ! 240: (if time mode is on), and for emacs to prompt for parameters for ! 241: commands. Some commands cause the buffer display to be erased in ! 242: order to display other information in place of the buffer. The word ! 243: "Continue?" will be displayed at the bottom of the screen when this ! 244: happens. Typing 'y', ' ', or return will bring back the buffer ! 245: display. Typing 'n' may allow you to re-execute the command ! 246: producing the display. ! 247: .P ! 248: Figure 1 shows a typical screen during a EMACS session. The buffer ! 249: "Main", number 0, is being used to edit a program test.c. The ! 250: buffer has been modified since the last write to the file test.c. ! 251: .DF ! 252: .ce ! 253: Figure 1 EMACS screen Display ! 254: .SP 2 ! 255: 1 #include <stdio.h> ! 256: 2 /* EMACS_MODES: c, !fill, comcol=43 */ ! 257: 3 ! 258: 4 ! 259: 5 /* This is a c program */ ! 260: 6 ! 261: 7 main() ! 262: 8 { ! 263: 9 int i; ! 264: 10 char c; ! 265: 11 ! 266: 12 for (i = 0;i > 0; i++) { ! 267: 13 printf("i = %d\en",i); /* print i */ ! 268: 14 } ! 269: 15 } ! 270: 16 ! 271: ! 272: EMACS 4.8 (0) Main > test.c ! 273: ! 274: ! 275: .DE ! 276: .H 2 "The Text in The Buffer" ! 277: Each buffer that you edit holds a sequence of characters. Any ! 278: characters can be present in an emacs buffer, including control and ! 279: meta characters. The only limitation is on the number of characters ! 280: that can be on one line in the buffer. Normally, emacs treats the ! 281: buffer just as a sequence of characters. ! 282: .P ! 283: One difference between emacs and many editors is that emacs does not ! 284: treat "newline" characters specially. Between each pair of adjacent ! 285: lines of text in the buffer is an invisible "newline" character. If ! 286: the cursor is at the end of one line, it is in front of the newline ! 287: character, and deleting a single character will delete the newline, ! 288: causing the text in the following line to be joined to the current ! 289: line. Newlines can be inserted, deleted, and searched for like any ! 290: other characters. ! 291: .P ! 292: Some emacs commands operate on units of text in the buffer, like ! 293: words, lines, sentences, pages, etc. These work on top of the base ! 294: level which still treats the buffer as a string of ! 295: characters. ! 296: .H 2 "Command structure" ! 297: Unlike most other editors, emacs does not have distinct "modes" for ! 298: inserting text into the buffer and for entering commands. Thus ! 299: there are no commands for inserting text, and no special convention ! 300: to end a text insertion. Instead, at any point ordinary characters ! 301: can be inserted into the buffer simply by typing them, while control ! 302: and meta characters are used for editing commands. ! 303: .P ! 304: Each character that is typed into EMACS is in fact interpreted as a ! 305: command. All of the ordinary printing characters insert themselves into the ! 306: buffer being edited at the point defined by the cursor. Thus ! 307: the command invoked when you type the character 'x' inserts an x ! 308: into the buffer at the point shown by the cursor. The control and ! 309: meta characters are used for various editing functions. ! 310: .H 2 "Arguments and Parameters" ! 311: All commands, including the printing characters, take a numeric argument ! 312: that has some effect on their interpretation. The default argument ! 313: given to a command for which no argument is specified is 1. To ! 314: specify some other argument to a command, you can enter escape, ! 315: followed by a sequence of digits, and then the command. ! 316: You can specify a negative value for an argument by entering escape ! 317: followed by '-', followed by a sequence of digits. ! 318: Numbers starting with a 0 are interpreted as ! 319: octal, while numbers starting with any other digit are decimal. ! 320: A second ! 321: way of specifying the argument is to precede the command by one or more ! 322: ^U (control-u) characters. Each ^U multiplies the value of the argument ! 323: by 4. ! 324: .P ! 325: For most commands, the effect of the argument is to multiply the ! 326: number of times that the command is applied. Thus the sequence ^U^Ux ! 327: inserts 16 x's into the buffer at the current location. The sequence ! 328: ESC13^N moves forward 13 lines in the buffer. ! 329: .P ! 330: In addition to the numeric argument given to all commands, some ! 331: commands will prompt the user for additional character string ! 332: parameters. The commands that take parameters, and the method of ! 333: entering parameters are described in the section on file and buffer ! 334: commands. ! 335: .H 1 "Basic Emacs Commands" ! 336: As noted above, every character you type to emacs is interpreted as ! 337: a command. This section describes a simple set of commands that ! 338: will be sufficient for most editing that you do. Subsequent ! 339: sections describe more advanced commands that are very useful in ! 340: certain situations, and other aspects of emacs. ! 341: .P ! 342: Emacs has a large number of commands. Most of them have a mnemonic ! 343: significance that should be obvious (like ^B for backwards or ^D for ! 344: delete). Some, unfortunately, don't have any obvious meaning. As a ! 345: general rule, control character commands operate on characters and ! 346: lines, while the corresponding meta character commands operate on ! 347: words or sentences. ! 348: .P ! 349: The user interface of emacs was designed for touch typists. A ! 350: deliberate choice was made to use control and meta characters for ! 351: commands rather than special keys, such as the function or "arrow" ! 352: keys on many terminals, since these keys are different on every ! 353: terminal and generally cannot be reached without taking your fingers ! 354: off of the home position of the keyboard. Typically the only ! 355: difficulty faced by an emacs user in adapting to a new terminal is ! 356: locating the escape key, which is unfortunately located differently ! 357: on every terminal. With a little practice, you will find that your ! 358: fingers become adept at locating the keys for all of the basic ! 359: commands with little thought and without having to look at the ! 360: keyboard. ! 361: .H 2 "Getting Help or getting out of trouble" ! 362: Emacs has many self-help features. The commands listed in this ! 363: section are useful to know about because they can provide help or ! 364: remedy mistakes. ! 365: .VL 10 ! 366: .LI "M-?" ! 367: Explain. This command prompts for a character and prints a brief ! 368: explanation of what that character does. ! 369: .LI "M-w" ! 370: Wall Chart. This command puts a listing of all commands (including ! 371: user defined commands), and their help explanations into the ! 372: current buffer. This command is a ! 373: convenient way of producing a "wall chart" of the commands. The ! 374: list is inserted into the buffer at the current position, so that ! 375: normally one would want to execute it in an empty buffer. ! 376: The appendix to this report contains a current copy of the wall chart. ! 377: .LI "^L" ! 378: Refresh. refresh the display. Occasionally, some error may cause the ! 379: display to become garbled. ^L re-creates it from scratch. If you ! 380: give an argument to ^L, it is used to specify how many lines will ! 381: appear on the screen before the current line. When invoked with an ! 382: argument, this command does not re-create the display from scratch. ! 383: .LI "^G" ! 384: Abort. Typing ^G at any point that emacs is asking for input ! 385: will abort the current command. This applies at ! 386: any step (specifying arguments, typing escape, entering parameters ! 387: that emacs asks for, etc.). (There are a couple of exceptions ! 388: related to advanced editing commands, but even with these, typing ^G ! 389: several times will always get you out with minimal damage). ! 390: This is a convenient way of aborting anything that you are not sure ! 391: that you want to complete, and may not know how you started. ! 392: .LI "M-u" ! 393: Undo. This command undoes the effect of the last significant text ! 394: modifying command that can be undone. Undo is it's own inverse, so ! 395: invoking undo twice in a row undoes the result of the undo command. ! 396: Significant text modifying commands include all except insertion of ! 397: individual characters (including newlines), and the open-line (^O) ! 398: command. ! 399: .P ! 400: Almost all commands can be undone, but a few effects of commands ! 401: can't be undone. M-u will not undo the ! 402: effects of reading or writing files, nor can it undo anything done ! 403: by executing unix commands from emacs. Undo cannot be used to bring ! 404: back buffers that may have been inadvertently killed with the ^X^K ! 405: command (see below). Undo can undo all other significant text ! 406: modifications, with the exception that when the last significant text ! 407: modification was a replace command, only a limited number of ! 408: replacements can be undone. If more replacements were done with one ! 409: command, undo prints a warning error message and if the user ! 410: specifies then undoes what it can. ! 411: .LI "^X^C" ! 412: Quit Emacs. ! 413: If any buffers have been modified since the last write, EMACS will ! 414: ask whether or not to write out each such buffer before exiting. ! 415: EMACS will not ask whether or not to save an empty buffer. ! 416: .LI "BREAK" ! 417: Emacs will not respond to your normal interrupt character, but it ! 418: will respond if you hit the BREAK key on your terminal. Break ! 419: causes emacs to stop anything that it was doing at the next ! 420: convenient point, and displays a message to you listing some ! 421: options. When you hit break you can either continue what you were ! 422: doing, abort what you were doing, exit from emacs, or suspend what ! 423: you were doing such that you can return to it later if you wish. ! 424: .LE ! 425: .H 2 "Simple cursor movement commands" ! 426: There are many ways to move the cursor around in the buffer without modifying ! 427: the text in the buffer. Most of these use their argument to specify ! 428: how many times the movement is to be repeated. ! 429: .VL 10 ! 430: .LI "^F,^B" ! 431: Move forward or backward one character. Recall that the end of each ! 432: line counts as one character, so that ^F at the end of one ! 433: line will put you at the beginning of the next line. ! 434: .LI "^N,^P" ! 435: Move to next or previous line. Emacs moves to the same character ! 436: position in the line below (^N) or above (^P) the current line. ! 437: Note that if the buffer contains tab or control characters, the same ! 438: character position in the lines in the buffer may display at ! 439: different points in the screen. ! 440: .LI "^A,^E" ! 441: Move to the beginning (^A) or end (^E) of the current line of the ! 442: buffer. Note that these work on one line of the buffer, not one ! 443: line of the screen. If the current line is longer than will fit on ! 444: one line of the screen display, these commands will move up or down ! 445: on the screen to the real beginning or end of the line in the buffer. ! 446: .LI "M-<,M->" ! 447: Move the cursor to the beginning or end of the buffer. ! 448: .LI "M-f,M-b" ! 449: Move the cursor forward or backward by one word. In emacs, words ! 450: are delimited by non-alphabetic or non-numeric characters. If your ! 451: terminal is capable of displaying underscored characters, emacs will ! 452: not consider these characters as separating words. ! 453: .LI "M- a,M-e" ! 454: Move the cursor to the beginning or end of the current sentence. ! 455: The end of a sentence is defined as a punctuation mark followed by two ! 456: or more whitespace characters (blanks or newlines). With an ! 457: argument, these commands can be used to move forwards or backwards ! 458: by a specified number of sentences. ! 459: .LI "^V,M-v" ! 460: Move to next or previous page. The cursor is moved forward or ! 461: backward so that the display will show the text just before or just ! 462: after the text now in the window on the screen. ! 463: .LI "M-g" ! 464: Move the cursor to the line number specified by the argument given ! 465: to the command. ! 466: .LE ! 467: .H 2 "Simple Text Deleting and Moving Commands" ! 468: Several commands are available to delete text from the buffer. All of ! 469: these commands operate on text near the current cursor position. The ! 470: deletion commands are: ! 471: .VL 10 ! 472: .LI "^D,^H" ! 473: Delete forwards or backwards from the cursor. ^H, or backspace ! 474: deletes the character immediately before the cursor. ^? or rubout, ! 475: is a synonym for ^H. ^D deletes the character on top of the cursor. ! 476: If given arguments, these commands delete blocks of text forward or ! 477: backward of the current cursor position. ! 478: .LI "M-d,M-^?" ! 479: Delete words forwards or backwards from the cursor. These two ! 480: commands delete words (as defined for M-f and M-b). If the current ! 481: cursor position is in the middle of a word, M-d will delete from the ! 482: cursor to the end of the word while M-^? will delete everything ! 483: before the cursor. ! 484: .LI "^K" ! 485: Delete to the end of this line. If invoked without an argument, ^K ! 486: deletes the remaining text on this line (if any). If no text follows the ! 487: cursor on the current line, ^K deletes the newline. With an ! 488: argument of 0, ^K deletes the text before the cursor on the current ! 489: line. With an argument of n greater than zero, it ! 490: deletes n lines forward from the cursor position. The text from the ! 491: cursor up to and including the nth newline is deleted. With an ! 492: argument less than zero, the deletion is backwards from the cursor ! 493: position. ! 494: .LI "M-~" ! 495: (Meta space) ! 496: The command Meta-space places an invisible mark on the ! 497: current cursor position. This mark can be used in subsequent editing. ! 498: Each mark is simply a position in the buffer (line number and ! 499: character within the line.) Thus if you add or delete text in front ! 500: of a position where a mark was placed, the mark may not remain on ! 501: the same character, but stays on the same position. ! 502: .P ! 503: Emacs actually maintains 16 different marks, normally allocated as ! 504: one per buffer. (Thus if you set marks in different buffers, they ! 505: are normally independent.) You can, however, alter this by ! 506: specifying a mark number as an argument to Meta-space and other ! 507: commands that work with marks. This allows you to mark up to 16 ! 508: different positions in one buffer. The command ^@ (Control-@) is a ! 509: synonym for Meta-space, but cannot be typed on all keyboards. ! 510: .LI "^W" ! 511: The command '^W' deletes the text between the current cursor position and ! 512: the mark. This is a convenient way to delete a well defined block of text. ! 513: If an argument is specified, it is used to select the mark number ! 514: The mark can be either before or after the cursor position and ! 515: achieve the same effect. ! 516: .LI "^Y" ! 517: Insert last killed text. All text that is deleted is saved in a "kill ! 518: stack". The kill stack holds the last 16 deletions. There is ! 519: also a limit on the total amount of text that can be held in the ! 520: kill stack, but you are unlikely to encounter it. ! 521: ^Y retrieves the most recently deleted text. The most ! 522: frequent use of this command is in moving text around. The procedure ! 523: is: kill the text to be moved, move the cursor to where you want it, and ! 524: enter ^Y. Another use of ^Y is to undo an unwanted deletion. ^Y ! 525: leaves the mark at the beginning of the inserted text, and puts the ! 526: cursor at the end. ^Y treats it's argument (if any) as a count for ! 527: the number of copies of the deleted text to bring back, and not a ! 528: mark number. ^Y operates only with the default mark. ! 529: .LI "M-y" ! 530: Replace last retrieved text. This command kills the text between ! 531: the cursor and the mark and replaces it with the next to last item on ! 532: the kill stack. This command can only be used immediately after ^Y, ! 533: where it changes text that has just been retrieved. By entering ^Y ! 534: followed by some number of M-y's, any text in the kill stack can be ! 535: retrieved. ! 536: .LI "M-p" ! 537: Pickup the region of text. This command picks up the text between ! 538: the current position and the mark and puts it in the kill stack, ! 539: without changing the buffer. This is useful for duplicating blocks ! 540: of text in the buffer. An argument can be used to specify which mark ! 541: to use ! 542: .LI "^X^X" ! 543: (Type control-X twice) Exchange the cursor position and the mark. ! 544: An argument can be specified to indicate the mark to exchange with. ! 545: .LE ! 546: .H 2 "Simple File and buffer Commands" ! 547: Commands that access files and buffers must ask for the ! 548: name of the appropriate file or buffer. All of these commands (and ! 549: some of the others) ask for the appropriate information at the ! 550: bottom of the screen. You can use some of the simple editing ! 551: commands described here, plus a couple of special commands, to edit ! 552: a file or buffer name that you enter this way. The commands that ! 553: you can use for editing are: ! 554: .VL 10 ! 555: .LI "^F,^B" ! 556: Move forward or backward one character ! 557: .LI "^A,^E ! 558: Go to beginning or end of line. ! 559: .LI "^D,^H" ! 560: Delete forward or backward ! 561: .LI "^U" ! 562: Multiply the effect of the next command by 4. ! 563: .LI "^K" ! 564: Kill (erase) the whole line ! 565: .LI "^G" ! 566: Abort the command asking for information ! 567: .LI "^X" ! 568: Enter the current line from the file at the cursor ! 569: .LI "^Y" ! 570: Enter the current file name at the cursor ! 571: .LI "^L" ! 572: Redisplay the prompt and the string being entered ! 573: .LI "^T" ! 574: Transpose the characters before and after the cursor ! 575: .LI "^Q" ! 576: Quote the following character (eliminates the special significance ! 577: of the next character and just sticks it literally in the string ! 578: being typed.) ! 579: .LI "return" ! 580: End the string being typed, and continue editing. (If the cursor is ! 581: in the middle of the line, the whole line is given to whatever ! 582: command asked for it, not just the text before the cursor). ! 583: .LE ! 584: .P ! 585: Most of the file accessing commands are invoked through the ^X command. ! 586: ^X is a prefix for several useful commands, most of which involve file ! 587: or buffer access. ! 588: These commands are invoked by a ^X followed by a second character. ! 589: .P ! 590: In the commands that ask for filenames, the normal shell conventions ! 591: for partially specified names can be used. Any of the following ! 592: sequences can be used in a filename and will be substituted ! 593: properly. ! 594: .tr ~~ ! 595: .VL 20 ! 596: .LI "$VARIABLE" ! 597: Substitutes the value of the environment variable $VARIABLE or ! 598: nothing if VARIABLE is not defined. Thus you can use path names like ! 599: $HOME/.profile. ! 600: .LI "* and ?" ! 601: These characters can be used to specify incomplete filenames and ! 602: will be expanded. If more than one file matches the name given, ! 603: then emacs will pick only the first one. ! 604: .LI "~USER" ! 605: This translates into the home directory of the user USER. In ! 606: addition, EMACS always translates the special name ~EMACS into an ! 607: emacs library directory. This is a directory where special ! 608: files needed by emacs are stored and where standard macros are ! 609: stored (in ~EMACS/macros). ! 610: .LI "`COMMAND`" ! 611: This causes COMMAND to be run and substitutes it's standard output. ! 612: .LE ! 613: .tr ~ ! 614: .P ! 615: With these preliminaries out of the way, here are some of the ! 616: commands that work with files and buffers ! 617: .VL 10 ! 618: .LI "^X^R" ! 619: Read file. EMACS will prompt for a file name, which you enter as ! 620: described above. When the file name for ^X^R has been entered, EMACS ! 621: will read the specified file into the buffer. ! 622: .P ! 623: Many of the commands in this section, including ^X^R, use their ! 624: argument to specify minor variations on the basic action of the ! 625: command, rather than specifying a count. In the normal case, (with ! 626: the default argument of one), ^X^R clears the buffer before reading. ! 627: If ^X^R is invoked with an argument that is not 1 (i.e. ^U^X^R) it ! 628: inserts the file into the buffer at the current cursor position. ! 629: If ^X^R is invoked with a negative argument, no error message is ! 630: produced if the specified file cannot be read. ! 631: .LI "^X^W" ! 632: Write file. ! 633: Normally, if the specified file exists and has two or more links to ! 634: it, EMACS will ask whether to overwrite the existing copy of the ! 635: file or to unlink the specified file name and create a new file in ! 636: its place, leaving the contents of the old file (which may be ! 637: obtained through the other names it was linked to) unchanged. ! 638: If emacs fails or the unix system crashes during an attempted write ! 639: (either ^X^W or ^X^S), the previous contents of the file are saved ! 640: in a file .EMACS in your current working directory. ! 641: .P ! 642: Passing an argument to ^X^W (i.e. ^U^X^W) causes the contents of the ! 643: current buffer to be appended to the specified file rather than ! 644: replacing it. ! 645: .LI "^X^S" ! 646: Save buffer. This writes out the buffer to the last file read or written if ! 647: the file has been modified. If the buffer was not read from a file, ! 648: and has never been written to one, such that there is no file name ! 649: associated with the buffer, emacs will ask for a filename to save ! 650: the buffer in. ! 651: .LI "^X^B" ! 652: Change buffer. EMACS allows up to 12 named buffers to be edited ! 653: concurrently. Each buffer can hold a different file, and has it's ! 654: own current cursor position. In emacs you work with one buffer at a ! 655: time, although you can display two buffers on the screen at the same ! 656: time. The ^X^B command asks for the name of a buffer and makes ! 657: that buffer the current buffer. ! 658: .P ! 659: All of the commands that ask for buffer names accept either the text ! 660: name of the buffer, or the buffer number (shown in parentheses after ! 661: the editor name on the status line) for a buffer name. The number ! 662: is convenient if you ! 663: don't like typing long names. Emacs treats two buffer names ! 664: specially. For any of the commands that ask for buffer name, if you ! 665: enter an empty buffer name (by just hitting return in response to ! 666: the prompt, emacs shows you a display of all of your currently ! 667: defined buffers, indicating which one is current and which ones have ! 668: been modified since they were last written. If you type space ! 669: or 'y' in response to the prompt that appears after the display, ! 670: emacs will abort whatever command asked for the buffer name and ! 671: continue editing. If you type 'n' in response to the prompt, ! 672: emacs will ask again for the buffer name, and then complete whatever ! 673: command asked for the buffer name. If the buffer ! 674: name "..." is entered, a new, empty buffer with a unique name is created. ! 675: .LI "^X^F" ! 676: Find file. This command prompts for a file name and switches to a ! 677: buffer that holds the specified file. If the specified file has ! 678: been read into a buffer, the effect of find file is to change to ! 679: that buffer. If no buffer holds the specified file, the effect of ! 680: find file is to create a new buffer and read the specified file into ! 681: it. Find file is a convenient way to switch between editing several files. ! 682: If ^X^F is invoked with a negative argument, no error message is ! 683: produced if the specified file cannot be found. ! 684: .LI "^X^K" ! 685: Kill Buffer. This command prompts for a buffer name and destroys ! 686: the specified buffer. You cannot kill the current buffer this way. ! 687: Text in the buffer that is killed is lost and cannot be recovered. ! 688: .LE ! 689: .H 2 "Simple Search, Replace, and other commands" ! 690: Emacs provides several commands that search for text in the buffer, ! 691: and also commands which allow you to specify global replacements, ! 692: like change every instance of "football" to "baseball". The ! 693: simplest forms of these commands are described here, along with a ! 694: couple of miscellaneous commands that are useful. More complex ! 695: versions of search and replace are described in the subsequent ! 696: section on advanced editing. ! 697: .VL 10 ! 698: .LI "^S,^R" ! 699: Forward and Reverse Search. These commands allow you to look for ! 700: text in your buffer. Emacs will prompt at the bottom of the screen ! 701: with "Search" or "Reverse Search". In response to the prompt, you ! 702: can type in characters, and emacs will begin to look for the next ! 703: match for what you type, going either forwards (^S) or backwards ! 704: (^R) from the current position in the buffer. Emacs will ! 705: show you the text that matches what you have typed as you type it, ! 706: by moving the cursor to the text, possibly moving the display window ! 707: in the buffer if the text you are looking for was not visible. As ! 708: you type in the string to look for, you get immediate feedback about ! 709: what emacs has found. In addition to typing normal printing ! 710: characters that become part of the string you are looking for, you ! 711: can type some special characters to either edit the string you are ! 712: looking for, or control the search in some other way: ! 713: .VL 15 ! 714: .LI "^H" ! 715: This deletes the last character of the search string, and will cause ! 716: the cursor to go back to whatever matches what is left. ! 717: .LI "escape" ! 718: Hitting escape stops the search, leaving the cursor on whatever you ! 719: last found. ! 720: .LI "^G: " ! 721: This quits from the search and goes back to the point in the buffer ! 722: where you started the search from. ! 723: .LI "return or newline: " ! 724: These both cause a newline to become part of the search string. the ! 725: newline is displayed as "^J" (which is the control character ! 726: actually used by unix to indicate "newline") in the search string to ! 727: allow you to see it. Thus if you type "^Sthe~end<return>of", emacs ! 728: will look for a spot where "the~end" appears at the end of one line ! 729: and "of" appears at the start of the next line ! 730: .LI "^S or ^R: " ! 731: These characters control the search. In general, if you are going ! 732: forward, and type ^R, or going backwards and type ^S, the search ! 733: changes direction, starting from the last thing you found. If you ! 734: are going forward and type ^S or backwards and type ^R, the search ! 735: proceeds to the next occurrence (in whatever direction you were ! 736: going) of the search string. If you type ^S or ^R as the very first ! 737: thing after starting a search, emacs takes the \fIlast\fP string ! 738: that you successfully found with a search and makes it the current ! 739: search string. These characters provide a convenient way to ! 740: navigate when looking for something that occurs many times in the ! 741: buffer. ! 742: .LI "^Q: " ! 743: Typing ^Q "quotes" the next character, making it part of the search ! 744: string. This is a way to look for strings that contain control ! 745: characters. ! 746: .LI "other control characters: " ! 747: Typing any other control character causes the search to stop at ! 748: whatever you found, and then executes the command corresponding to ! 749: that control character. ! 750: .LE ! 751: .P ! 752: This kind of search is called an incremental search in emacs, ! 753: because it shows you what you have matched incrementally as you type ! 754: it. It is very easy to learn to use. For incremental search, the ! 755: search string must \fIexactly\fP match whatever you are looking for. ! 756: (There is a more complicated search available that allows some ! 757: pattern matching, and is described in the advanced commands ! 758: section.) Incremental search stops, indicating that it fails if you ! 759: reach the beginning or end of the buffer. Normally, search ! 760: considers upper and lower case letters to be different, however you ! 761: can override this with "caseless" mode. ! 762: .LI "M-r" ! 763: Query replace. You will be prompted for a From string and a To string. ! 764: Each can be edited using the conventions described in the previous ! 765: section for editing filenames. In general, Query ! 766: replace will allow you to replace all of the strings in your buffer ! 767: from the current cursor position to the end of the buffer that match ! 768: the From string with the To string. In the To string, the '&' ! 769: character can be used to designate replacement with the From string. ! 770: To get a real '&', prefix it with a '\e'. To get a real '\e', prefix ! 771: it with another '\e'. ! 772: EMACS then searches for the from string, positions the cursor in ! 773: front of it, and prompts you. You can control the replacement of the ! 774: item in question by what you type: ! 775: .VL 15 ! 776: .LI "<space> or y" ! 777: Replace this occurrence and move on to the next one. ! 778: .LI "n or ^?" ! 779: Skip this occurrence and move on to the next. ! 780: .LI "." ! 781: Replace this occurrence and exit query replace. ! 782: .LI "^G" ! 783: Quit. (Exit query replace without replacing the current match.) ! 784: .LI "b" ! 785: Go back to the previous occurrence of the "To" string. It won't find ! 786: one that you have already replaced! ! 787: .LI "r" ! 788: Replace the rest without stopping to ask after each, and show the ! 789: result of the replacement after each. ! 790: .LI "R" ! 791: Replace the rest silently. (i.e. don't show the result after each ! 792: replacement.) ! 793: .LI "<ESCAPE>" ! 794: (Version 4.6) Causes emacs to ask for a new string to replace the "To" string with ! 795: with. The current occurrence will be replaced with what you type, ! 796: and emacs will go on to the next occurrence. ! 797: .LE ! 798: .P ! 799: Normally, query replace will show all occurrences of the search ! 800: string. With an argument (i.e. ^UM-r), it behaves like the ! 801: substitute command of the ed editor, looking at only the first match ! 802: of the From string on each line. Query replace exits when the from ! 803: string is no longer matched. '?' prints a summary of the options. ! 804: As with incremental search, the From string must match exactly to ! 805: something in the buffer. There is a more advanced form of query ! 806: replace that allows pattern matching and is described in the section ! 807: on advanced commands. ! 808: .LI "^O" ! 809: Open up a line. This command creates one or more empty lines at the ! 810: current cursor position. This is useful for inserting text in the ! 811: middle of the buffer, while minimizing the amount of screen refresh ! 812: needed. ! 813: .LI "^T" ! 814: Transpose the next two characters. The cursor moves forward one ! 815: character for each transposition, such giving ^T a count as an ! 816: argument causes the character in front of the cursor to be dragged ! 817: forward through the text. ! 818: .LE ! 819: .H 1 "Advanced Editing Commands" ! 820: The commands described in the previous section are sufficient to ! 821: allow a user to perform most editing tasks efficiently. The ! 822: commands in this section for the most part cover special situations, ! 823: like inserting control characters into files, or provide more ! 824: efficient ways to to things in certain situations. ! 825: .H 2 "Inserting 'odd' characters" ! 826: Because EMACS uses control and escape characters for commands, you ! 827: cannot directly insert them into the buffer by typing them. The ! 828: following three commands are useful for the occasional need to get ! 829: such characters into a buffer. ! 830: .VL 10 ! 831: .LI "^Q" ! 832: Quote the next character(s). ^Q accepts one or more characters (the ! 833: number of characters specified by its argument) from the terminal ! 834: and inserts them "blindly" into the buffer without interpretation. ! 835: Only the newline (line feed) character is interpreted. EMACS strips ! 836: the parity bit from all characters read from the terminal, so all ! 837: characters inserted this way have zero parity. ! 838: .LI "M-q" ! 839: Quote characters and turn on parity bit. This acts just like ^Q, ! 840: however it turns on the parity bit in the character before ! 841: inserting. Characters inserted this way will be displayed as meta ! 842: characters by EMACS. ! 843: .LI "M-\e" ! 844: Convert the argument to a character and insert into the buffer. ! 845: This command takes its argument and converts it to a character and ! 846: inserts it. This provides an easy way to convert from octal or ! 847: decimal to ASCII, and is occasionally useful for inserting odd ! 848: characters for which the ASCII code is known. ! 849: .LE ! 850: .H 2 "Commands related to Windows" ! 851: Emacs provides a way to display two buffers on the screen at the ! 852: same time. When this is done, the screen is split vertically, and ! 853: one buffer is displayed in the top half and one in the bottom half. ! 854: The status line will show status of the current buffer. ! 855: .P ! 856: When emacs displays two buffers like this, only the one that is the ! 857: current buffer is actively updated. The display for the other just ! 858: sits on the screen undisturbed until you return to that buffer. You ! 859: can have the same buffer displayed in both windows, however note ! 860: that the current position is associated with a buffer, not a window, ! 861: thus if you move the current position in the lower window, when you ! 862: return to the upper window, the cursor will immediately move to ! 863: wherever you were in the lower window. If you have different ! 864: buffers in the two windows, the current positions in both buffers ! 865: are independent, as they are with any two buffers. ! 866: .VL 10 ! 867: .LI "^X2" ! 868: Enter two window mode. Emacs will ask for a buffer to show in the ! 869: second window. The current buffer becomes the top window, while the ! 870: buffer that you type in response to the prompt goes in the lower ! 871: window and becomes the current buffer. ! 872: .LI "^X^^" ! 873: Grow window. Makes the current window grow by the number of lines ! 874: specified by the argument to ^X^^. This command works only when you ! 875: are in two window mode. You can use a negative argument to cause ! 876: the current window to shrink. ! 877: .P ! 878: You can also use this command to grow or shrink the buffer display ! 879: with only one window on the screen. This can be useful in avoiding ! 880: long delays when working from a low speed terminal port. ! 881: .LI "^X1" ! 882: Return to one window. The current window grows to fill the screen. ! 883: .LI "^X^O" ! 884: Switch windows. Make the dormant window current and the current ! 885: window dormant. ! 886: .LE ! 887: .H 2 "Advanced Search and Replace Commands" ! 888: The simple incremental versions of search and replace described ! 889: above require that you match what you are looking for exactly. The ! 890: commands described here allow pattern matching of regular ! 891: expressions, like those used by the ed editor. ! 892: .P ! 893: The description of regular expressions is to complex to reproduce ! 894: here. Refer to the manual for ed for a brief description. Emacs ! 895: provides two additional special sequences for regular expressions. ! 896: The character sequences "\e<" and "\e>" can be used ! 897: to match the beginning and end of words. Thus the string \e<the\e> ! 898: will match any occurrence of the word "the", but not any word ! 899: containing the sequence of letters "the", such as "other". ! 900: .P ! 901: In constructing regular expressions, it is important to remember ! 902: that in order to avoid the special significance of a character ! 903: like '.' or '*', you must prefix it with a backslash '\e'. If you ! 904: must have control characters in regular expressions, you can quote ! 905: them for emacs by typing ^Q before the control character. ! 906: .P ! 907: Note also that regular expression searches are constrainted to ! 908: matching only those things that fit all one one line. ! 909: .P ! 910: .VL 10 ! 911: .LI "M-^S" ! 912: Regular Expression Search. This will prompt for a ! 913: regular expression to search for. You can edit the expression like ! 914: editing filenames. You can search forward or backward, either ! 915: ending at the beginning or end of buffer, or wrapping around (like ! 916: ed) depending on the argument given to the search command: ! 917: .VL 10 ! 918: .LI "1" ! 919: (default) Search forward, wrapping from the end of the buffer to the ! 920: beginning, and failing only if the buffer contains no match for the ! 921: given string. ! 922: .LI "-1" ! 923: Search backwards, wrapping around from the beginning to end of the ! 924: buffer. ! 925: .LI "> 1" ! 926: Search forwards, stopping at the end of the buffer. ! 927: .LI "< -1" ! 928: Search backwards, stopping at the beginning of the buffer. ! 929: .LE ! 930: .P ! 931: In all cases, you can have emacs repeat the search, looking for the ! 932: next (or previous) occurrence of the search string by typing ^S or ^R ! 933: immediately after the regular expression search. ! 934: .LI "M-^R" ! 935: Regular expression query replace. This is just like ! 936: query replace, except that a regular expression is allowed in the ! 937: search string. You may also use the special character sequence ! 938: \e<digit>, to specify that the characters matched by the ! 939: nth subexpression (delimited by \e( and \e)) are to be used in the ! 940: replacement string. ! 941: .LE ! 942: .H 2 "Macros, Keyboard Macros, and Input Files" ! 943: Emacs provides a number of ways for a user to construct editor ! 944: programs from sequences of commands. The macro programming facility ! 945: is the best way to construct substantial programs, and is described ! 946: in a companion document. The commands listed here deal with two ! 947: other ways of saving a sequence of emacs commands for later use, ! 948: Input files and Keyboard Macros, and with the commands that load ! 949: "full" macros into Emacs for your use. ! 950: .VL 10 ! 951: .LI "^X^I" ! 952: Re-direct input. This command directs EMACS to take input from a ! 953: file. The file is assumed to contain EMACS commands, and can be ! 954: created by editing with EMACS, using ^Q to enter control and escape ! 955: characters. You can also create an input file by using the commands to ! 956: create keyboard macros described below, and then saving the ! 957: resulting keyboard macro file. ! 958: .P ! 959: This command can be used to perform a series of ! 960: commands on the current buffer, or to set up a standard set of ! 961: initializations. Thus the file should contain \fIexactly\fP what ! 962: you would type from the keyboard to perform whatever task you wish ! 963: to perform. Note that if the file contains only printable ASCII text, ! 964: tabs, and newlines, ^X^I will effectively read the file into the ! 965: buffer at the current location. Note, however, that this is very ! 966: slow, and much better done with ^X^R. ! 967: .P ! 968: A file suitable for executing with ^X^I is known as a keyboard ! 969: macro, because it is interpreted just as if it had been typed from ! 970: the keyboard. The following commands provide a sensible way to ! 971: create and execute keyboard macros. ! 972: .LI "^X( ! 973: Begin Keyboard Macro. ! 974: This command starts remembering the keystrokes you enter so that ! 975: they can later be executed as a keyboard macro. ! 976: .LI "^X) ! 977: End Keyboard Macro. ! 978: This command stops remembering keystrokes for a keyboard macro. ! 979: .LI "^XE ! 980: Execute Keyboard Macro. ! 981: This command retrieves and executes the keystrokes typed between ! 982: ^X( and ^X). Emacs executes them just like they came from your ! 983: terminal. Keyboard macros are saved in the file .emacs_kbd in your ! 984: home directory. These are saved between sessions, so that ^XE is ! 985: in fact the same as invoking ^X^I (Input file) and giving ! 986: $HOME/.emacs_kbd as the file name to execute. Note again that you ! 987: can use ^X( and ^X) to create a keyboard macro, save it for ! 988: later use by moving the file $HOME/.emacs_kbd to another file, and ! 989: then invoke it by invoking ^X^I with the name of the file you saved. ! 990: .LI "^Xd" ! 991: Define macros. ! 992: This command treats the current buffer as definitions of new macro ! 993: commands. The commands are defined and become available for use. ! 994: For a complete description, consult the macro programming manual. ! 995: Note that you should not use ^Xd with the file created from a ! 996: keyboard macro. The format of "full" macros is different. Macros ! 997: are explained in a separate manual. ! 998: .LI "^X^L" ! 999: .tr ~~ ! 1000: Load macros. ! 1001: This command allows you to load "full" macro definitions from a ! 1002: file. It is described in the macro programming manual, however even if ! 1003: you do not program your own macros, you may be interested in using ! 1004: those defined by others and will use ^X^L to load the resulting ! 1005: files. On most systems on which emacs is installed, there is a library ! 1006: directory of macros available for general use in ~EMACS/macros, and ! 1007: the file ~EMACS/macros/CATALOG gives a catalog to the available ! 1008: macros. ! 1009: .tr ~ ! 1010: .LI "^Z" ! 1011: Exit level. ! 1012: In an emacs editing session, you may wind up in a nested level of ! 1013: emacs. This can happen either by typing "break", and responding "y" ! 1014: to suspend whatever you were doing and invoke a new command ! 1015: interpreter, or by invoking a macro that uses the recursive edit ! 1016: command to allow you to edit something from inside of a macro. ^Z ! 1017: exits your current level of emacs, returning to whatever called it. ! 1018: .P ! 1019: The ^Z command performs a function similar to ^X^C, and in fact if ! 1020: you have not invoked a macro that uses the "recursive edit" command, ! 1021: and have not hit break, both will cause you to exit from emacs. ! 1022: .LE ! 1023: .H 2 "Commands that escape to Unix" ! 1024: There are several commands that interact with unix, allowing you to ! 1025: run unix commands or send mail from inside of emacs. ! 1026: .VL 10 ! 1027: .LI "M-!,M-$" ! 1028: Unix escape. These two commands implement five different ways to run ! 1029: unix commands from emacs. In all cases, the commands prompt for the ! 1030: name of a unix command to be run and run it. The command is run ! 1031: through your normal shell as indicated by $SHELL. If you enter the ! 1032: special command name "sh", it runs your normal shell instead of ! 1033: "sh". To facilitate writing programs that interact with emacs, the ! 1034: environment variable "filename" is set to the name of the current ! 1035: file in emacs when the command is run. The following summarizes the ! 1036: various flavors: ! 1037: .VL 8 ! 1038: .LI "M-!" ! 1039: Run the command, suspending emacs while it runs. ! 1040: .LI "^UM-!" ! 1041: Run the command and feed it the contents of your current buffer as ! 1042: standard input. When the buffer is exhausted, the command will see ! 1043: an end of file. ! 1044: .LI "M-$" ! 1045: Run the command with standard input from your terminal but standard ! 1046: output and standard error are captured in the buffer ".exec", which ! 1047: is created if it doesn't already exist. (If it does exist, the ! 1048: command output replaces its current contents). Normally, output ! 1049: from the command is also displayed on the terminal as it is ! 1050: produced, but this can be overridden via the usilent or noecho modes ! 1051: described in the section on modes. ! 1052: This is useful for saving a copy of the error messages produced by a ! 1053: C compilation of a file being edited, for example. The file name of ! 1054: the .exec buffer is set to the command line that produced it. This ! 1055: can be useful if you want to re-execute the same command, as you can ! 1056: make .exec your current buffer, enter M-$, and enter ^Y followed by ! 1057: newline as the command line. ^Y gets the old command line back, and ! 1058: newline will execute it. ! 1059: .LI "^UM-$" ! 1060: Run the command and append the output to the buffer ".exec". This ! 1061: is just like the above except that the .exec buffer is not cleared ! 1062: and the output from the command is appended to it. It also inserts ! 1063: the command line into the .exec buffer when the command is run. ! 1064: .LI "M-0M-$" ! 1065: Start the command as a sub-process in the current buffer. The ! 1066: command is run with input and output connected to pipes maintained ! 1067: by emacs. Control returns to emacs immediately while the command ! 1068: runs asynchronously. Output produced by the command is ! 1069: asynchronously appended to the buffer as it is produced, and the ! 1070: mark is set to the end of the output produced by the command. Input ! 1071: can be sent to the command in one of two ways: First, whenever you ! 1072: enter a newline in this buffer and the mark is on the current line, ! 1073: emacs will send the text between the mark and your newline to the ! 1074: sub-process. This means that if you run a shell in a buffer, you ! 1075: can interact with it by typing in the buffer just as if it were ! 1076: running independent of emacs. When it prints its prompt, the mark ! 1077: is set to the end of the prompt, and when you hit return, the ! 1078: current line after the prompt is sent to the shell. The second way ! 1079: to send input to the buffer is to use the ^X^T command described ! 1080: in the next section. This sends the current region to a buffer. If that buffer ! 1081: has a sub-process, the region is sent to the end of the buffer and ! 1082: also to the sub-process as well. One use of this feature is to ! 1083: provide a rapid way to send new function and data declarations to an ! 1084: interpreted language like LISP. ! 1085: .P ! 1086: This feature is new as of emacs 4.9 and has some limitations you ! 1087: should be aware of. First, you can have only one sub-process ! 1088: running at a time. Running a second one will kill the first one. ! 1089: Killing the buffer will also kill the sub-process. (Note that it ! 1090: may not kill all of the descendants of the sub-process.) On ! 1091: Berkeley unix systems (4.2BSD), this feature is reasonably ! 1092: inexpensive to use and the response from the command will be quick. ! 1093: On System V Unix, there may be some delay between the time at which ! 1094: output is produced and the time at which it is seen. Emacs will ! 1095: always look for output from the process before looking for ! 1096: characters typed by you at the terminal, however if you are not ! 1097: typing, it may take some time for emacs to notice command output. ! 1098: (On some unix/370 and amdahl unix systems command output is not ! 1099: noticed until you type at emacs due to a bug in the I/O software on ! 1100: these systems). Some commands may not run properly as ! 1101: sub-processes, depending on what version of the standard I/O ! 1102: software they were compiled with. Most interactive programs will, ! 1103: however, function properly in this mode. Because of the different ! 1104: nature of the implementation, this feature may also cause emacs to ! 1105: consume more CPU time while a sub-process is running. ! 1106: .LE ! 1107: .LI "^X^G" ! 1108: Interrupt sub-process. If the current buffer has a sub-process running, ! 1109: this command sends an interrupt signal (SIGINT) to that process, ! 1110: just as if you had typed your normal interrupt character from the ! 1111: terminal. If you give this command an argument, it sends the signal ! 1112: number corresponding to that argument. (For example, M-9^X^G would ! 1113: send a kill signal to the sub-process.) ! 1114: .LI "M-^M" ! 1115: Mail. This command takes the current buffer as unix mail, and sends ! 1116: it. The buffer must contain at least one line starting To: , which ! 1117: specifies the recipients of the mail. Each recipient is delimited by a ! 1118: space. Any number of recipients may be listed in a single line, ! 1119: however to improve readability, additional To: or Cc: lines may be ! 1120: used in specifying lists of recipients. ! 1121: Any errors encountered by mail are printed. If the environment ! 1122: variable $MAILER is set, then it is taken as the name of the command ! 1123: to run to send the mail. Otherwise, emacs runs "mail". ! 1124: .LE ! 1125: .H 2 "Miscellaneous commands" ! 1126: The remaining commands handle special situations that occur once in ! 1127: a while. ! 1128: .VL 10 ! 1129: .LI "^X^T" ! 1130: Send text to another buffer. ! 1131: This command sends the text between the mark and the current cursor ! 1132: position in the current buffer to another buffer. EMACS prompts for ! 1133: the name of the other buffer, and the text is inserted into that ! 1134: buffer at the current cursor position for that buffer. The current ! 1135: buffer remains unchanged. If an argument is given, it selects the ! 1136: mark to use. If the target buffer has a sub-process running under ! 1137: it, then the region is also sent to that process and is always put ! 1138: at the end of the buffer. (See the description of M-$ for more ! 1139: information.) ! 1140: .LI "M-s" ! 1141: Statistics ! 1142: This command displays some statistics about your editing session, ! 1143: such as how may characters emacs has sent to you and how many ! 1144: characters you have typed. The information is normally not of much ! 1145: interest. ! 1146: .LI "^X=" ! 1147: Status. Displays status information (current line, number of lines ! 1148: in buffer, current character position, number of characters in ! 1149: buffer, etc.). ! 1150: .LI M-/ ! 1151: Begin comment. This command begins a C program comment by moving to ! 1152: the appropriate column and putting a /* in the buffer. The next ! 1153: newline will close the comment and automatically append a */ ! 1154: .LI "M-_" ! 1155: Underline word. This command underlines the following word of text. ! 1156: Useful for generating underlined text for mm. ! 1157: .LI "^C" ! 1158: Capitalize. ! 1159: This command capitalizes the letter under the cursor and moves the ! 1160: cursor forward one position. Lower case alphabetic characters are ! 1161: converted to upper case, while other letters are unchanged. ! 1162: .LI "M-c" ! 1163: Capitalize word. The letter under the cursor is capitalized, and ! 1164: the cursor is moved to the beginning of the next word. ! 1165: .LI "M-l (4.6) ! 1166: Lower case letter. The letter under the cursor is capitalized and ! 1167: the cursor is moved to the right. ! 1168: .tr ~~ ! 1169: .LI "M-~" ! 1170: Unmodify Buffer. This command causes a buffer to be marked as ! 1171: unmodified even if it has been modified since the last write. Doing ! 1172: this will avoid having EMACS ask whether or not to write the buffer ! 1173: when you exit if you know that you do not want to rewrite the ! 1174: buffer. With an argument greater than 1 (i.e. ^UM-~) this command ! 1175: marks the buffer as modified. With an argument of zero or a ! 1176: negative argument, it does not change the state of the buffer but ! 1177: returns the buffer modified flag as its result. ! 1178: .tr ~ ! 1179: .LI "M-t" ! 1180: Set terminal type. Prompts for terminal type and sets the character ! 1181: sequences used to display text to be appropriate for that terminal. ! 1182: Most common terminal types are supported. ! 1183: Emacs uses terminal commands for relative and absolute ! 1184: cursor position, clear screen, clear from the cursor to the end of ! 1185: line, insert and delete lines, and insert and delete characters. ! 1186: The number of characters transmitted for re-display will depend on ! 1187: which of these functions are available. Thus EMACS transmits fewer ! 1188: characters on an adm31, which has all of these functions, than with ! 1189: an adm3a, which has only cursor positioning and clear screen. Most ! 1190: terminals fall between these extremes. ! 1191: .LI "M-^L" ! 1192: Redisplay top. Redisplay the window with the current line at the top. ! 1193: This is useful for viewing the lines that follow the current line. ! 1194: Note that this does not re-create the entire display, as does ^L, so ! 1195: it will not correct garbling. ! 1196: .LI M-" ! 1197: Auto Fill Buffer. This command re-adjusts the lines in the buffer ! 1198: so that each line contains 72 or fewer characters. The adjustment ! 1199: is done like nroff (mm) by moving words from one line to another. ! 1200: nroff or mm command lines and blank lines are preserved as is. This ! 1201: command can be used to improve the way in which an nroff or mm ! 1202: source file displays, by getting rid of long lines, without ! 1203: affecting the output. ! 1204: .LI "M-:" ! 1205: Remap character (version 4.9). The command M-: allows you to re-map ! 1206: character commands. ! 1207: It prompts for a character (or a meta or ^X sequence) and a command ! 1208: (also a character sequence) to put on that character. This allows you to ! 1209: re-configure EMACS to your liking. You can re-map any character you ! 1210: like, including characters like ^X, escape, and ^U. Note that the ! 1211: command string is always interpreted with the default bindings (as ! 1212: documented in this memo), and not with the bindings set up with ! 1213: earlier M-: commands. Thus M-:^A^B followed by M-:^B^A will swap ! 1214: the ^A and ^B commands, since the command ^A in the second M-: ! 1215: command refers to the default meaning of ^A, not that established by ! 1216: the first M-: command. M-: also changes the behavior of the ! 1217: control characters used to edit filenames and other string ! 1218: parameters, but does not change the behavior of some of the ! 1219: characters that have special meaning in response to prompts issued ! 1220: by various commands, such as the responses to query replace. ! 1221: .P ! 1222: With an argument of 2 or 4 (^UM-:), this command asks for a ! 1223: character and a macro name to assign to that character. This allows ! 1224: you to bind macro commands to characters by their names instead of ! 1225: their current character binding. ! 1226: .P ! 1227: With an argument of 0 (M-0M-:), this command resets all of the ! 1228: keyboard character bindings to their default values. This may be ! 1229: useful in recovering from trouble. ! 1230: .P ! 1231: In all cases, the bindings established with this command and through ! 1232: defining macros apply to both character commands typed from the ! 1233: keyboard and to characters in keyboard macros and initialization ! 1234: files. They do not apply to the character commands executed in the ! 1235: body of "full" macros. See the section on macros and the ! 1236: macro command manual for further information on bindings. ! 1237: .LI "^X^M" ! 1238: Set Mode. This command can be used to set parameters to customize ! 1239: the behavior of emacs. For more information on modes, see the next ! 1240: section. ! 1241: .LE ! 1242: .H 1 "Modes" ! 1243: EMACS has a variety of parameters that can be ! 1244: changed from commands entered in the terminal. ! 1245: These are referred to as "modes" in this document and in the ! 1246: messages printed by emacs. ! 1247: There are two types of modes: on/off ! 1248: modes and integer modes. The '^X^M' command can ! 1249: be used to display or set these parameters. '^X^M' will prompt for ! 1250: the name of the mode to set. If you enter a return in response to ! 1251: the prompt, the current mode settings are displayed. Normally, ! 1252: emacs will display the value of each integer mode, and the name of ! 1253: each on/off mode that is currently on. If you enter return in ! 1254: response to '^U^X^M', emacs will also display the names of the ! 1255: on/off that are currently off, indicating for each mode whether it ! 1256: is on or off. ! 1257: .P ! 1258: Modes are set by giving the name of the mode to set in response to '^X^M'. ! 1259: If an on/off mode is given, it is turned on if no argument ! 1260: is given to '^X^M', and turns it off if an argument is specified. ! 1261: (Thus '^X^M' turns on, '^U^X^M' turns off). For an integer mode, the ! 1262: mode is set to the value of the argument. ! 1263: .P ! 1264: The modes and their types are listed in the following sections, along ! 1265: with their default values. For ON/OFF modes, the default is \fBhighlighted\fP. ! 1266: The modes are grouped into 4 broad categories: ! 1267: .BL ! 1268: .LI ! 1269: Display modes change the information in the buffer is displayed, but ! 1270: have no effect on it's content. ! 1271: .LI ! 1272: Interface modes change the command interface to emacs in minor ways, ! 1273: but don't really change any of the behavior of the commands. ! 1274: .LI ! 1275: Command modes change the way in which some of the commands work. ! 1276: .LI ! 1277: Terminal modes change the way that emacs uses the terminal, and ! 1278: exist mainly to get around special problems caused by certain kinds ! 1279: of terminals. ! 1280: .LE ! 1281: .H 2 "Display modes" ! 1282: .VL 15 ! 1283: .LI "lnumb" ! 1284: Line Number Mode (\fBON\fP/OFF) ! 1285: .br ! 1286: This mode causes the current line number ! 1287: to display at the left of each line. ! 1288: .LI "lnowid" ! 1289: line number width (INTEGER=4) ! 1290: .br ! 1291: This parameter specifies how many character positions are reserved ! 1292: for the line number when in line number mode ! 1293: .LI "height" ! 1294: Display height (INTEGER=<screen_size-4>) ! 1295: .br ! 1296: This parameter dictates how many lines from the buffer will be ! 1297: displayed on the screen. It is automatically set based on the ! 1298: terminal type whenever the terminal type is set, and is changed by ! 1299: the one and two window commands. This mode and width mode can be ! 1300: set explicitly to restrict the display to a subset of the entire ! 1301: terminal screen, or can be used to allow you to use a terminal with ! 1302: a settable screen size for which emacs does not have the right size ! 1303: built in. ! 1304: .LI "width" ! 1305: Screen Width (INTEGER = <set based on terminal type>) ! 1306: .br ! 1307: This mode specifies the width of the display screen. ! 1308: .LI "tabstop" ! 1309: Tabstop (INTEGER=8) ! 1310: .br ! 1311: This mode is the number of characters per tab that are displayed. ! 1312: Displaying a deeply indented c program may look much better if ! 1313: tabstop is set to something smaller than the eight default. ! 1314: .LI "backspace" ! 1315: Backspace Mode (ON/\fBOFF\fP). ! 1316: .br ! 1317: Turning on backspace mode causes backspace ! 1318: characters (^H) to display as moving back one column rather than as ! 1319: a ^H. This is very useful for viewing nroff output or manual pages, ! 1320: but editing the resulting text can be a bit tricky, because it is ! 1321: impossible to tell whether the character under the cursor is the one ! 1322: being displayed, one that has been overprinted, or a backspace. ! 1323: .LI "time" ! 1324: Time mode (ON/\fBOFF\fP) ! 1325: .br ! 1326: When time mode is on, EMACS will display the ! 1327: time of day below the mode line (the one that says EMACS and the ! 1328: buffer name). The time is updated every time a character is read. ! 1329: Using time mode when entering lots of text is expensive. ! 1330: .LI "display percent (4.5)" ! 1331: Display cursor as percent of buffer (ON/\fBOFF\fP) ! 1332: .br ! 1333: If set, emacs will display the percentage of the current buffer ! 1334: beyond the current cursor position on th mode line ! 1335: .LI "7bit_ascii (4.8)" ! 1336: Display only 7 bit characters (ON/\fBOFF\fP) ! 1337: This mode controls how characters with the high order bit set are ! 1338: displayed. With this mode off, they are displayed as "M-" followed ! 1339: by the character. With this mode ON, they are displayed as ! 1340: highlighted (underlined) characters. This mode is most useful for ! 1341: editing files used with Personal Computer word processing systems ! 1342: which use the high order bit for formatting control. ! 1343: .LI "leftmargin" (4.9)" ! 1344: Left most displayed Column (INT=0). ! 1345: In picture mode (See Section 5.3), emacs automatically scrolls the ! 1346: window left or right to keep the cursor on the screen. This mode ! 1347: allows you to examine or alter this behavior. The value of ! 1348: leftmargin is the left ! 1349: most displayed column. Setting it will cause the screen to scroll ! 1350: left or right. In all cases, if the cursor wanders out of the ! 1351: window, emacs will pick it's own leftmargin to keep it on the ! 1352: screen. ! 1353: .LE ! 1354: .H 2 "Interface modes" ! 1355: .VL 15 ! 1356: .LI "save" ! 1357: Auto Save Mode (ON/\fBOFF\fP) ! 1358: .br ! 1359: If auto save mode is on, EMACS will ! 1360: automatically write the current buffer after savetype characters ! 1361: have been entered since the last save. This mode reduces the chance ! 1362: of disaster in the event of a crash, but can be annoying by causing ! 1363: a lot of writing. ! 1364: .LI "savetype" ! 1365: Save type ahead (INTEGER=256) ! 1366: .br ! 1367: If auto save mode is on, this is the ! 1368: number of keystrokes between saves. ! 1369: .LI "verbose" ! 1370: Verbose mode (\fBON\fP/OFF) ! 1371: .br ! 1372: When verbose mode is on, EMACS will prompt ! 1373: for more input when ^X, ^Q, escape, or ^U are entered. This makes ! 1374: it easier to keep track of where you are. ! 1375: .LI "keepscroll" ! 1376: scroll keep lines (INTEGER=0) ! 1377: .br ! 1378: This parameter specifies how many lines are to be preserved on the ! 1379: screen when forward page or backward page is invoked. ! 1380: .LI "caseless" ! 1381: ignore case in searches ! 1382: .br ! 1383: This mode causes case lower case characters in the search string to ! 1384: match either case in the buffer on all searches and query replace. ! 1385: .LI "mailtype" ! 1386: check mail interval (INT=100) ! 1387: .br ! 1388: This parameter determines the number of input characters between ! 1389: checks of your mailbox ($MAIL). When emacs discovers something in ! 1390: your mailbox, a warning is displayed at the bottom of the screen. ! 1391: .LI "end_newline" ! 1392: Behavior of ^N at end of buffer (ON/\fBOFF\fP) ! 1393: .br ! 1394: This parameter determines whether executing the ^N command in the ! 1395: last line of the buffer adds a new line to the buffer (mode ON) or ! 1396: whether it signals an error (mode OFF). ! 1397: .LI "usilent" ! 1398: Silent UNIX commands (ON/\fBOFF\fP) ! 1399: .br ! 1400: If set, this parameter causes emacs not to display the command name ! 1401: or output for M-$. This is useful for invoking a unix command in a ! 1402: macro and capturing the output without disturbing the display. ! 1403: .LI "noecho" ! 1404: Don't echo M-$ output (ON/\fBOFF\fP) ! 1405: .br ! 1406: If set, emacs will not echo the output of commands run with M-$ to ! 1407: the terminal. The difference between noecho and usilent is that ! 1408: usilent isolates commands run from emacs from the terminal ! 1409: completely, so that emacs does not clear the screen and does not ! 1410: have to redraw it when the command exits. noecho has no effect at ! 1411: all on commands run via M-!, but does eliminate the display of ! 1412: output from M-$. It is most useful when you wish to run something ! 1413: that will produce lots of output, capturing the output in .exec. ! 1414: .LI "eofnl (4.6)" ! 1415: Write newline at end of file. (\fBON\fP/OFF) ! 1416: .br ! 1417: This mode when on causes emacs to append a newline character to any ! 1418: file written by emacs from a buffer that does not end in a newline. ! 1419: Emacs allows you to create files that do not end in newline. ! 1420: Unfortunately, many unix tools get confused when reading such a ! 1421: file. This mode is on by default, and prevents you from writing a ! 1422: file that will cause troubles. For editing files which you do not ! 1423: want to end in a newline, turn this mode off. ! 1424: .LI "savelink (4.6)" ! 1425: Preserve links on write (ON/\fBOFF\fP) ! 1426: .br ! 1427: Turning this mode on will cause emacs to automatically ! 1428: write into the existing file when writing to a file with multiple ! 1429: links, instead of asking the user what to do in this situation. ! 1430: .LI "search_newline (4.6)" ! 1431: Newline ends search (ON/\fBOFF\fP) ! 1432: .br ! 1433: Turning this mode on causes incremental search to stop if a newline ! 1434: or carriage return is typed from the terminal. ! 1435: .LI "autoload (4.7)" ! 1436: Automatic macro loading (\fBON\fP/OFF) ! 1437: .br ! 1438: This mode controls the automatic loading of macro packages when an ! 1439: undefined macro is called. If autoload mode is on and an undefined ! 1440: macro by the name of <name> is called, emacs will first ! 1441: attempt to load ! 1442: .tr ~~ ! 1443: $EMACS_LIB/<name> (resolving the environment variable $EMACS_LIB), ! 1444: and then try to load ~EMACS/macros/<name>. If either of these ! 1445: files exists and defines a macro called <name>, that macro will be ! 1446: called and execution will continue. Otherwise, an error message is ! 1447: produced. This allows macros to be ! 1448: loaded incrementally, only when needed. With the mode off, any ! 1449: attempt to call an undefined macro results in an error. ! 1450: .tr ~ ! 1451: .LE ! 1452: .H 2 "Command modes" ! 1453: .VL 15 ! 1454: .LI "fill" ! 1455: Auto Fill Mode (\fBON\fP/OFF) ! 1456: .br ! 1457: If this mode is on, emacs will ! 1458: automatically move to the next line whenever the cursor moves to the ! 1459: end of the line, breaking the line at a word boundary. This is very ! 1460: useful for entering text, as no newlines need be entered in the ! 1461: middle of the text. ! 1462: .LI "fillcol" ! 1463: Auto Fill Column (INTEGER=72) ! 1464: .br ! 1465: This is the character position beyond which auto fill mode will ! 1466: cause the line to be broken. ! 1467: .LI "c" ! 1468: C Mode (ON/\fBOFF\fP) ! 1469: .br ! 1470: This mode automatically indents for a C source ! 1471: file. Each line is indented with the number of tabs in the last ! 1472: non-comment line plus the net excess { characters over } characters ! 1473: in the last line. This mode is particularly useful for entering ! 1474: c program text. ! 1475: .P ! 1476: This mode also changes the behavior of the '}' character, so that ! 1477: when you type a '}' as the first non-blank character on a line, it ! 1478: will adjust the indentation automatically to one less than it was. ! 1479: Thus you can type the following kind of statement and get it to ! 1480: indent properly. ! 1481: .DS ! 1482: ! 1483: if(test) { ! 1484: statement; ! 1485: } ! 1486: ! 1487: .DE ! 1488: .LI "comcol" ! 1489: Comment Column (INTEGER=40) ! 1490: .br ! 1491: This is the column in which comments ! 1492: entered via M-/ begin. ! 1493: .LI rigid_newline ! 1494: rigidly insert newlines (ON/\fBOFF\fP) ! 1495: .br ! 1496: This mode causes any newline to insert a newline into the file. ! 1497: With this mode off (the default). a newline will not insert ! 1498: anything if the following line is empty, but will simply move to the ! 1499: next line. ! 1500: .LI "readonly" ! 1501: Read only buffer (ON/\fBOFF\fP) ! 1502: .br ! 1503: If this mode is turned on, saving the current buffer is disabled. ! 1504: ^X^S will complain with an error message, autosaving will not take ! 1505: place, and emacs will not complain if you try to exit without ! 1506: writing buffers. ! 1507: .LI "picture (4.5)" ! 1508: Tailor editing for two dimensional displays (ON/\fBOFF\fP) ! 1509: .br ! 1510: If set, emacs treats the buffer as an "electronic blackboard", ! 1511: rather than the exact contents of a unix file. The display shows a ! 1512: rectangular region of the blackboard through a window. Characters ! 1513: beyond the right margin are not displayed, but are indicated by ! 1514: a '!' in the right margin. The window is moved left or right to ! 1515: keep the cursor in the window. "leftmargin" mode gives you some ! 1516: explicit control over the window, but in general it is self ! 1517: adjusting. If the window is not at the left ! 1518: edge of the blackboard, then the character offset of the left edge ! 1519: of the display is given on the mode line, in front of the editor ! 1520: name. ! 1521: .P ! 1522: Picture mode changes the behavior of several basic commands to be ! 1523: more suitable for two dimensional editing. ! 1524: .VL 10 ! 1525: .LI "^N/^P" ! 1526: These move to the same column in the target line, extending the ! 1527: target line with spaces if necessary. ! 1528: .LI "^F/^B" ! 1529: These will not move off the current line. ^B will stick at the left ! 1530: margin, while ^F will continue to extend the line to move to the ! 1531: request column. ! 1532: .LI "^W/^Y" ! 1533: These treat the region to be deleted as a rectangle, bounded by the ! 1534: mark and the cursor position at the corners. All text in the ! 1535: rectangle defined by these positions is killed by ^W. ^Y brings ! 1536: text back in the same way. All text deleting commands behave like ! 1537: ^W, in that the start and end positions of the text region to be ! 1538: deleted are taken as corners of a rectangle. When the text region ! 1539: being deleted is all on one line, behavior is identical to normal ! 1540: emacs, however deletion across line boundaries via commands like ! 1541: M-d may not do anything sensible. ! 1542: .LE ! 1543: .P ! 1544: Picture mode is probably most useful with nodelete mode, notabs ! 1545: mode, and overwrite mode all set. You can use picture mode without ! 1546: the others set, but the presence of tabs or control characters in ! 1547: the buffer may give unexpected results when you navigate in the ! 1548: file. This mode is particularly useful for editing fixed format ! 1549: tables, picture images of "typewriter art" for use with the "gc" ! 1550: graphics output package, and other two dimensional information. ! 1551: .LI "overwrite" ! 1552: Overwrite mode (ON/\fBOFF\fP) ! 1553: .br ! 1554: In overwrite mode, text entered will ! 1555: overwrite text already there. Text entered when the cursor is at ! 1556: the end of a line will be inserted as before. Overwrite mode may be ! 1557: more natural for some people when making corrections. ! 1558: .LI "nodelete" ! 1559: No deletion (ON/\fBOFF\fP) ! 1560: .br ! 1561: With this mode set, text deleted in the file is not closed up but ! 1562: instead is overwritten with spaces. After any deletion, the cursor ! 1563: reverts to the first character of the region deleted. "nodelete" ! 1564: mode should probably be part of overwrite mode, however overwrite ! 1565: mode considerably pre-dated it and was left alone for upward ! 1566: compatibility. ! 1567: .LI "notabs" ! 1568: Eliminate tabs (ON/\fBOFF\fP) ! 1569: .br ! 1570: With this mode set, emacs does not display tab characters in the ! 1571: buffer as whitespace, but instead shows them as ^I (control-i), ! 1572: which is the ASCII code for a tab. When you enter a tab by typing ! 1573: ^I or tab, emacs converts it to the proper number of spaces to come ! 1574: up to the next tabstop column. Emacs does not convert tabs already ! 1575: in the file, though there are macros that do this. ! 1576: .P ! 1577: The main use of this mode is in creating and editing fixed format ! 1578: information in picture mode, though it can also be useful in ! 1579: showing you where tabs are in your buffer. ! 1580: .LE ! 1581: .H 2 "Terminal modes" ! 1582: .VL 15 ! 1583: .LI "nobell" ! 1584: No Bell (ON/\fBOFF\fP) ! 1585: .br ! 1586: Ordinarily, unexpected conditions, such as errors or quitting out ! 1587: of commands, cause the terminal bell to ring. On some adm3a ! 1588: terminals, This causes some kind of disaster to occur. Turning on ! 1589: nobell mode prevents EMACS from ringing the terminal bell. ! 1590: .LI "tspeed" ! 1591: Terminal Speed (INT=<terminal dependent>) ! 1592: .br ! 1593: This parameter is the speed of your terminal in milliseconds per ! 1594: character. This parameter is set whenever you enter emacs and is ! 1595: used in determining how to update the display most efficiently. ! 1596: .LI "controlify" ! 1597: Controlify mode (ON/\fBOFF\fP) ! 1598: .br ! 1599: When on, this mode causes a particular character (normally ^^, but ! 1600: settable to another character with the ctl_char described below), to ! 1601: act as a prefix specifying that the next character is to be ! 1602: interpreted as a control character. This mapping takes place at any ! 1603: time, not just when entering commands. Thus the sequence ^X^^s will ! 1604: be mapped into ^X^S, and cause the save command to be invoked. The ! 1605: sequence ^^q^^m typed in response to a request for a file name will ! 1606: be mapped into ^Q^M, which will be interpreted as asking for a file ! 1607: name of ^M. Controlify mode is primarily intended to allow you to ! 1608: enter characters which cannot be sent transparently from your ! 1609: terminal to emacs. The most frequent examples are ^S and ^Q, which ! 1610: cannot be sent by some terminals and some local area networks. ! 1611: By setting controlify mode, you can send these characters with ^^s ! 1612: and ^^q. ! 1613: .LI "ctl_char (4.6)" ! 1614: Controlify Character (INT=30) ! 1615: .br ! 1616: This parameter sets the value of the character used when in controlify ! 1617: mode to indicate that the next keystroke should be interpreted as a ! 1618: control character. It is the ascii value of the character to be ! 1619: used. ! 1620: .LI "flow_lim (4.6)" ! 1621: Flow Control Limit (INT=0) ! 1622: .br ! 1623: This parameter enables the use of xon/xoff flow control during ! 1624: output to control the rate of output to the terminal. Emacs ! 1625: normally turns xon/xoff flow control off to allow ^S and ^Q to be ! 1626: passed to emacs to be used in specifying commands. If flow_lim is ! 1627: non-zero, then whenever more than flow_lim characters are sent to ! 1628: the terminal at once, xon/xoff flow control will be temporarily ! 1629: enabled to allow the terminal to send ^S to request that unix stop ! 1630: output. xon/xoff flow control is disabled when output is complete. ! 1631: The only effect you will see is that you cannot type ^S or ^Q ahead ! 1632: while emacs is updating the screen. Normally, emacs supplies ! 1633: sufficient padding to allow it to run without xon/xoff flow control, ! 1634: however for some terminals at high speeds xon/xoff flow control is ! 1635: required. In this case only, set flow_lim to a number somewhat ! 1636: larger than the terminal's character buffer (typically 32, 64, or ! 1637: 128). In some cases it may be desirable to set up the terminal to ! 1638: always use ^S/^Q for flow control. This can be done by setting ! 1639: flow_lim to -1 (escape - ^X^M flowlim). If you do this, you will ! 1640: not be able to type ^S or ^Q from the keyboard and must use ! 1641: controlify mode to do so. ! 1642: .LE ! 1643: .H 2 "Specifying Default modes for a File" ! 1644: You can specify the modes to be used while editing a particular file ! 1645: by putting the string "EMACS_MODES: " somewhere in the first 10 ! 1646: lines of the file. The text on the same line following EMACS_MODES: ! 1647: will be taken as names of modes to set on or off. A mode name ! 1648: preceded by '!' will be set off, while mode names just listed will ! 1649: be set on. If '=' immediately follows a mode name, then the ! 1650: characters immediately following the '=' will be taken as the value ! 1651: for the mode name. Any text on the line that does not correspond to a mode ! 1652: name will be ignored. Thus the line: ! 1653: .SP ! 1654: /* EMACS_MODES: !fill c, comcol=43 */ ! 1655: .SP ! 1656: in a c source file will set c mode on, fill mode off, and set the ! 1657: column for starting comments to 43. These modes are ! 1658: set whenever the file is read, and ! 1659: whenever you switch buffers. ! 1660: .H 1 "Getting started" ! 1661: When EMACS is invoked, it does a number of things to set up for ! 1662: your editing session, These include finding out the type of your ! 1663: terminal, processing an initialization file that allows you to ! 1664: customize EMACS for your needs, and processing command line ! 1665: arguments. ! 1666: .H 2 "Setting your Terminal Type" ! 1667: Emacs must know what type of terminal ! 1668: terminal that you are using in order to know the appropriate ! 1669: control commands to display text on your screen. ! 1670: The terminal type is taken from the shell variable $TERM. To make it ! 1671: work, you must set the value of TERM in your .profile, and export it. ! 1672: .P ! 1673: On some systems, there is a utility program called "ttype" which ! 1674: figures out your terminal type for you. It works by sending an ! 1675: escape sequence to your terminal and testing for a response. ! 1676: Thus the lines: ! 1677: .SP ! 1678: export HOME PATH MAIL LOGNAME LOGTTY TERM ! 1679: .br ! 1680: TERM=`ttype` ! 1681: .SP ! 1682: will set the terminal type correctly if ttype is available, and if ! 1683: your terminal responds correctly. If TERM is not set or ! 1684: is set to an unrecognizable type, EMACS will prompt for terminal ! 1685: type, however the prompting message may be formated oddly, since ! 1686: at this point emacs will not know how to control your terminal. ! 1687: You can also set your terminal type by putting a M-t (Set terminal ! 1688: type) command in your initialization file, as described in the ! 1689: following section. ! 1690: .P ! 1691: Most terminals commonly used at Bell Labs are acceptable for use ! 1692: with emacs. Support for other terminals could easily be added if needed. ! 1693: If you need support for an unsupported terminal, either consult the ! 1694: document ~EMACS/term_support for a description of how to do it ! 1695: yourself, or contact ihnss!warren for details. ! 1696: .P ! 1697: There are some special problems with certain terminals or ! 1698: particular access arrangements connecting your terminal to emacs ! 1699: that you may run into: ! 1700: .VL 25 ! 1701: .LI "adm3a:" ! 1702: There are two "features" of the adm3a terminals that sometimes cause ! 1703: trouble in EMACS. One of the internal switches on that terminal is ! 1704: labeled space/advance. That switch must be in the space position for ! 1705: EMACS to work properly. A second problem is that many of these ! 1706: terminals are set up to use one of the "undefined" pins of the ! 1707: rs-232 interface for some internal diagnostic. This causes the ! 1708: terminal to go wild every time it receives a bell character when ! 1709: connected to a 1200 baud modem (which uses the same pin for ! 1710: something else). If this happens to you in EMACS, set nobell mode, ! 1711: which will prevent EMACS from sending bell characters to your ! 1712: terminal. A better and more permanent solution is to modify the ! 1713: terminal to disconnect ! 1714: this lead, use a cable that does not carry the undefined signals ! 1715: between the modem and the terminal. ! 1716: .LI "TTY5620 or Blit:" ! 1717: The Blit or Teletype 5620 terminals can be used in a number of ! 1718: different ways. The terminal types "blit" and "5620" will work well ! 1719: on a stand-alone blit or 5620. The only difficulty is that the ! 1720: terminal will not transmit ^S and ^Q, requiring you to use ! 1721: controlify mode to send these characters (as described below). ! 1722: Emacs will also run in a layer defined on the terminal. ! 1723: Emacs should discover the size of the window automatically, but ! 1724: will not discover it if you reshape the window while emacs is ! 1725: running. The terminal type "layer" will work with the layer terminal ! 1726: driver on the blit, but is very crude and buggy. The terminal type ! 1727: 5620 will work from a layer inside of the TTY 5620, with the above ! 1728: limitation. The hp and vitty emulators will work with emacs on both ! 1729: the blit and 5620. ! 1730: .P ! 1731: There are several improved terminal emulators that work better with ! 1732: emacs than the standard hp emulator or the straight 5620 layers ! 1733: terminal. There is an improved hp emulator that will transmit ^S ! 1734: and ^Q. The "netty" terminal emulator is widely available for both ! 1735: the blit and the 5620. It works well with emacs, and works with a ! 1736: macro package that can be loaded into emacs to allow you to ! 1737: position the cursor with the mouse and to do a certain amount of ! 1738: cut and paste style editing. The "emacsterm" emulator is available ! 1739: for the 5620 in experimental tools, and also works with an emacs ! 1740: macro package to provide mouse oriented editing. ! 1741: .LI "VT100 or hp2621B:" ! 1742: Both of these terminals work fine with emacs when run at low ! 1743: speeds, but at 9600 baud, these terminals do not keep up with the ! 1744: flow of characters. To use either of these terminals at 9600 baud, ! 1745: you should set "flow_lim" mode to 32 in emacs, and avoid typing while the ! 1746: display is being recreated. In addition, some of the VT100 ! 1747: compatible terminals will not send ^S or ^Q to emacs and must be ! 1748: used with controlify mode. ! 1749: .LI "Local Area Networks:" ! 1750: Some local area networks use ^S and ^Q for flow control, and thus ! 1751: you will not be able to send these characters directly to emacs. ! 1752: You can get around this by using controlify mode as described in ! 1753: the previous sections. You can make this less awkward on terminals ! 1754: with user programmable function keys by setting some of the ! 1755: function keys to send the character sequences necessary to get ^S ! 1756: and ^Q. ! 1757: .LE ! 1758: .H 2 "Initialization file. ! 1759: When you start emacs, it consults ! 1760: initialization file that allows you to initialize the various modes ! 1761: the way that you want them. This file is called ".emacs_init" and ! 1762: should be put in your home directory. The file is read as a ! 1763: keyboard macro, and thus should contain \fIexactly\fP what you ! 1764: would type from the terminal in order to set it up. Thus the file: ! 1765: .tr ~~ ! 1766: .SP ! 1767: .DS ! 1768: ^U^X^Mfill ! 1769: ^X^Mc ! 1770: ^X^L~EMACS/macros/loader ! 1771: .DE ! 1772: .SP ! 1773: sets 'c' mode, unsets fill mode, and loads the loader macro ! 1774: package. If you do not have a .emacs_init file, emacs will run the ! 1775: standard initialization file for your system, which you can examine ! 1776: by looking at the file ~EMACS/.emacs_init. It will not run both by ! 1777: default, but you can call for the default initialization file to be ! 1778: run from your private file by placing ^X^I~EMACS/.emacs_init in ! 1779: your initialization file at the point at which you want the system ! 1780: initialization to be done. ! 1781: You can also cause initializations to take place by command line ! 1782: arguments (see below). ! 1783: .tr ~ ! 1784: .H 3 "Command line arguments" ! 1785: Emacs accepts a number of arguments on the command line that effect ! 1786: processing. These are: ! 1787: .VL 10 ! 1788: .LI "-i" ! 1789: Emacs interprets the next argument as the name of an initialization file to ! 1790: run in addition to the standard initialization file (Yours or the system's). ! 1791: The specified file is run \fIafter\fP .emacs_init. ! 1792: .LI ".i" ! 1793: Emacs interprets the next argument as the name of an initialization file to ! 1794: run \fIinstead\fP of the standard file. ! 1795: .LI "+n" ! 1796: Emacs moves to line n of the specified file after it is read in. ! 1797: .LI "<filename> ! 1798: The last argument on the command line should be the name of the ! 1799: file to be edited. This file (if present) is read into the buffer ! 1800: Main. If no filename is specified, emacs puts you in the buffer Main ! 1801: with no associated file. ! 1802: .H 2 "Helpful hints" ! 1803: This editor is very easy to use, once you know a few of the basic ! 1804: commands. Here are some tips for making the best use of emacs. ! 1805: .AL ! 1806: .LI ! 1807: Learn a few of the basic commands at a time. You can accomplish a ! 1808: lot with just the basic commands. ! 1809: .LI ! 1810: EMACS tries to be reasonably efficient about the refreshing of the ! 1811: screen. Some sequences, however, will cause lots of text to be ! 1812: redisplayed. While you can insert anything into the middle of a buffer by ! 1813: typing it, it is much better to open up some lines by using ^O ! 1814: where you want to insert, insert, and then kill unneeded lines. ! 1815: .LI ! 1816: Use M-? when in doubt about a command. The explanations are brief, but ! 1817: should be sufficient to tell you what you want to know. ! 1818: .LI ! 1819: Like most editors, EMACS maintains a local buffer, so that changes made do ! 1820: not go into the file until the next write. Type ^X^S reasonably frequently ! 1821: so as to avoid being wiped out by machine crashes, editor bugs, or other ! 1822: unpredictable events. ! 1823: .LI ! 1824: Because EMACS tries to avoid unnecessary refreshing of the screen, ! 1825: it will get confused if characters are sent to your terminal from ! 1826: some other program while running EMACS, such as a "background" ! 1827: program, or by a write command from another user. If you suspect ! 1828: that the display does not correspond to the buffer that you are ! 1829: editing, type ^L to refresh the screen. After typing ^L, the screen ! 1830: will match the buffer being edited. ! 1831: .LE ! 1832: .H 2 "Limitations of the editor" ! 1833: There are some limits that you may encounter: ! 1834: .BL ! 1835: .LI ! 1836: Each line can hold at most 512 characters. ! 1837: .LI ! 1838: Each buffer can hold a maximum of approximately 15,000 lines. ! 1839: .LI ! 1840: You can have at most 12 buffers. ! 1841: .LI ! 1842: The kill stack contains ! 1843: the 8 most recent deletions, or a total of 256K characters. ! 1844: .LI ! 1845: Filenames are limited to 128 characters. ! 1846: .LE ! 1847: .H 2 "Recovering from various problems." ! 1848: Because EMACS puts your terminal in "raw" mode, it does not respond ! 1849: to interrupt and quit characters the way that most unix programs ! 1850: do. If somethings goes wrong with emacs, you can usually stop it ! 1851: with BREAK (typing ^Z to exit from emacs in response to the ! 1852: message). You may have to kill it from another terminal or log ! 1853: out. ! 1854: .P ! 1855: If emacs runs into internal trouble, or if you kill emacs or log ! 1856: out while running emacs, it will try to save your buffers before ! 1857: terminating. The buffers are saved in the files emacs0-emacs11 in ! 1858: your home directory. You will get mail describing what files are ! 1859: there from emacs after this happens, though if you do not clean up ! 1860: these files, they will continue to appear in the message each time ! 1861: you hang up on or kill an emacs process. ! 1862: .H 1 "DIRED" ! 1863: The program DIRED (DIRectory EDitor) is a version of emacs for ! 1864: editing directories. ! 1865: DIRED takes an argument which is the name of a directory, and ! 1866: displays the result of ls -al executed on that directory. Dired ! 1867: allows you to edit the resulting buffer using most of the normal ! 1868: commands. You may edit it by overwriting the protection mode, ! 1869: owner, or group fields, or by deleting entries, as discussed below. In ! 1870: order to facilitate your editing of the fixed format data in the ! 1871: directory listing, Dired puts you in "overwrite" mode by default, so ! 1872: that characters that you type overwrite what is there rather than ! 1873: inserting into it. ! 1874: .P ! 1875: The changes that you indicate this way are not made immediately, but ! 1876: are indicated by the letters 'D' (file deleted) 'M' (modes modified) ! 1877: or 'O' (owner or group changed) at the left end of the file entries ! 1878: modified. When you try to save the buffer or exit, Dired asks you ! 1879: if you want to make your changes permanent and then does them. ! 1880: .P ! 1881: Most of the usual emacs commands work in Dired just like in Emacs ! 1882: with a few exceptions: ! 1883: .VL 15 ! 1884: .LI "^D, ^?, and ^K" ! 1885: These commands do not delete any text, but simply mark the file ! 1886: designated on the current line for deletion. ! 1887: .LI "d or D" ! 1888: These characters mark the current file for deletion when typed at ! 1889: the beginning of a line, and otherwise just overwrite what is there. ! 1890: .LI "u or U" ! 1891: These characters remove the Deleted mark from files when typed at ! 1892: the beginning of a line, and otherwise just overwrite what is there. ! 1893: .LI "e" ! 1894: When typed at the beginning of a line, this causes dired to examine ! 1895: the directory entry corresponding to that line. If the entry is a ! 1896: file, dired creates a new buffer and reads it in, allowing you to ! 1897: examine it just like in emacs. When you enter ^Z, Dired returns you ! 1898: to the directory. If the entry is a directory, Dired creates a ! 1899: buffer and puts a directory listing of that directory in it, ! 1900: allowing you to edit this just directory. This feature provides a ! 1901: very convenient way to scan through a directory structure. ! 1902: .LE ! 1903: .P ! 1904: Ordinarily, the buffer listing for dired is created with a "ls -al" ! 1905: command. You can specify additional options for the display by ! 1906: giving dired an argument beginning with a "-" to specify options. ! 1907: Thus "dired~-t~/usr/bin" will invoke dired on /usr/bin with a ! 1908: listing sorted in time order. ! 1909: .P ! 1910: Dired provides a very convenient way to scan through and make ! 1911: changes to directories. It is particularly useful for cleaning up ! 1912: directories that may have files that you have not used for some time ! 1913: in them. ! 1914: .P ! 1915: Dired can be confused if you edit the filename of the entries, or ! 1916: succeed in inserting or deleting characters in the entries. It is ! 1917: not very robust to such failures, and you are advised not to modify ! 1918: the format of entries. If you have somehow garbled a buffer with a ! 1919: directory listing in it, you should probably kill the buffer so that ! 1920: Dired will not try to update that directory from the garbled listing ! 1921: when you try to exit. ! 1922: .H 1 EXPERIENCE ! 1923: The author originally wrote EMACS in 1979 as an aide to his own work of ! 1924: programming and memorandum composition. EMACS has been widely ! 1925: available inside of Bell Laboratories through the Experimental Tools ! 1926: facility, and through the author's own distribution efforts. EMACS ! 1927: now part of the AT&T Toolchest package and is available commercially ! 1928: to anyone paying the nominal fee for it. The following section ! 1929: describes observations of the author and others on 6 years of ! 1930: experience with Emacs. ! 1931: .H 2 "Feature Use" ! 1932: The most commonly used "feature" of EMACS is simply the ability to ! 1933: enter text and see the result. The simple cursor movement commands ! 1934: appear to be much more frequently used than the more complicated ! 1935: commands, such as those moving forward or backward by sentences. ! 1936: .P ! 1937: The following is a summary of the user reaction to some of the ! 1938: unique features of EMACS. ! 1939: .AL ! 1940: .LI "Multiple Buffers" ! 1941: .br ! 1942: The ability to maintain several editing buffers at the same time ! 1943: is widely used for many purposes. These include examining several ! 1944: source files while making modifications, holding source, compiler ! 1945: output, and program output while debugging, and holding the output ! 1946: of the spell utility while scanning a document for misspelled words. ! 1947: The availability of multiple buffers allows the user to manage ! 1948: several different tasks, such as writing a program, editing a ! 1949: memorandum, and helping a friend locate a system problem, concurrently. ! 1950: .LI "Two Window Mode" ! 1951: .br ! 1952: Two window mode is less heavily used than some of the other ! 1953: features, but appears to be quite useful for a variety of tasks. ! 1954: These include viewing a buffer containing declarations at the same ! 1955: time that a program is being entered in the second window, and ! 1956: viewing the output of the spell program at the same time that the ! 1957: document is being edited. The fact that only one of the two ! 1958: displays is actively maintained does not seem to be a problem, nor ! 1959: does the limitation of only two display windows. Few users have ! 1960: objected to these limitations, though this may only indicate that ! 1961: users are grateful enough for what Emacs does provide that they have ! 1962: not run into them. ! 1963: .LI "Incremental Search" ! 1964: .br ! 1965: With a high speed terminal, incremental search seems to be very ! 1966: effective. The ability to quickly move from one occurrence of a ! 1967: string to the next seems to meet most user's needs. With ! 1968: significantly less than 9600 baud communication, the amount of ! 1969: re-display created by incremental search becomes bothersome, and ! 1970: the regular expression search is preferred. The fact that ! 1971: incremental search does not "wrap around", seems to be a significant ! 1972: problem to many users. ! 1973: .LI "C mode and Fill mode" ! 1974: .br ! 1975: These two modes provide customized facilities for editing certain ! 1976: kinds of files. The user reaction to these is mixed. Some users ! 1977: make extensive use of these, while others have their own styles for ! 1978: entering memorandum or program source and do not use these modes. ! 1979: They are a very small part of EMACS, and as such are worthwhile even ! 1980: if they are not extensively used. ! 1981: .LI "Line Numbers" ! 1982: .br ! 1983: The display of the line number (lnumb mode) is one aspect of EMACS ! 1984: that was not taken from the M.I.T. version. This appears to be ! 1985: extremely useful for use with UNIX, primarily because of the ! 1986: widespread use of line numbers to indicate position within a file. ! 1987: Line numbers also serve to provide the user with some feedback as to ! 1988: what part of the buffer is currently being displayed. ! 1989: .LI "Macros" ! 1990: The macro facility was built up over time, and only recently has ! 1991: become a programming environment capable of being used by a wide ! 1992: variety of users. The initial macro language was powerful but ! 1993: extremely cryptic. Nevertheless, hundreds of macros were built, ranging from ! 1994: simple commands that merely combine several basic commands to ! 1995: self-contained editing systems making use of complex control flow ! 1996: features. Some of the more significant ones include a package for ! 1997: correcting spelling errors, Several packages that compile C code and ! 1998: step through the error messages, Several mail handling packages, and ! 1999: Several packages implementing interfaces to mouse-equipped ! 2000: terminals. ! 2001: .P ! 2002: In retrospect, our experience supports the conclusions of Richard ! 2003: Stallman (The author of the original Emacs), that the "right" way to ! 2004: build a powerful editor is to build a powerful programming ! 2005: environment and build the user interface of the editor on top of it. ! 2006: .LI "Picture Mode" ! 2007: Picture mode is another feature that was originally unique to this ! 2008: implementation. It was inspired by the Two-Dimensional editor ! 2009: 2ded, and by an electronic debate on whether screen editors should ! 2010: present the file as a sequence of characters or as a two dimensional ! 2011: blackboard. Both are useful abstractions, and it was not difficult ! 2012: to provide both views given the structure of Emacs. Picture mode ! 2013: has been widely used for editing tables and other fixed format ! 2014: information. It is also sometimes convenient for mouse based ! 2015: interfaces. ! 2016: .LE ! 2017: .H 2 "Human Interface Observations" ! 2018: There are several controversial aspects of the interface that emacs ! 2019: presents to users. ! 2020: .VL 15 ! 2021: .LI "Modeless Editing:" ! 2022: The characteristics which most clearly distinguishes emacs style ! 2023: editors from others is that lack of distinct modes for text ! 2024: insertion and entering of commands. This is also the most ! 2025: controversial feature. There have been many studies on moded and ! 2026: modeless editors in the 10 years since the first Emacs editors ! 2027: got significant use. Most conclude that in spite of strong ! 2028: preferences among users for one style or the other, neither is ! 2029: clearly superior. Also, in spite of feelings of users of both ! 2030: modeless and moded editors that doing something in the wrong mode ! 2031: would be a significant source of errors, the data do not show this as ! 2032: a large problem. ! 2033: .P ! 2034: Our feeling on this issue is that there are different editing styles ! 2035: for modeless or moded editing. With a moded editor, you think of ! 2036: editing as a series of commands, each of which changes the file in ! 2037: some way. With modeless editing, you tend to work more in the mode ! 2038: of marking up a document with a red pencil, by moving to each ! 2039: problem and re-typing whatever is wrong. Modeless editing seems ! 2040: natural in conjunction with a pointing device and menu interface, ! 2041: and has been used effectively on many personal computer and word ! 2042: processor editors this way. ! 2043: .LI "Control Characters" ! 2044: The use of control characters for editing commands in emacs is an ! 2045: unavoidable consequence of modeless editing. A conscious decision ! 2046: was made in emacs to avoid the use of special keys on the keyboard, ! 2047: such as function and arrow keys. The rational for this was to avoid ! 2048: requiring users to locate such keys, which appear in different ! 2049: places on every terminal. The result is that touch typists can use ! 2050: emacs without ever having to look at the keyboard, which is ! 2051: difficult if you must locate the special keys. ! 2052: .P ! 2053: The interface seems to work quite well for frequent users, however ! 2054: casual users have trouble remembering which characters do what. ! 2055: Many users with programmable function keys on their terminals have ! 2056: programmed and labeled them to send useful emacs commands. The ! 2057: conclusion that can be drawn is that it is nice to be able to touch ! 2058: type all of the commands, and for many users it is desirable to be ! 2059: able to use the special function keys on many terminals for editing. ! 2060: .LE ! 2061: .H 2 "Performance" ! 2062: While computer resources are not as expensive as they once were, ! 2063: they are far from free. An interactive screen editor such as EMACS ! 2064: consumes more in computer resources than a conventional editor. ! 2065: EMACS was designed to be as efficient as possible, some price must ! 2066: be paid for the benefits gained. ! 2067: .P ! 2068: The Processor time consumption of EMACS is comparable to the UNIX ! 2069: editor for most "commands", including reading and writing files, ! 2070: searching, and substitution. The major discrepancy in performance ! 2071: comes in entering text. In entering text, EMACS consumes ! 2072: about 3 times as much processor time as the UNIX editor. ! 2073: .P ! 2074: If we examine how each editor uses its time, we see that almost all ! 2075: of the time spent by the UNIX editor is spent in the UNIX operating ! 2076: system reading characters. About two thirds of the time spent in ! 2077: EMACS is spent reading and writing, while the remaining third is ! 2078: spent re-creating the display. EMACS uses almost twice as much UNIX ! 2079: operating system processor time, because it is re-writing the ! 2080: display after each character is typed, in addition to reading the ! 2081: characters. In addition, EMACS spends a significant amount of user ! 2082: process time figuring out how to most efficiently re-display the ! 2083: screen. ! 2084: .P ! 2085: While EMACS does consume more time editing than does the UNIX ! 2086: editor, the processor time spent editing does not appear to be a ! 2087: significant problem. Measurements of CPU consumption of emacs made ! 2088: on VAX 11/780, 3B20S, and PDP 11/70 systems each indicate that an ! 2089: emacs user consumes on average about .01 second of cpu time per ! 2090: character typed, and about 1% of the processor over the period of an ! 2091: editing session. These rates suggest that a substantial number of ! 2092: users can be accommodated on most systems. ! 2093: .H 1 CONCLUSIONS ! 2094: The EMACS editor provides an effective means of using a high-speed ! 2095: display terminal for text editing. EMACS provides a variety of ! 2096: unique features that seem to be very useful in editing. User ! 2097: reaction indicates that using EMACS has improved their productivity, ! 2098: however there are no quantitative measurements of this effect. ! 2099: .P ! 2100: EMACS uses more computing resources than the standard UNIX editor, ! 2101: however the resources utilized do not appear to be a serious ! 2102: problem. Emacs has been used effectively on many different machines ! 2103: without serious difficulties in performance. ! 2104: .P ! 2105: EMACS was written by the author as a tool for his own work, but is ! 2106: available to anyone desiring a copy. There are no currently known ! 2107: bugs, however there may be undiscovered problems. The author is ! 2108: interested in user reaction to EMACS and in reports of problems, ! 2109: however, the author's job ! 2110: does not include supporting EMACS, and thus the author does not ! 2111: promise any prompt response to suggestions or trouble reports. ! 2112: .SG UNIX ! 2113: .SK ! 2114: .tr ~~ ! 2115: .nr Hu 1 ! 2116: .nr Hc 1 ! 2117: .HU "APPENDIX -- EMACS Command Summary" ! 2118: .SP 2 ! 2119: .nf ! 2120: EMACS version 4.9 Date: Thu Mar 28 14:17:56 CST 1985 ! 2121: ! 2122: ^@: sets the mark at the cursor position ! 2123: ^A: moves to the beginning of the line ! 2124: ^B: moves back one character ! 2125: ^C: capitalizes the current character ! 2126: ^D: deletes forward one character ! 2127: ^E: moves to the end of the line ! 2128: ^F: moves forward one character ! 2129: ^G: quits from any command in progress ! 2130: ^H: deletes backward one character ! 2131: ^I: inserts a tab ! 2132: ^J: opens a new line and moves to the beginning of it if the ! 2133: next line is non-empty, otherwise down one line ! 2134: ^K: kills to end of line (with argument, kills multiple lines) ! 2135: ^L: refreshes the screen ! 2136: ^M: opens a new line and moves to the beginning of it if the ! 2137: next line is non-empty, otherwise down one line ! 2138: ^N: moves down one line ! 2139: ^O: opens up a new line ! 2140: ^P: moves up one line ! 2141: ^Q: quotes the next character ! 2142: ^R: starts a reverse search ! 2143: ^S: starts a search ! 2144: ^T: transposes the next two characters ! 2145: ^U: multiplies the argument by 4 ! 2146: ^V: moves to the next page ! 2147: ^W: kills the current region (between cursor and mark) ! 2148: ^X: is a prefix for more single character commands, ! 2149: type character or '*' for all ! 2150: ^Y: restores last killed text ! 2151: (leaves cursor and mark around it) ! 2152: ^Z: exits one level ! 2153: ^[: makes the next character a meta character ! 2154: ^]: makes a local variable of a macro invocation the argument to the ! 2155: next command ! 2156: ^^: causes the last returned result to become the argument ! 2157: : is self inserting and check for automatic word wrapping ! 2158: -: is self inserting unless part of a numeric argument ! 2159: .: is self inserting and check for automatic word wrapping ! 2160: 0: is self inserting unless part of a numeric argument ! 2161: 1: is self inserting unless part of a numeric argument ! 2162: 2: is self inserting unless part of a numeric argument ! 2163: 3: is self inserting unless part of a numeric argument ! 2164: 4: is self inserting unless part of a numeric argument ! 2165: 5: is self inserting unless part of a numeric argument ! 2166: 6: is self inserting unless part of a numeric argument ! 2167: 7: is self inserting unless part of a numeric argument ! 2168: 8: is self inserting unless part of a numeric argument ! 2169: 9: is self inserting unless part of a numeric argument ! 2170: }: is self inserting, and re-adjusts indentation in C mode ! 2171: ^?: deletes backward one character ! 2172: M-^H: deletes the last word ! 2173: M-^L: re-displays with current line at top of page ! 2174: M-^M: mails the current buffer ! 2175: M-^Q: returns the next input character (in a macro) ! 2176: M-^R: regular expression query replace ! 2177: M-^S: regular expression search ! 2178: M-^X: executes argument 0 as a character command. ! 2179: M-^Z: suspends emacs ! 2180: M-^]: assigns the result of the next command to a macro local variable ! 2181: M- : sets the mark at the cursor position ! 2182: M-!: gets and executes a shell command ! 2183: M-": auto Fills the whole buffer ! 2184: M-$: executes a command, saving the output in buffer .exec ! 2185: M--: is self inserting unless part of a numeric argument ! 2186: M-/: starts a comment ! 2187: M-0: is self inserting unless part of a numeric argument ! 2188: M-1: is self inserting unless part of a numeric argument ! 2189: M-2: is self inserting unless part of a numeric argument ! 2190: M-3: is self inserting unless part of a numeric argument ! 2191: M-4: is self inserting unless part of a numeric argument ! 2192: M-5: is self inserting unless part of a numeric argument ! 2193: M-6: is self inserting unless part of a numeric argument ! 2194: M-7: is self inserting unless part of a numeric argument ! 2195: M-8: is self inserting unless part of a numeric argument ! 2196: M-9: is self inserting unless part of a numeric argument ! 2197: M-:: maps a character to a command ! 2198: M-<: moves to top of file ! 2199: M->: moves to bottom of file ! 2200: M-?: explains the next character ! 2201: M-E: expands an environment variable and returns the result on the kill stack. ! 2202: M-\: converts its argument to a character and inserts it ! 2203: M-_: underlines the next word ! 2204: M-a: moves to beginning of sentence ! 2205: M-b: moves back one word ! 2206: M-c: capitalizes the next word ! 2207: M-d: deletes the next word ! 2208: M-e: moves to End of Sentence ! 2209: M-f: moves forward one word ! 2210: M-g: moves to a specific line (its argument) ! 2211: M-l: converts the next letter to lower case ! 2212: M-m: displays active modes ! 2213: M-p: puts the current region in the kill buffer without killing it ! 2214: M-q: quotes the next character and adds the 0200 bit ! 2215: M-r: starts query replace ! 2216: M-s: gives EMACS statistics ! 2217: M-t: prompts for terminal type ! 2218: M-u: undoes the last significant text modification ! 2219: M-v: moves back one page ! 2220: M-w: puts a wall chart of explanations in the buffer ! 2221: M-x: calls a macro by name ! 2222: M-y: replaces the last restore() with the next text in ! 2223: the kill stack. ! 2224: M-z: kills emacs with a core dump (for debugging) ! 2225: M-{: enters a command sequence (in a macro) ! 2226: M-}: exits one level ! 2227: M-~: marks a buffer as being unmodified (up to date) ! 2228: M-^?: deletes the last word ! 2229: ! 2230: Control-X commands: ! 2231: ! 2232: ^X^A: accesses the argument list to emacs ! 2233: ^X^B: changes Buffers (Change to * lists active buffers) ! 2234: ^X^C: exits gracefully ! 2235: (after asking whether or not to save the buffer) ! 2236: ^X^D: changes the working directory ! 2237: ^X^E: calls emacs recursively taking input from the terminal ! 2238: ^X^F: edits a file in its own buffer ! 2239: (if file has been read into a buffer, moves to it) ! 2240: ^X^G: sends an interrupt signal to a sub-process in the current buffer ! 2241: ^X^I: re-directs input from a file ! 2242: ^X^K: kills a buffer ! 2243: ^X^L: loads a file full of macro definitions ! 2244: ^X^M: sets mode from argument (prompts for mode name) ! 2245: and string if necessary ! 2246: ^X^N: changes the buffer or file name ! 2247: ^X^O: switches between windows ! 2248: ^X^Q: returns the character under the cursor (in a macro) ! 2249: ^X^R: reads a new file ! 2250: ^X^S: saves the buffer in the current file (if modified) ! 2251: ^X^T: prompts for a buffer name and inserts the text between the ! 2252: cursor and the mark into the named buffer. ! 2253: ^X^U: updates the display and delays for a specified time ! 2254: ^X^V: puts the current version on the kill stack. ! 2255: ^X^W: writes a new or old file ! 2256: ^X^X: exchanges the mark and the cursor ! 2257: ^X^^: causes the current window to grow one by line ! 2258: ^X!: begins a case statement (in a macro) ! 2259: ^X#: reads or writes global variables ! 2260: ^X%: exchanges the top of the kill stack with another item ! 2261: ^X&: compares two strings ! 2262: ^X(: starts a keyboard macro ! 2263: ^X): ends a keyboard macro ! 2264: ^X+: causes the next entry to the kill stack to append to the previous entry ! 2265: ^X-: pops the kill stack ! 2266: ^X1: exits two window mode ! 2267: ^X2: enters two window mode ! 2268: ^X<: pushes a string from the tty or macro text into the kill stack ! 2269: ^X=: gives statistics about the buffer ! 2270: ^X>: duplicates an item on the kill stack ! 2271: ^X@: prompts the user with a string from the kill stack and returns the result. ! 2272: ^XB: puts the buffer name into the kill stack ! 2273: ^XE: executes the keyboard macro ! 2274: ^XF: puts the file name into the stack ! 2275: ^XL: makes the next character a meta character ! 2276: ^XT: traces the next command. ! 2277: ^X^: enters a "while" loop (in a macro) ! 2278: ^Xd: defines macros from the current buffer ! 2279: ^Xg: moves to a screen position (arg=128*y+x); ! 2280: ^Xk: sets the encryption key for file reading and writing ! 2281: ^Xm: sets mode from argument (prompts for mode name) ! 2282: and string if necessary ! 2283: ^X|: begins a conditional execution sequence (in a macro) ! 2284: ^X~: performs arithmetic or logical operations (in a macro) ! 2285: .fi ! 2286: .SK ! 2287: .NS "" ! 2288: All Supervision Lab 5523 ! 2289: .NE ! 2290: .TC
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.