1This is Info file ../info/emacs, produced by Makeinfo-1.54 from the 2input file emacs.texi. 3 4 5File: emacs, Node: Copying, Next: Intro, Prev: Distrib, Up: Top 6 7GNU GENERAL PUBLIC LICENSE 8************************** 9 10 Version 2, June 1991 11 12 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 13 675 Mass Ave, Cambridge, MA 02139, USA 14 15 Everyone is permitted to copy and distribute verbatim copies 16 of this license document, but changing it is not allowed. 17 18Preamble 19======== 20 21 The licenses for most software are designed to take away your 22freedom to share and change it. By contrast, the GNU General Public 23License is intended to guarantee your freedom to share and change free 24software--to make sure the software is free for all its users. This 25General Public License applies to most of the Free Software 26Foundation's software and to any other program whose authors commit to 27using it. (Some other Free Software Foundation software is covered by 28the GNU Library General Public License instead.) You can apply it to 29your programs, too. 30 31 When we speak of free software, we are referring to freedom, not 32price. Our General Public Licenses are designed to make sure that you 33have the freedom to distribute copies of free software (and charge for 34this service if you wish), that you receive source code or can get it 35if you want it, that you can change the software or use pieces of it in 36new free programs; and that you know you can do these things. 37 38 To protect your rights, we need to make restrictions that forbid 39anyone to deny you these rights or to ask you to surrender the rights. 40These restrictions translate to certain responsibilities for you if you 41distribute copies of the software, or if you modify it. 42 43 For example, if you distribute copies of such a program, whether 44gratis or for a fee, you must give the recipients all the rights that 45you have. You must make sure that they, too, receive or can get the 46source code. And you must show them these terms so they know their 47rights. 48 49 We protect your rights with two steps: (1) copyright the software, 50and (2) offer you this license which gives you legal permission to copy, 51distribute and/or modify the software. 52 53 Also, for each author's protection and ours, we want to make certain 54that everyone understands that there is no warranty for this free 55software. If the software is modified by someone else and passed on, we 56want its recipients to know that what they have is not the original, so 57that any problems introduced by others will not reflect on the original 58authors' reputations. 59 60 Finally, any free program is threatened constantly by software 61patents. We wish to avoid the danger that redistributors of a free 62program will individually obtain patent licenses, in effect making the 63program proprietary. To prevent this, we have made it clear that any 64patent must be licensed for everyone's free use or not licensed at all. 65 66 The precise terms and conditions for copying, distribution and 67modification follow. 68 69 TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 70 71 0. This License applies to any program or other work which contains a 72 notice placed by the copyright holder saying it may be distributed 73 under the terms of this General Public License. The "Program", 74 below, refers to any such program or work, and a "work based on 75 the Program" means either the Program or any derivative work under 76 copyright law: that is to say, a work containing the Program or a 77 portion of it, either verbatim or with modifications and/or 78 translated into another language. (Hereinafter, translation is 79 included without limitation in the term "modification".) Each 80 licensee is addressed as "you". 81 82 Activities other than copying, distribution and modification are 83 not covered by this License; they are outside its scope. The act 84 of running the Program is not restricted, and the output from the 85 Program is covered only if its contents constitute a work based on 86 the Program (independent of having been made by running the 87 Program). Whether that is true depends on what the Program does. 88 89 1. You may copy and distribute verbatim copies of the Program's 90 source code as you receive it, in any medium, provided that you 91 conspicuously and appropriately publish on each copy an appropriate 92 copyright notice and disclaimer of warranty; keep intact all the 93 notices that refer to this License and to the absence of any 94 warranty; and give any other recipients of the Program a copy of 95 this License along with the Program. 96 97 You may charge a fee for the physical act of transferring a copy, 98 and you may at your option offer warranty protection in exchange 99 for a fee. 100 101 2. You may modify your copy or copies of the Program or any portion 102 of it, thus forming a work based on the Program, and copy and 103 distribute such modifications or work under the terms of Section 1 104 above, provided that you also meet all of these conditions: 105 106 a. You must cause the modified files to carry prominent notices 107 stating that you changed the files and the date of any change. 108 109 b. You must cause any work that you distribute or publish, that 110 in whole or in part contains or is derived from the Program 111 or any part thereof, to be licensed as a whole at no charge 112 to all third parties under the terms of this License. 113 114 c. If the modified program normally reads commands interactively 115 when run, you must cause it, when started running for such 116 interactive use in the most ordinary way, to print or display 117 an announcement including an appropriate copyright notice and 118 a notice that there is no warranty (or else, saying that you 119 provide a warranty) and that users may redistribute the 120 program under these conditions, and telling the user how to 121 view a copy of this License. (Exception: if the Program 122 itself is interactive but does not normally print such an 123 announcement, your work based on the Program is not required 124 to print an announcement.) 125 126 These requirements apply to the modified work as a whole. If 127 identifiable sections of that work are not derived from the 128 Program, and can be reasonably considered independent and separate 129 works in themselves, then this License, and its terms, do not 130 apply to those sections when you distribute them as separate 131 works. But when you distribute the same sections as part of a 132 whole which is a work based on the Program, the distribution of 133 the whole must be on the terms of this License, whose permissions 134 for other licensees extend to the entire whole, and thus to each 135 and every part regardless of who wrote it. 136 137 Thus, it is not the intent of this section to claim rights or 138 contest your rights to work written entirely by you; rather, the 139 intent is to exercise the right to control the distribution of 140 derivative or collective works based on the Program. 141 142 In addition, mere aggregation of another work not based on the 143 Program with the Program (or with a work based on the Program) on 144 a volume of a storage or distribution medium does not bring the 145 other work under the scope of this License. 146 147 3. You may copy and distribute the Program (or a work based on it, 148 under Section 2) in object code or executable form under the terms 149 of Sections 1 and 2 above provided that you also do one of the 150 following: 151 152 a. Accompany it with the complete corresponding machine-readable 153 source code, which must be distributed under the terms of 154 Sections 1 and 2 above on a medium customarily used for 155 software interchange; or, 156 157 b. Accompany it with a written offer, valid for at least three 158 years, to give any third party, for a charge no more than your 159 cost of physically performing source distribution, a complete 160 machine-readable copy of the corresponding source code, to be 161 distributed under the terms of Sections 1 and 2 above on a 162 medium customarily used for software interchange; or, 163 164 c. Accompany it with the information you received as to the offer 165 to distribute corresponding source code. (This alternative is 166 allowed only for noncommercial distribution and only if you 167 received the program in object code or executable form with 168 such an offer, in accord with Subsection b above.) 169 170 The source code for a work means the preferred form of the work for 171 making modifications to it. For an executable work, complete 172 source code means all the source code for all modules it contains, 173 plus any associated interface definition files, plus the scripts 174 used to control compilation and installation of the executable. 175 However, as a special exception, the source code distributed need 176 not include anything that is normally distributed (in either 177 source or binary form) with the major components (compiler, 178 kernel, and so on) of the operating system on which the executable 179 runs, unless that component itself accompanies the executable. 180 181 If distribution of executable or object code is made by offering 182 access to copy from a designated place, then offering equivalent 183 access to copy the source code from the same place counts as 184 distribution of the source code, even though third parties are not 185 compelled to copy the source along with the object code. 186 187 4. You may not copy, modify, sublicense, or distribute the Program 188 except as expressly provided under this License. Any attempt 189 otherwise to copy, modify, sublicense or distribute the Program is 190 void, and will automatically terminate your rights under this 191 License. However, parties who have received copies, or rights, 192 from you under this License will not have their licenses 193 terminated so long as such parties remain in full compliance. 194 195 5. You are not required to accept this License, since you have not 196 signed it. However, nothing else grants you permission to modify 197 or distribute the Program or its derivative works. These actions 198 are prohibited by law if you do not accept this License. 199 Therefore, by modifying or distributing the Program (or any work 200 based on the Program), you indicate your acceptance of this 201 License to do so, and all its terms and conditions for copying, 202 distributing or modifying the Program or works based on it. 203 204 6. Each time you redistribute the Program (or any work based on the 205 Program), the recipient automatically receives a license from the 206 original licensor to copy, distribute or modify the Program 207 subject to these terms and conditions. You may not impose any 208 further restrictions on the recipients' exercise of the rights 209 granted herein. You are not responsible for enforcing compliance 210 by third parties to this License. 211 212 7. If, as a consequence of a court judgment or allegation of patent 213 infringement or for any other reason (not limited to patent 214 issues), conditions are imposed on you (whether by court order, 215 agreement or otherwise) that contradict the conditions of this 216 License, they do not excuse you from the conditions of this 217 License. If you cannot distribute so as to satisfy simultaneously 218 your obligations under this License and any other pertinent 219 obligations, then as a consequence you may not distribute the 220 Program at all. For example, if a patent license would not permit 221 royalty-free redistribution of the Program by all those who 222 receive copies directly or indirectly through you, then the only 223 way you could satisfy both it and this License would be to refrain 224 entirely from distribution of the Program. 225 226 If any portion of this section is held invalid or unenforceable 227 under any particular circumstance, the balance of the section is 228 intended to apply and the section as a whole is intended to apply 229 in other circumstances. 230 231 It is not the purpose of this section to induce you to infringe any 232 patents or other property right claims or to contest validity of 233 any such claims; this section has the sole purpose of protecting 234 the integrity of the free software distribution system, which is 235 implemented by public license practices. Many people have made 236 generous contributions to the wide range of software distributed 237 through that system in reliance on consistent application of that 238 system; it is up to the author/donor to decide if he or she is 239 willing to distribute software through any other system and a 240 licensee cannot impose that choice. 241 242 This section is intended to make thoroughly clear what is believed 243 to be a consequence of the rest of this License. 244 245 8. If the distribution and/or use of the Program is restricted in 246 certain countries either by patents or by copyrighted interfaces, 247 the original copyright holder who places the Program under this 248 License may add an explicit geographical distribution limitation 249 excluding those countries, so that distribution is permitted only 250 in or among countries not thus excluded. In such case, this 251 License incorporates the limitation as if written in the body of 252 this License. 253 254 9. The Free Software Foundation may publish revised and/or new 255 versions of the General Public License from time to time. Such 256 new versions will be similar in spirit to the present version, but 257 may differ in detail to address new problems or concerns. 258 259 Each version is given a distinguishing version number. If the 260 Program specifies a version number of this License which applies 261 to it and "any later version", you have the option of following 262 the terms and conditions either of that version or of any later 263 version published by the Free Software Foundation. If the Program 264 does not specify a version number of this License, you may choose 265 any version ever published by the Free Software Foundation. 266 267 10. If you wish to incorporate parts of the Program into other free 268 programs whose distribution conditions are different, write to the 269 author to ask for permission. For software which is copyrighted 270 by the Free Software Foundation, write to the Free Software 271 Foundation; we sometimes make exceptions for this. Our decision 272 will be guided by the two goals of preserving the free status of 273 all derivatives of our free software and of promoting the sharing 274 and reuse of software generally. 275 276 NO WARRANTY 277 278 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO 279 WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE 280 LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 281 HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT 282 WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT 283 NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 284 FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE 285 QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 286 PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY 287 SERVICING, REPAIR OR CORRECTION. 288 289 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN 290 WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY 291 MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE 292 LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, 293 INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR 294 INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 295 DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU 296 OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY 297 OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN 298 ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 299 300 END OF TERMS AND CONDITIONS 301 302How to Apply These Terms to Your New Programs 303============================================= 304 305 If you develop a new program, and you want it to be of the greatest 306possible use to the public, the best way to achieve this is to make it 307free software which everyone can redistribute and change under these 308terms. 309 310 To do so, attach the following notices to the program. It is safest 311to attach them to the start of each source file to most effectively 312convey the exclusion of warranty; and each file should have at least 313the "copyright" line and a pointer to where the full notice is found. 314 315 ONE LINE TO GIVE THE PROGRAM'S NAME AND AN IDEA OF WHAT IT DOES. 316 Copyright (C) 19YY NAME OF AUTHOR 317 318 This program is free software; you can redistribute it and/or 319 modify it under the terms of the GNU General Public License 320 as published by the Free Software Foundation; either version 2 321 of the License, or (at your option) any later version. 322 323 This program is distributed in the hope that it will be useful, 324 but WITHOUT ANY WARRANTY; without even the implied warranty of 325 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 326 GNU General Public License for more details. 327 328 You should have received a copy of the GNU General Public License 329 along with this program; if not, write to the Free Software 330 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 331 332 Also add information on how to contact you by electronic and paper 333mail. 334 335 If the program is interactive, make it output a short notice like 336this when it starts in an interactive mode: 337 338 Gnomovision version 69, Copyright (C) 19YY NAME OF AUTHOR 339 Gnomovision comes with ABSOLUTELY NO WARRANTY; for details 340 type `show w'. This is free software, and you are welcome 341 to redistribute it under certain conditions; type `show c' 342 for details. 343 344 The hypothetical commands `show w' and `show c' should show the 345appropriate parts of the General Public License. Of course, the 346commands you use may be called something other than `show w' and `show 347c'; they could even be mouse-clicks or menu items--whatever suits your 348program. 349 350 You should also get your employer (if you work as a programmer) or 351your school, if any, to sign a "copyright disclaimer" for the program, 352if necessary. Here is a sample; alter the names: 353 354 Yoyodyne, Inc., hereby disclaims all copyright 355 interest in the program `Gnomovision' 356 (which makes passes at compilers) written 357 by James Hacker. 358 359 SIGNATURE OF TY COON, 1 April 1989 360 Ty Coon, President of Vice 361 362 This General Public License does not permit incorporating your 363program into proprietary programs. If your program is a subroutine 364library, you may consider it more useful to permit linking proprietary 365applications with the library. If this is what you want to do, use the 366GNU Library General Public License instead of this License. 367 368 369File: emacs, Node: Intro, Next: Glossary, Prev: Copying, Up: Top 370 371Introduction 372************ 373 374 You are reading about GNU Emacs, the GNU incarnation of the advanced, 375self-documenting, customizable, extensible real-time display editor 376Emacs. (The `G' in `GNU' is not silent.) 377 378 We say that Emacs is a "display" editor because normally the text 379being edited is visible on the screen and is updated automatically as 380you type your commands. *Note Display: Screen. 381 382 We call it a "real-time" editor because the display is updated very 383frequently, usually after each character or pair of characters you 384type. This minimizes the amount of information you must keep in your 385head as you edit. *Note Real-time: Basic. 386 387 We call Emacs advanced because it provides facilities that go beyond 388simple insertion and deletion: filling of text; automatic indentation of 389programs; viewing two or more files at once; and dealing in terms of 390characters, words, lines, sentences, paragraphs, and pages, as well as 391expressions and comments in several different programming languages. 392 393 "Self-documenting" means that at any time you can type a special 394character, `Control-h', to find out what your options are. You can 395also use it to find out what any command does, or to find all the 396commands that pertain to a topic. *Note Help::. 397 398 "Customizable" means that you can change the definitions of Emacs 399commands in little ways. For example, if you use a programming 400language in which comments start with `<**' and end with `**>', you can 401tell the Emacs comment manipulation commands to use those strings 402(*note Comments::.). Another sort of customization is rearrangement of 403the command set. For example, if you prefer the four basic cursor 404motion commands (up, down, left and right) on keys in a diamond pattern 405on the keyboard, you can have it. *Note Customization::. 406 407 "Extensible" means that you can go beyond simple customization and 408write entirely new commands, programs in the Lisp language to be run by 409Emacs's own Lisp interpreter. Emacs is an "on-line extensible" system, 410which means that it is divided into many functions that call each other, 411any of which can be redefined in the middle of an editing session. Any 412part of Emacs can be replaced without making a separate copy of all of 413Emacs. Most of the editing commands of Emacs are written in Lisp 414already; the few exceptions could have been written in Lisp but are 415written in C for efficiency. Although only a programmer can write an 416extension, anybody can use it afterward. 417 418 When run under the X Window System, Emacs provides its own menus and 419convenient bindings to mouse buttons. But Emacs can provide many of the 420benefits of a window system on a text-only terminal. For instance, you 421can look at or edit several files at once, move text between them, and 422edit files at the same time as you run shell commands. 423 424 425File: emacs, Node: Screen, Next: User Input, Prev: Concept Index, Up: Top 426 427The Organization of the Screen 428****************************** 429 430 On a text-only terminal, the Emacs display occupies the whole screen. 431On the X Window System, Emacs creates its own X windows to use. We use 432the term "frame" to mean an entire text-only screen or an entire X 433window used by Emacs. Emacs uses both kinds of frames in the same way 434to display your editing. Emacs normally starts out with just one frame, 435but under X you can create additional frames if you wish. *Note 436Frames::. 437 438 When you start Emacs, the entire frame except for the last line is 439devoted to the text you are editing. This area is called "window". 440The last line is a special "echo area" or "minibuffer window" where 441prompts appear and where you can enter responses. You can subdivide 442the large text window horizontally or vertically into multiple text 443windows, each of which can be used for a different file (*note 444Windows::.). In this manual, the word "window" always refers to the 445subdivisions of a frame within Emacs. 446 447 The window that the cursor is in is the "selected window", in which 448editing takes place. Most Emacs commands implicitly apply to the text 449in the selected window. The other windows display text for reference 450only, unless/until you select them. 451 452 Each window's last line is a "mode line" which describes what is 453going on in that window. It is in inverse video if the terminal 454supports that, and contains text that starts like `-----Emacs: 455SOMETHING'. Its purpose is to indicate what buffer is being displayed 456above it in the window; what major and minor modes are in use; and 457whether the buffer contains unsaved changes. 458 459* Menu: 460 461* Point:: The place in the text where editing commands operate. 462* Echo Area:: Short messages appear at the bottom of the screen. 463* Mode Line:: Interpreting the mode line. 464 465 466File: emacs, Node: Point, Next: Echo Area, Up: Screen 467 468Point 469===== 470 471 Within Emacs, the terminal's cursor shows the location at which 472editing commands will take effect. This location is called "point". 473Other commands move point through the text, so that you can edit at 474different places in it. 475 476 While the cursor appears to point AT a character, you should think 477of point as BETWEEN two characters; it points BEFORE the character that 478appears under the cursor. For example, if your text looks like `frob' 479with the cursor over the `b', then point is between the `o' and the 480`b'. If you insert the character `!' at that position, the result is 481`fro!b', with point between the `!' and the `b'. Thus, the cursor 482remains over the `b', as before. 483 484 Sometimes people speak of "the cursor" when they mean "point", or 485speak of commands that move point as "cursor motion" commands. 486 487 Terminals have only one cursor, and when output is in progress it 488must appear where the typing is being done. This does not mean that 489point is moving. It is only that Emacs has no way to show you the 490location of point except when the terminal is idle. 491 492 If you are editing several files in Emacs, each in its own buffer, 493each buffer has its own point location. A buffer that is not currently 494displayed remembers where point is in case you display it again later. 495 496 When there are multiple windows, each window has its own point 497location. The cursor shows the location of point in the selected 498window. This also is how you can tell which window is selected. If the 499same buffer appears in more than one window, each window has its own 500position for point in that buffer. 501 502 The term `point' comes from the character `.', which was the command 503in TECO (the language in which the original Emacs was written) for 504accessing the value now called `point'. 505 506 507File: emacs, Node: Echo Area, Next: Mode Line, Prev: Point, Up: Screen 508 509The Echo Area 510============= 511 512 The line at the bottom of the screen (below the mode line) is the 513"echo area". It is used to display small amounts of text for several 514purposes. 515 516 "Echoing" means printing out the characters that you type. Outside 517Emacs, the operating system normally echoes all your input. Emacs 518handles echoing differently. 519 520 Single-character commands do not echo in Emacs, and multi-character 521commands echo only if you pause while typing them. As soon as you pause 522for more than a second in the middle of a command, Emacs echoes all the 523characters of the command so far. This is to "prompt" you for the rest 524of the command. Once echoing has started, the rest of the command 525echoes immediately as you type it. This behavior is designed to give 526confident users fast response, while giving hesitant users maximum 527feedback. You can change this behavior by setting a variable (*note 528Display Vars::.). 529 530 If a command cannot be executed, it may print an "error message" in 531the echo area. Error messages are accompanied by a beep or by flashing 532the screen. Also, any input you have typed ahead is thrown away when 533an error happens. 534 535 Some commands print informative messages in the echo area. These 536messages look much like error messages, but they are not announced with 537a beep and do not throw away input. Sometimes the message tells you 538what the command has done, when this is not obvious from looking at the 539text being edited. Sometimes the sole purpose of a command is to print 540a message giving you specific information--for example, `C-x =' prints 541a message describing the character position of point in the text and 542its current column in the window. Commands that take a long time often 543display messages ending in `...' while they are working, and add `done' 544at the end when they are finished. 545 546 The echo area is also used to display the "minibuffer", a window that 547is used for reading arguments to commands, such as the name of a file 548to be edited. When the minibuffer is in use, the echo area begins with 549a prompt string that usually ends with a colon; also, the cursor 550appears in that line because it is the selected window. You can always 551get out of the minibuffer by typing `C-g'. *Note Minibuffer::. 552 553 554File: emacs, Node: Mode Line, Prev: Echo Area, Up: Screen 555 556The Mode Line 557============= 558 559 Each text window's last line is a "mode line" which describes what is 560going on in that window. When there is only one text window, the mode 561line appears right above the echo area. The mode line is in inverse 562video if the terminal supports that, starts and ends with dashes, and 563contains text like `Emacs: SOMETHING'. 564 565 If a mode line has something else in place of `Emacs: SOMETHING', 566then the window above it is in a special subsystem such as Dired. The 567mode line then indicates the status of the subsystem. 568 569 Normally, the mode line looks like this: 570 571 --CH-Emacs: BUF (MAJOR MINOR)----POS------ 572 573This gives information about the buffer being displayed in the window: 574the buffer's name, what major and minor modes are in use, whether the 575buffer's text has been changed, and how far down the buffer you are 576currently looking. 577 578 CH contains two stars `**' if the text in the buffer has been edited 579(the buffer is "modified"), or `--' if the buffer has not been edited. 580Exception: for a read-only buffer, it is `%%'. 581 582 BUF is the name of the window's "buffer". In most cases this is the 583same as the name of a file you are editing. *Note Buffers::. 584 585 The buffer displayed in the selected window (the window that the 586cursor is in) is also Emacs's selected buffer, the one that editing 587takes place in. When we speak of what some command does to "the 588buffer", we are talking about the currently selected buffer. 589 590 POS tells you whether there is additional text above the top of the 591window, or below the bottom. If your buffer is small and it is all 592visible in the window, POS is `All'. Otherwise, it is `Top' if you are 593looking at the beginning of the buffer, `Bot' if you are looking at the 594end of the buffer, or `NN%', where NN is the percentage of the buffer 595above the top of the window. 596 597 MAJOR is the name of the "major mode" in effect in the buffer. At 598any time, each buffer is in one and only one of the possible major 599modes. The major modes available include Fundamental mode (the least 600specialized), Text mode, Lisp mode, and C mode. *Note Major Modes::, 601for details of how the modes differ and how to select one. 602 603 MINOR is a list of some of the "minor modes" that are turned on at 604the moment in the window's chosen buffer. `Fill' means that Auto Fill 605mode is on. `Abbrev' means that Word Abbrev mode is on. `Ovwrt' means 606that Overwrite mode is on. *Note Minor Modes::, for more information. 607`Narrow' means that the buffer being displayed has editing restricted 608to only a portion of its text. This is not really a minor mode, but is 609like one. *Note Narrowing::. `Def' means that a keyboard macro is 610being defined. *Note Keyboard Macros::. 611 612 Some buffers display additional information after the minor modes. 613For example, Rmail buffers display the current message number and the 614total number of messages. Compilation buffers and Shell mode display 615the status of the subprocess. 616 617 In addition, if Emacs is currently inside a recursive editing level, 618square brackets (`[...]') appear around the parentheses that surround 619the modes. If Emacs is in one recursive editing level within another, 620double square brackets appear, and so on. Since recursive editing 621levels affect Emacs globally and not any one buffer, the square 622brackets appear in every window's mode line or not in any of them. 623*Note Recursive Edit::. 624 625 *Note Optional Display::, for features that add other handy 626information to the mode line, such as the current line number of point, 627the current time, and whether mail has arrived for you. 628 629 630File: emacs, Node: User Input, Next: Keys, Prev: Screen, Up: Top 631 632Keyboard Input 633============== 634 635 GNU Emacs uses an extension of the ASCII character set for keyboard 636input. ASCII consists of 128 character codes. Some of these codes are 637assigned graphic symbols such as `a' and `='; the rest are control 638characters, such as `Control-a' (usually written `C-a' for short). 639`C-a' gets its name from the fact that you type it by holding down the 640CTRL key and then pressing `a'. 641 642 Some control characters have special names, and special keys you can 643type them with: for example, RET, TAB, LFD, DEL and ESC. The space 644character is usually referred to below as SPC, even though strictly 645speaking it is a graphic character whose graphic happens to be blank. 646 647 On ASCII terminals, the shift key is meaningless with control 648characters: `C-a' and `C-A' are the same character, and Emacs cannot 649distinguish them. Under X Windows, these are distinct characters, but 650the standard key bindings treat them the same in all contexts. 651 652 On ASCII terminals, there are only 32 possible control characters. 653These are the control variants of letters and `@[]\^_'. Under X 654Windows, every non-control character has a control variant. For 655example, `C-+' and `C-5' are meaningful under X. 656 657 Emacs extends the ASCII character code by adding an extra bit to each 658character. The additional bit is called Meta. Any character can be 659made Meta; examples of Meta characters include `Meta-a' (normally 660written `M-a', for short), `M-A' (not the same character as `M-a', but 661those two characters normally have the same meaning in Emacs), `M-RET', 662and `M-C-a'. For traditional reasons, `M-C-a' is usually called 663`C-M-a'; logically speaking, the order in which the modifier keys CTRL 664and META are mentioned does not matter. 665 666 Some terminals have a META key, and allow you to type Meta 667characters by holding this key down. Thus, `Meta-a' is typed by 668holding down META and pressing `a'. The META key works much like the 669SHIFT key. Such a key is not always labeled META, however, as this 670function is often a special option for a key with some other primary 671purpose. 672 673 If there is no META key, you can still type Meta characters using 674two-character sequences starting with ESC. Thus, to enter `M-a', you 675could type `ESC a'. To enter `C-M-a', you would type `ESC C-a'. ESC 676is allowed on terminals with Meta keys, too, in case you have formed a 677habit of using it. 678 679 X Windows provides several other modifier keys that can be applied to 680any keyboard input character. These are called SUPER, HYPER and ALT. 681With them, you can make characters that we denote with `s-', `H-' and 682`A-'. Thus, `s-H-C-x' is short for `Super-Hyper-Control-x'. Not all X 683terminals actually provide keys for these modifier flags, and the 684standard key bindings of Emacs do not include such characters. But you 685can assign them meanings of your own by customizing Emacs. 686 687 Keyboard input includes keyboard keys that are not characters at all: 688for example function keys and arrow keys. Mouse buttons are also 689outside the gamut of characters. These inputs do not have numeric 690character codes. Instead, Emacs represents them by their names 691(actually, Lisp objects called "symbols"). 692 693 Input characters and non-character inputs are collectively called 694"input events". 695 696 ASCII terminals cannot really send anything to the computer except 697ASCII characters. These terminals use a sequence of characters to 698represent each function key. But that is invisible to the Emacs user, 699because the keyboard input routines recognize these special sequences 700and converts them to names before any other part of Emacs gets to see 701them. 702 703 704File: emacs, Node: Keys, Next: Commands, Prev: User Input, Up: Top 705 706Keys 707==== 708 709 A "key sequence" ("key", for short) is a sequence of input events 710that combine as part of the invocation of a single command. Recall 711that input events include both keyboard characters and non-character 712inputs (function keys, arrow keys, mouse buttons, and so forth). 713 714 If the sequence is enough to invoke a command, it is a "complete 715key". If it isn't long enough to be complete, we call it a "prefix 716key". Examples of complete keys include `C-a', `X', RET, NEXT (a 717function key), DOWN (an arrow key), `C-x C-f' and `C-x 4 C-f'. 718 719 Most single characters constitute complete keys in the standard Emacs 720command bindings. A few of them are prefix keys. A prefix key can be 721followed by additional input characters (or other events) to make a 722longer key, which may itself be complete or a prefix. 723 724 For example, `C-x' is a prefix key, so `C-x' and the next input 725character combine to make a two-character key sequence. Most of these 726key sequences are complete keys, including `C-x C-f' and `C-x b'. A 727few, such as `C-x 4' and `C-x r', are themselves prefix keys that lead 728to three-character key sequences. There's no limit to the length of a 729key sequence, but any key sequence longer than one character must be 730reached through a chain of prefix keys. 731 732 By contrast, the two-character sequence `C-f C-k' is not a key, 733because the `C-f' is a complete key in itself. It's impossible to give 734`C-f C-k' an independent meaning as a command. `C-f C-k' is two key 735sequences, not one. 736 737 All told, the prefix keys in Emacs are `C-c', `C-x', `C-h', `C-x 738C-a', `C-x n', `C-x r', `C-x v', `C-x 4', `C-x 5', and ESC. But this 739is not cast in concrete; it is just a matter of Emacs's standard key 740bindings. In customizing Emacs, you could make new prefix keys, or 741eliminate these. *Note Key Bindings::. 742 743 Whether a sequence is a key can be changed by customization. For 744example, if you redefine `C-f' as a prefix, `C-f C-k' automatically 745becomes a key (complete, unless you define it too as a prefix). 746Conversely, if you remove the prefix definition of `C-x 4', then `C-x 4 747f' (or `C-x 4 ANYTHING') is no longer a key. 748 749 Typing the help character (`C-h') after a prefix character usually 750displays a list of the commands starting with that prefix. There are a 751few prefix characters for which this doesn't work--for historical 752reasons, they have other meanings for `C-h' which are not easy to 753change. 754 755 756File: emacs, Node: Commands, Next: Text Characters, Prev: Keys, Up: Top 757 758Keys and Commands 759================= 760 761 This manual is full of passages that tell you what particular keys 762do. But Emacs does not assign meanings to keys directly. Instead, 763Emacs assigns meanings to named "commands", and then gives keys their 764meanings by "binding" them to commands. 765 766 Every command has a name chosen by a programmer. The name is usually 767made of a few English words separated by dashes; for example, 768`next-line' or `forward-word'. A command also has a "function 769definition" which is a Lisp program; this is what makes the command do 770what it does. In Emacs Lisp, a command is actually a special kind of 771Lisp function; one which specifies how to read arguments for it and 772call it interactively. For more information on commands and functions, 773see *Note What Is a Function: (elisp)What Is a Function. (The 774definition we use in this manual is simplified slightly.) 775 776 The bindings between keys and commands are recorded in various tables 777called "keymaps". *Note Keymaps::. 778 779 When we say that "`C-n' moves down vertically one line" we are 780glossing over a distinction that is irrelevant in ordinary use but is 781vital in understanding how to customize Emacs. It is the command 782`next-line' that is programmed to move down vertically. `C-n' has this 783effect *because* it is bound to that command. If you rebind `C-n' to 784the command `forward-word' then `C-n' will move forward by words 785instead. Rebinding keys is a common method of customization. 786 787 In the rest of this manual, we usually ignore this subtlety to keep 788things simple. To give the customizer the information he needs, we 789state the name of the command which really does the work in parentheses 790after mentioning the key that runs it. For example, we will say that 791"The command `C-n' (`next-line') moves point vertically down," meaning 792that `next-line' is a command that moves vertically down and `C-n' is a 793key that is standardly bound to it. 794 795 While we are on the subject of information for customization only, 796it's a good time to tell you about "variables". Often the description 797of a command will say, "To change this, set the variable `mumble-foo'." 798A variable is a name used to remember a value. Most of the variables 799documented in this manual exist just to facilitate customization: some 800command or other part of Emacs examines the variable and behaves 801differently accordingly. Until you are interested in customizing, you 802can ignore the information about variables. When you are ready to be 803interested, read the basic information on variables, and then the 804information on individual variables will make sense. *Note Variables::. 805 806 807File: emacs, Node: Text Characters, Next: Entering Emacs, Prev: Commands, Up: Top 808 809Character Set for Text 810====================== 811 812 Emacs buffers use an 8-bit character set, because bytes have 8 bits. 813ASCII graphic characters in Emacs buffers are displayed with their 814graphics. The newline character (which has the same character code as 815LFD) is displayed by starting a new line. The tab character is 816displayed by moving to the next tab stop column (usually every 8 817columns). Other control characters are displayed as a caret (`^') 818followed by the non-control version of the character; thus, `C-a' is 819displayed as `^A'. 820 821 Non-ASCII characters 128 and up are displayed with octal escape 822sequences; thus, character code 243 (octal) is displayed as `\243'. 823You can customize the display of these character codes (or ANSI 824characters) by creating a "display table"; this is useful for editing 825files that use 8-bit European character sets. *Note Display Tables: 826(elisp)Display Tables. 827 828 829File: emacs, Node: Entering Emacs, Next: Exiting, Prev: Text Characters, Up: Top 830 831Entering and Exiting Emacs 832************************** 833 834 The usual way to invoke Emacs is with the shell command `emacs'. 835Emacs clears the screen and then displays an initial help message and 836copyright notice. On a window system, Emacs opens a window of its own. 837You can begin typing Emacs commands immediately afterward. 838 839 Some operating systems insist on discarding all type-ahead when Emacs 840starts up; they give Emacs no way to prevent this. Therefore, it is 841wise to wait until Emacs clears the screen before typing your first 842editing command. 843 844 If you run Emacs from a shell window under the X Window System, run 845it in the background with `emacs&'. This way, Emacs does not tie up 846the shell window, so you can use it to run other shell commands while 847Emacs operates its own X windows. 848 849 When Emacs starts up, it makes a buffer named `*scratch*'. That's 850the buffer you start out in. The `*scratch*' uses Lisp Interaction 851mode; you can use it to type Lisp expressions and evaluate them, or you 852can ignore that capability and simply doodle. (You can specify a 853different major mode for this buffer by setting the variable 854`initial-major-mode' in your init file. *Note Init File::.) 855 856 It is also possible to specify files to be visited, Lisp files to be 857loaded, and functions to be called, by giving Emacs arguments in the 858shell command line. *Note Command Arguments::. But we don't recommend 859doing this. The feature exists mainly for compatibility with other 860editors. 861 862 Many other editors are designed to be started afresh each time you 863want to edit. You edit one file and then exit the editor. The next 864time you want to edit either another file or the same one, you must run 865the editor again. With these editors, it makes sense to use a command 866line argument to say which file to edit. 867 868 But starting a new Emacs each time you want to edit a different file 869does not make sense. For one thing, this would be annoyingly slow. For 870another, this would fail to take advantage of Emacs's ability to visit 871more than one file in a single editing session. 872 873 The recommended way to use GNU Emacs is to start it only once, just 874after you log in, and do all your editing in the same Emacs session. 875Each time you want to edit a different file, you visit it with the 876existing Emacs, which eventually comes to have many files in it ready 877for editing. Usually you do not kill the Emacs until you are about to 878log out. 879 880 881File: emacs, Node: Exiting, Next: Basic, Prev: Entering Emacs, Up: Top 882 883Exiting Emacs 884============= 885 886 There are two commands for exiting Emacs because there are two kinds 887of exiting: "suspending" Emacs and "killing" Emacs. 888 889 "Suspending" means stopping Emacs temporarily and returning control 890to its parent process (usually a shell), allowing you to resume editing 891later in the same Emacs job, with the same files, same kill ring, same 892undo history, and so on. This is the usual way to exit. 893 894 "Killing" Emacs means destroying the Emacs job. You can run Emacs 895again later, but you will get a fresh Emacs; there is no way to resume 896the same editing session after it has been killed. 897 898`C-z' 899 Suspend Emacs (`suspend-emacs'). 900 901`C-x C-c' 902 Kill Emacs (`save-buffers-kill-emacs'). 903 904 To suspend Emacs, type `C-z' (`suspend-emacs'). This takes you back 905to the shell from which you invoked Emacs. You can resume Emacs with 906the shell command `%emacs' in most common shells. 907 908 On systems that do not permit programs to be suspended, `C-z' runs 909an inferior shell that communicates directly with the terminal, and 910Emacs waits until you exit the subshell. (The way to do that is 911probably with `C-d' or `exit', but it depends on which shell you use.) 912The only way on these systems to get back to the shell from which Emacs 913was run (to log out, for example) is to kill Emacs. 914 915 Suspending also fails if you run Emacs under a shell that doesn't 916support suspending programs, even if the system itself does support it. 917In such a case, you can set the variable `cannot-suspend' to a 918non-`nil' value to force `C-z' to run an inferior shell. (One might 919also describe Emacs's parent shell as "inferior" for failing to support 920job control properly, but that is a matter of taste.) 921 922 When Emacs communicates directly with an X server and creates its own 923dedicated X windows, `C-z' has a different meaning. Suspending an 924applications that uses its own X windows is not meaningful or useful. 925Instead, `C-z' runs the command `iconify-frame', which temporarily 926closes up the selected Emacs frame. The way to get back to a shell 927window is with the window manager. 928 929 To kill Emacs, type `C-x C-c' (`save-buffers-kill-emacs'). A 930two-character key is used for this to make it harder to type. Unless a 931numeric argument is used, this command first offers to save any modified 932file-visiting buffers. If you do not save them all, it asks for 933reconfirmation with `yes' before killing Emacs, since any changes not 934saved will be lost forever. Also, if any subprocesses are still 935running, `C-x C-c' asks for confirmation about them, since killing 936Emacs will kill the subprocesses immediately. 937 938 The operating system usually listens for certain special characters 939whose meaning is to kill or suspend the program you are running. This 940operating system feature is turned off while you are in Emacs. The 941meanings of `C-z' and `C-x C-c' as keys in Emacs were inspired by the 942use of `C-z' and `C-c' on several operating systems as the characters 943for stopping or killing a program, but that is their only relationship 944with the operating system. You can customize these keys to run any 945commands (*note Keymaps::.). 946 947 948File: emacs, Node: Basic, Next: Undo, Prev: Exiting, Up: Top 949 950Basic Editing Commands 951********************** 952 953 We now give the basics of how to enter text, make corrections, and 954save the text in a file. If this material is new to you, you might 955learn it more easily by running the Emacs learn-by-doing tutorial. To 956start the tutorial, type `Control-h t' (`help-with-tutorial'). 957 958 To clear the screen and redisplay, type `C-l' (`recenter'). 959 960* Menu: 961 962* Inserting Text:: Inserting text by simply typing it. 963* Moving Point:: How to move the cursor to the place where you want to 964 change something. 965* Erasing:: Deleting and killing text. 966* Files: Basic Files. Visiting, creating, and saving files. 967* Help: Basic Help. Asking what a character does. 968* Blank Lines:: Commands to make or delete blank lines. 969* Continuation Lines:: Lines too wide for the screen. 970* Position Info:: What page, line, row, or column is point on? 971* Arguments:: Numeric arguments for repeating a command. 972 973