*** empty log message ***
[emacs.git] / lispref / elisp.texi
blobf954cdc220ef106e603ec00df455758c816a3018
1 \input texinfo  @c -*-texinfo-*-
2 @c %**start of header
3 @setfilename elisp
4 @settitle GNU Emacs Lisp Reference Manual
5 @c %**end of header
7 @c Version of the manual and of Emacs.
8 @c Please remember to update the edition number in README as well.
9 @set VERSION  2.7
10 @set EMACSVER 22.0.50
12 @dircategory Emacs
13 @direntry
14 * Elisp: (elisp).       The Emacs Lisp Reference Manual.
15 @end direntry
17 @smallbook
18 @setchapternewpage odd
19 @finalout
21 @c Combine indices.
22 @synindex cp fn
23 @syncodeindex vr fn
24 @syncodeindex ky fn
25 @syncodeindex pg fn
26 @c We use the "type index" to index new functions and variables.
27 @c @syncodeindex tp fn
29 @copying
30 This is edition @value{VERSION} of the GNU Emacs Lisp
31 Reference Manual, corresponding to Emacs version @value{EMACSVER}.
33 Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
34               2000, 2002, 2003, 2004, 2005, Free Software Foundation, Inc.
36 @quotation
37 Permission is granted to copy, distribute and/or modify this document
38 under the terms of the GNU Free Documentation License, Version 1.1 or
39 any later version published by the Free Software Foundation; with the
40 Invariant Sections being ``GNU General Public License'', with the
41 Front-Cover texts being ``A GNU Manual'', and with the Back-Cover
42 Texts as in (a) below.  A copy of the license is included in the
43 section entitled ``GNU Free Documentation License''.
45 (a) The FSF's Back-Cover Text is: ``You have freedom to copy and modify
46 this GNU Manual, like GNU software.  Copies published by the Free
47 Software Foundation raise funds for GNU development.''
48 @end quotation
49 @end copying
51 @titlepage
52 @title GNU Emacs Lisp Reference Manual
53 @subtitle For Emacs Version @value{EMACSVER}
54 @subtitle Revision @value{VERSION}, January 2002
56 @author by Bil Lewis, Dan LaLiberte, Richard Stallman
57 @author and the GNU Manual Group
58 @page
59 @vskip 0pt plus 1filll
60 @insertcopying
62 @sp 1
63 Published by the Free Software Foundation @*
64 51 Franklin St, Fifth Floor @*
65 Boston, MA 02110-1301 @*
66 USA @*
67 ISBN 1-882114-73-6
69 @sp 1
70 Cover art by Etienne Suvasa.
71 @end titlepage
74 @c Print the tables of contents
75 @summarycontents
76 @contents
79 @ifnottex
80 @node Top, Introduction, (dir), (dir)
81 @top Emacs Lisp 
83 This Info file contains edition @value{VERSION} of the GNU Emacs Lisp
84 Reference Manual, corresponding to GNU Emacs version @value{EMACSVER}.
85 @end ifnottex
87 @menu
88 * Introduction::            Introduction and conventions used.
90 * Lisp Data Types::         Data types of objects in Emacs Lisp.
91 * Numbers::                 Numbers and arithmetic functions.
92 * Strings and Characters::  Strings, and functions that work on them.
93 * Lists::                   Lists, cons cells, and related functions.
94 * Sequences Arrays Vectors::  Lists, strings and vectors are called sequences.
95                                 Certain functions act on any kind of sequence.
96                                 The description of vectors is here as well.
97 * Hash Tables::             Very fast lookup-tables.
98 * Symbols::                 Symbols represent names, uniquely.
100 * Evaluation::              How Lisp expressions are evaluated.
101 * Control Structures::      Conditionals, loops, nonlocal exits.
102 * Variables::               Using symbols in programs to stand for values.
103 * Functions::               A function is a Lisp program
104                               that can be invoked from other functions.
105 * Macros::                  Macros are a way to extend the Lisp language.
106 * Customization::           Writing customization declarations.
108 * Loading::                 Reading files of Lisp code into Lisp.
109 * Byte Compilation::        Compilation makes programs run faster.
110 * Advising Functions::      Adding to the definition of a function.
111 * Debugging::               Tools and tips for debugging Lisp programs.
113 * Read and Print::          Converting Lisp objects to text and back.
114 * Minibuffers::             Using the minibuffer to read input.
115 * Command Loop::            How the editor command loop works,
116                               and how you can call its subroutines.
117 * Keymaps::                 Defining the bindings from keys to commands.
118 * Modes::                   Defining major and minor modes.
119 * Documentation::           Writing and using documentation strings.
121 * Files::                   Accessing files.
122 * Backups and Auto-Saving:: Controlling how backups and auto-save
123                               files are made.
124 * Buffers::                 Creating and using buffer objects.
125 * Windows::                 Manipulating windows and displaying buffers.
126 * Frames::                  Making multiple X windows.
127 * Positions::               Buffer positions and motion functions.
128 * Markers::                 Markers represent positions and update
129                               automatically when the text is changed.
131 * Text::                    Examining and changing text in buffers.
132 * Non-ASCII Characters::    Non-ASCII text in buffers and strings.
133 * Searching and Matching::  Searching buffers for strings or regexps.
134 * Syntax Tables::           The syntax table controls word and list parsing.
135 * Abbrevs::                 How Abbrev mode works, and its data structures.
137 * Processes::               Running and communicating with subprocesses.
138 * Display::                 Features for controlling the screen display.
139 * System Interface::        Getting the user id, system type, environment
140                               variables, and other such things.
142 Appendices
144 * Antinews::                Info for users downgrading to Emacs 21.
145 * GNU Free Documentation License:: The license for this documentation
146 * GPL::                     Conditions for copying and changing GNU Emacs.
147 * Tips::                    Advice and coding conventions for Emacs Lisp.
148 * GNU Emacs Internals::     Building and dumping Emacs;
149                               internal data structures.
150 * Standard Errors::         List of all error symbols.
151 * Standard Buffer-Local Variables::
152                             List of variables buffer-local in all buffers.
153 * Standard Keymaps::        List of standard keymaps.
154 * Standard Hooks::          List of standard hook variables.
156 * Index::                   Index including concepts, functions, variables,
157                               and other terms.
159 * New Symbols::             New functions and variables in Emacs @value{EMACSVER}.
161 Detailed Node Listing
162 ---------------------
164 Here are other nodes that are inferiors of those already listed,
165 mentioned here so you can get to them in one step:
167 Introduction
169 * Caveats::                 Flaws and a request for help.
170 * Lisp History::            Emacs Lisp is descended from Maclisp.
171 * Conventions::             How the manual is formatted.
172 * Version Info::            Which Emacs version is running?
173 * Acknowledgements::        The authors, editors, and sponsors of this manual.
175 Conventions
177 * Some Terms::              Explanation of terms we use in this manual.
178 * nil and t::               How the symbols @code{nil} and @code{t} are used.
179 * Evaluation Notation::     The format we use for examples of evaluation.
180 * Printing Notation::       The format we use for examples that print output.
181 * Error Messages::          The format we use for examples of errors.
182 * Buffer Text Notation::    The format we use for buffer contents in examples.
183 * Format of Descriptions::  Notation for describing functions, variables, etc.
185 Format of Descriptions
187 * A Sample Function Description::
188 * A Sample Variable Description::
190 Lisp Data Types
192 * Printed Representation::  How Lisp objects are represented as text.
193 * Comments::                Comments and their formatting conventions.
194 * Programming Types::       Types found in all Lisp systems.
195 * Editing Types::           Types specific to Emacs.
196 * Circular Objects::            Read syntax for circular structure.
197 * Type Predicates::         Tests related to types.
198 * Equality Predicates::     Tests of equality between any two objects.
200 Programming Types
202 * Integer Type::        Numbers without fractional parts.
203 * Floating Point Type:: Numbers with fractional parts and with a large range.
204 * Character Type::      The representation of letters, numbers and
205                           control characters.
206 * Symbol Type::         A multi-use object that refers to a function,
207                         variable, property list, or itself.
208 * Sequence Type::       Both lists and arrays are classified as sequences.
209 * Cons Cell Type::      Cons cells, and lists (which are made from cons cells).
210 * Array Type::          Arrays include strings and vectors.
211 * String Type::         An (efficient) array of characters.
212 * Vector Type::         One-dimensional arrays.
213 * Char-Table Type::     One-dimensional sparse arrays indexed by characters.
214 * Bool-Vector Type::    One-dimensional arrays of @code{t} or @code{nil}.
215 * Hash Table Type::     Super-fast lookup tables.
216 * Function Type::       A piece of executable code you can call from elsewhere.
217 * Macro Type::          A method of expanding an expression into another
218                           expression, more fundamental but less pretty.
219 * Primitive Function Type::     A function written in C, callable from Lisp.
220 * Byte-Code Type::      A function written in Lisp, then compiled.
221 * Autoload Type::       A type used for automatically loading seldom-used
222                           functions.
224 Cons Cell and List Types
226 * Box Diagrams::            Drawing pictures of lists.
227 * Dotted Pair Notation::    An alternative syntax for lists.
228 * Association List Type::   A specially constructed list.
230 Editing Types
232 * Buffer Type::             The basic object of editing.
233 * Marker Type::             A position in a buffer.
234 * Window Type::             What makes buffers visible.
235 * Frame Type::              Windows subdivide frames.
236 * Window Configuration Type::Save what the screen looks like.
237 * Frame Configuration Type::Recording the status of all frames.
238 * Process Type::            A process running on the underlying OS.
239 * Stream Type::             Receive or send characters.
240 * Keymap Type::             What function a keystroke invokes.
241 * Overlay Type::            How an overlay is represented.
243 Numbers
245 * Integer Basics::            Representation and range of integers.
246 * Float Basics::              Representation and range of floating point.
247 * Predicates on Numbers::     Testing for numbers.
248 * Comparison of Numbers::     Equality and inequality predicates.
249 * Numeric Conversions::       Converting float to integer and vice versa.
250 * Arithmetic Operations::     How to add, subtract, multiply and divide.
251 * Rounding Operations::       Explicitly rounding floating point numbers.
252 * Bitwise Operations::        Logical and, or, not, shifting.
253 * Math Functions::            Trig, exponential and logarithmic functions.
254 * Random Numbers::            Obtaining random integers, predictable or not.
256 Strings and Characters
258 * String Basics::           Basic properties of strings and characters.
259 * Predicates for Strings::  Testing whether an object is a string or char.
260 * Creating Strings::        Functions to allocate new strings.
261 * Modifying Strings::         Altering the contents of an existing string.
262 * Text Comparison::         Comparing characters or strings.
263 * String Conversion::       Converting characters or strings and vice versa.
264 * Formatting Strings::      @code{format}: Emacs's analogue of @code{printf}.
265 * Case Conversion::         Case conversion functions.
266 * Case Tables::               Customizing case conversion.
268 Lists
270 * Cons Cells::              How lists are made out of cons cells.
271 * List-related Predicates:: Is this object a list?  Comparing two lists.
272 * List Elements::           Extracting the pieces of a list.
273 * Building Lists::          Creating list structure.
274 * Modifying Lists::         Storing new pieces into an existing list.
275 * Sets And Lists::          A list can represent a finite mathematical set.
276 * Association Lists::       A list can represent a finite relation or mapping.
277 * Rings::                   Managing a fixed-size ring of objects.
279 Modifying Existing List Structure
281 * Setcar::                  Replacing an element in a list.
282 * Setcdr::                  Replacing part of the list backbone.
283                               This can be used to remove or add elements.
284 * Rearrangement::           Reordering the elements in a list; combining lists.
286 Sequences, Arrays, and Vectors
288 * Sequence Functions::      Functions that accept any kind of sequence.
289 * Arrays::                  Characteristics of arrays in Emacs Lisp.
290 * Array Functions::         Functions specifically for arrays.
291 * Vectors::                 Functions specifically for vectors.
292 * Vector Functions::        Functions specifically for vectors.
293 * Char-Tables::             How to work with char-tables.
294 * Bool-Vectors::            How to work with bool-vectors.
296 Hash Tables
298 * Creating Hash::           Functions to create hash tables.
299 * Hash Access::             Reading and writing the hash table contents.
300 * Defining Hash::           Defining new comparison methods
301 * Other Hash::              Miscellaneous.
303 Symbols
305 * Symbol Components::       Symbols have names, values, function definitions
306                               and property lists.
307 * Definitions::             A definition says how a symbol will be used.
308 * Creating Symbols::        How symbols are kept unique.
309 * Property Lists::          Each symbol has a property list
310                               for recording miscellaneous information.
312 Evaluation
314 * Intro Eval::              Evaluation in the scheme of things.
315 * Forms::                   How various sorts of objects are evaluated.
316 * Quoting::                 Avoiding evaluation (to put constants in
317                               the program).
318 * Eval::                    How to invoke the Lisp interpreter explicitly.
320 Kinds of Forms
322 * Self-Evaluating Forms::   Forms that evaluate to themselves.
323 * Symbol Forms::            Symbols evaluate as variables.
324 * Classifying Lists::       How to distinguish various sorts of list forms.
325 * Function Indirection::    When a symbol appears as the car of a list,
326                               we find the real function via the symbol.
327 * Function Forms::          Forms that call functions.
328 * Macro Forms::             Forms that call macros.
329 * Special Forms::           ``Special forms'' are idiosyncratic primitives,
330                               most of them extremely important.
331 * Autoloading::             Functions set up to load files
332                               containing their real definitions.
334 Control Structures
336 * Sequencing::              Evaluation in textual order.
337 * Conditionals::            @code{if}, @code{cond}, @code{when}, @code{unless}.
338 * Combining Conditions::    @code{and}, @code{or}, @code{not}.
339 * Iteration::               @code{while} loops.
340 * Nonlocal Exits::          Jumping out of a sequence.
342 Nonlocal Exits
344 * Catch and Throw::         Nonlocal exits for the program's own purposes.
345 * Examples of Catch::       Showing how such nonlocal exits can be written.
346 * Errors::                  How errors are signaled and handled.
347 * Cleanups::                Arranging to run a cleanup form if an
348                               error happens.
350 Errors
352 * Signaling Errors::        How to report an error.
353 * Processing of Errors::    What Emacs does when you report an error.
354 * Handling Errors::         How you can trap errors and continue execution.
355 * Error Symbols::           How errors are classified for trapping them.
357 Variables
359 * Global Variables::        Variable values that exist permanently, everywhere.
360 * Constant Variables::      Certain "variables" have values that never change.
361 * Local Variables::         Variable values that exist only temporarily.
362 * Void Variables::          Symbols that lack values.
363 * Defining Variables::      A definition says a symbol is used as a variable.
364 * Tips for Defining::       Things you should think about when you
365                               define a variable.
366 * Accessing Variables::     Examining values of variables whose names
367                               are known only at run time.
368 * Setting Variables::       Storing new values in variables.
369 * Variable Scoping::        How Lisp chooses among local and global values.
370 * Buffer-Local Variables::  Variable values in effect only in one buffer.
371 * Frame-Local Variables::   Variable values in effect only in one frame.
372 * Future Local Variables::  New kinds of local values we might add some day.
373 * File Local Variables::    Handling local variable lists in files.
374 * Variable Aliases::        Variables that are aliases for other variables.
375 * Variables with Restricted Values::  Non-constant variables whose value can
376                                         @emph{not} be an arbitrary Lisp object.
378 Scoping Rules for Variable Bindings
380 * Scope::                   Scope means where in the program a value
381                               is visible.  Comparison with other languages.
382 * Extent::                  Extent means how long in time a value exists.
383 * Impl of Scope::           Two ways to implement dynamic scoping.
384 * Using Scoping::           How to use dynamic scoping carefully and
385                               avoid problems.
387 Buffer-Local Variables
389 * Intro to Buffer-Local::   Introduction and concepts.
390 * Creating Buffer-Local::   Creating and destroying buffer-local bindings.
391 * Default Value::           The default value is seen in buffers
392                               that don't have their own buffer-local values.
394 Functions
396 * What Is a Function::      Lisp functions vs primitives; terminology.
397 * Lambda Expressions::      How functions are expressed as Lisp objects.
398 * Function Names::          A symbol can serve as the name of a function.
399 * Defining Functions::      Lisp expressions for defining functions.
400 * Calling Functions::       How to use an existing function.
401 * Mapping Functions::       Applying a function to each element of a list, etc.
402 * Anonymous Functions::     Lambda-expressions are functions with no names.
403 * Function Cells::          Accessing or setting the function definition
404                               of a symbol.
405 * Obsolete Functions::      Declaring functions obsolete.
406 * Inline Functions::        Defining functions that the compiler will open code.
407 * Function Safety::         Determining whether a function is safe to call.
408 * Related Topics::          Cross-references to specific Lisp primitives
409                               that have a special bearing on how
410                               functions work.
412 Lambda Expressions
414 * Lambda Components::       The parts of a lambda expression.
415 * Simple Lambda::           A simple example.
416 * Argument List::           Details and special features of argument lists.
417 * Function Documentation::  How to put documentation in a function.
419 Macros
421 * Simple Macro::            A basic example.
422 * Expansion::               How, when and why macros are expanded.
423 * Compiling Macros::        How macros are expanded by the compiler.
424 * Defining Macros::         How to write a macro definition.
425 * Backquote::               Easier construction of list structure.
426 * Problems with Macros::    Don't evaluate the macro arguments too many times.
427                               Don't hide the user's variables.
428 * Indenting Macros::        Specifying how to indent macro calls.
430 Writing Customization Definitions
432 * Common Keywords::         Common keyword arguments for all kinds of
433                               customization declarations.
434 * Group Definitions::       Writing customization group definitions.
435 * Variable Definitions::    Declaring user options.
436 * Customization Types::     Specifying the type of a user option.
438 Loading
440 * How Programs Do Loading:: The @code{load} function and others.
441 * Library Search::          Finding a library to load.
442 * Loading Non-ASCII::       Non-@acronym{ASCII} characters in Emacs Lisp files.
443 * Autoload::                Setting up a function to autoload.
444 * Repeated Loading::        Precautions about loading a file twice.
445 * Named Features::          Loading a library if it isn't already loaded.
446 * Where Defined::           Finding which file defined a certain symbol.
447 * Unloading::               How to ``unload'' a library that was loaded.
448 * Hooks for Loading::       Providing code to be run when
449                               particular libraries are loaded.
451 Byte Compilation
453 * Speed of Byte-Code::      An example of speedup from byte compilation.
454 * Compilation Functions::   Byte compilation functions.
455 * Docs and Compilation::    Dynamic loading of documentation strings.
456 * Dynamic Loading::         Dynamic loading of individual functions.
457 * Eval During Compile::     Code to be evaluated when you compile.
458 * Compiler Errors::         Handling compiler error messages.
459 * Byte-Code Objects::       The data type used for byte-compiled functions.
460 * Disassembly::             Disassembling byte-code; how to read byte-code.
462 Advising Emacs Lisp Functions
464 * Simple Advice::           A simple example to explain the basics of advice.
465 * Defining Advice::         Detailed description of @code{defadvice}.
466 * Around-Advice::           Wrapping advice around a function's definition.
467 * Computed Advice::         ...is to @code{defadvice} as @code{fset} is to @code{defun}.
468 * Activation of Advice::    Advice doesn't do anything until you activate it.
469 * Enabling Advice::         You can enable or disable each piece of advice.
470 * Preactivation::           Preactivation is a way of speeding up the
471                               loading of compiled advice.
472 * Argument Access in Advice:: How advice can access the function's arguments.
473 * Advising Primitives::     Accessing arguments when advising a primitive.
474 * Combined Definition::     How advice is implemented.
476 Debugging Lisp Programs
478 * Debugger::                How the Emacs Lisp debugger is implemented.
479 * Edebug::                  A source-level Emacs Lisp debugger.
480 * Syntax Errors::           How to find syntax errors.
481 * Test Coverage::           Ensuring you have tested all branches in your code.
482 * Compilation Errors::      How to find errors that show up in
483                               byte compilation.
485 The Lisp Debugger
487 * Error Debugging::         Entering the debugger when an error happens.
488 * Infinite Loops::          Stopping and debugging a program that doesn't exit.
489 * Function Debugging::      Entering it when a certain function is called.
490 * Explicit Debug::          Entering it at a certain point in the program.
491 * Using Debugger::          What the debugger does; what you see while in it.
492 * Debugger Commands::       Commands used while in the debugger.
493 * Invoking the Debugger::   How to call the function @code{debug}.
494 * Internals of Debugger::   Subroutines of the debugger, and global variables.
496 Edebug
498 * Using Edebug::            Introduction to use of Edebug.
499 * Instrumenting::           You must instrument your code
500                               in order to debug it with Edebug.
501 * Edebug Execution Modes::  Execution modes, stopping more or less often.
502 * Jumping::                 Commands to jump to a specified place.
503 * Edebug Misc::             Miscellaneous commands.
504 * Breaks::                  Setting breakpoints to make the program stop.
505 * Trapping Errors::         Trapping errors with Edebug.
506 * Edebug Views::            Views inside and outside of Edebug.
507 * Edebug Eval::             Evaluating expressions within Edebug.
508 * Eval List::               Expressions whose values are displayed
509                               each time you enter Edebug.
510 * Printing in Edebug::      Customization of printing.
511 * Trace Buffer::            How to produce trace output in a buffer.
512 * Coverage Testing::        How to test evaluation coverage.
513 * The Outside Context::     Data that Edebug saves and restores.
514 * Edebug and Macros::       Specifying how to handle macro calls.
515 * Edebug Options::          Option variables for customizing Edebug.
517 Debugging Invalid Lisp Syntax
519 * Excess Open::             How to find a spurious open paren or missing close.
520 * Excess Close::            How to find a spurious close paren or missing open.
522 Reading and Printing Lisp Objects
524 * Streams Intro::           Overview of streams, reading and printing.
525 * Input Streams::           Various data types that can be used as
526                               input streams.
527 * Input Functions::         Functions to read Lisp objects from text.
528 * Output Streams::          Various data types that can be used as
529                               output streams.
530 * Output Functions::        Functions to print Lisp objects as text.
531 * Output Variables::        Variables that control what the printing
532                               functions do.
534 Minibuffers
536 * Intro to Minibuffers::    Basic information about minibuffers.
537 * Text from Minibuffer::    How to read a straight text string.
538 * Object from Minibuffer::  How to read a Lisp object or expression.
539 * Minibuffer History::      Recording previous minibuffer inputs
540                               so the user can reuse them.
541 * Initial Input::           Specifying initial contents for the minibuffer.
542 * Completion::              How to invoke and customize completion.
543 * Yes-or-No Queries::       Asking a question with a simple answer.
544 * Multiple Queries::        Asking a series of similar questions.
545 * Reading a Password::      Reading a password from the terminal.
546 * Minibuffer Misc::         Various customization hooks and variables.
548 Completion
550 * Basic Completion::        Low-level functions for completing strings.
551                               (These are too low level to use the minibuffer.)
552 * Minibuffer Completion::   Invoking the minibuffer with completion.
553 * Completion Commands::     Minibuffer commands that do completion.
554 * High-Level Completion::   Convenient special cases of completion
555                               (reading buffer name, file name, etc.)
556 * Reading File Names::      Using completion to read file names.
557 * Programmed Completion::   Finding the completions for a given file name.
559 Command Loop
561 * Command Overview::    How the command loop reads commands.
562 * Defining Commands::   Specifying how a function should read arguments.
563 * Interactive Call::    Calling a command, so that it will read arguments.
564 * Command Loop Info::   Variables set by the command loop for you to examine.
565 * Adjusting Point::     Adjustment of point after a command.
566 * Input Events::        What input looks like when you read it.
567 * Reading Input::       How to read input events from the keyboard or mouse.
568 * Special Events::      Events processed immediately and individually.
569 * Waiting::             Waiting for user input or elapsed time.
570 * Quitting::            How @kbd{C-g} works.  How to catch or defer quitting.
571 * Prefix Command Arguments::    How the commands to set prefix args work.
572 * Recursive Editing::   Entering a recursive edit,
573                           and why you usually shouldn't.
574 * Disabling Commands::  How the command loop handles disabled commands.
575 * Command History::     How the command history is set up, and how accessed.
576 * Keyboard Macros::     How keyboard macros are implemented.
578 Defining Commands
580 * Using Interactive::       General rules for @code{interactive}.
581 * Interactive Codes::       The standard letter-codes for reading arguments
582                               in various ways.
583 * Interactive Examples::    Examples of how to read interactive arguments.
585 Keymaps
587 * Keymap Terminology::          Definitions of terms pertaining to keymaps.
588 * Format of Keymaps::           What a keymap looks like as a Lisp object.
589 * Creating Keymaps::            Functions to create and copy keymaps.
590 * Inheritance and Keymaps::     How one keymap can inherit the bindings
591                                   of another keymap.
592 * Prefix Keys::                 Defining a key with a keymap as its definition.
593 * Active Keymaps::              Each buffer has a local keymap
594                                   to override the standard (global) bindings.
595                                   Each minor mode can also override them.
596 * Key Lookup::                  How extracting elements from keymaps works.
597 * Functions for Key Lookup::    How to request key lookup.
598 * Changing Key Bindings::       Redefining a key in a keymap.
599 * Remapping Commands::          Bindings that translate one command to another.
600 * Key Binding Commands::        Interactive interfaces for redefining keys.
601 * Scanning Keymaps::            Looking through all keymaps, for printing help.
602 * Menu Keymaps::                A keymap can define a menu for X
603                                   or for use from the terminal.
605 Major and Minor Modes
607 * Hooks::                   How to use hooks; how to write code that
608                               provides hooks.
609 * Major Modes::             Defining major modes.
610 * Minor Modes::             Defining minor modes.
611 * Mode Line Format::        Customizing the text that appears in the mode line.
612 * Imenu::                   How a mode can provide a menu
613                               of definitions in the buffer.
614 * Font Lock Mode::          How modes can highlight text according to syntax.
615 * Desktop Save Mode::       How modes can have buffer state saved between
616                               Emacs sessions.
618 Major Modes
620 * Major Mode Basics::
621 * Major Mode Conventions::  Coding conventions for keymaps, etc.
622 * Example Major Modes::     Text mode and Lisp modes.
623 * Auto Major Mode::         How Emacs chooses the major mode automatically.
624 * Mode Help::               Finding out how to use a mode.
625 * Derived Modes::           Defining a new major mode based on another major
626                               mode.
627 * Generic Modes::           Defining a simple major mode that supports
628                               comment syntax and Font Lock mode.
629 * Mode Hooks::              Hooks run at the end of major mode functions.
631 Minor Modes
633 * Minor Mode Conventions::  Tips for writing a minor mode.
634 * Keymaps and Minor Modes:: How a minor mode can have its own keymap.
635 * Defining Minor Modes::    A convenient facility for defining minor modes.
637 Mode Line Format
639 * Mode Line Basics::
640 * Mode Line Data::          The data structure that controls the mode line.
641 * Mode Line Variables::     Variables used in that data structure.
642 * %-Constructs::            Putting information into a mode line.
643 * Properties in Mode::      Using text properties in the mode line.
644 * Header Lines::            Like a mode line, but at the top.
645 * Emulating Mode Line::     Formatting text as the mode line would.
647 Documentation
649 * Documentation Basics::    Good style for doc strings.
650                               Where to put them.  How Emacs stores them.
651 * Accessing Documentation:: How Lisp programs can access doc strings.
652 * Keys in Documentation::   Substituting current key bindings.
653 * Describing Characters::   Making printable descriptions of
654                               non-printing characters and key sequences.
655 * Help Functions::          Subroutines used by Emacs help facilities.
657 Files
659 * Visiting Files::          Reading files into Emacs buffers for editing.
660 * Saving Buffers::          Writing changed buffers back into files.
661 * Reading from Files::      Reading files into other buffers.
662 * Writing to Files::        Writing new files from parts of buffers.
663 * File Locks::              Locking and unlocking files, to prevent
664                               simultaneous editing by two people.
665 * Information about Files:: Testing existence, accessibility, size of files.
666 * Changing Files::          Renaming files, changing protection, etc.
667 * File Names::              Decomposing and expanding file names.
668 * Contents of Directories:: Getting a list of the files in a directory.
669 * Create/Delete Dirs::      Creating and Deleting Directories.
670 * Magic File Names::        Defining "magic" special handling
671                               for certain file names.
672 * Format Conversion::       Conversion to and from various file formats.
674 Visiting Files
676 * Visiting Functions::      The usual interface functions for visiting.
677 * Subroutines of Visiting:: Lower-level subroutines that they use.
679 Information about Files
681 * Testing Accessibility::   Is a given file readable?  Writable?
682 * Kinds of Files::          Is it a directory?  A symbolic link?
683 * Truenames::               Eliminating symbolic links from a file name.
684 * File Attributes::         How large is it?  Any other names?  Etc.
686 File Names
688 * File Name Components::    The directory part of a file name, and the rest.
689 * Relative File Names::     Some file names are relative to a
690                               current directory.
691 * Directory Names::         A directory's name as a directory
692                               is different from its name as a file.
693 * File Name Expansion::     Converting relative file names to absolute ones.
694 * Unique File Names::       Generating names for temporary files.
695 * File Name Completion::    Finding the completions for a given file name.
696 * Standard File Names::     If your package uses a fixed file name,
697                               how to handle various operating systems simply.
699 Backups and Auto-Saving
701 * Backup Files::            How backup files are made; how their names
702                               are chosen.
703 * Auto-Saving::             How auto-save files are made; how their
704                               names are chosen.
705 * Reverting::               @code{revert-buffer}, and how to customize
706                               what it does.
708 Backup Files
710 * Making Backups::          How Emacs makes backup files, and when.
711 * Rename or Copy::          Two alternatives: renaming the old file
712                               or copying it.
713 * Numbered Backups::        Keeping multiple backups for each source file.
714 * Backup Names::            How backup file names are computed; customization.
716 Buffers
718 * Buffer Basics::           What is a buffer?
719 * Current Buffer::          Designating a buffer as current
720                               so primitives will access its contents.
721 * Buffer Names::            Accessing and changing buffer names.
722 * Buffer File Name::        The buffer file name indicates which file
723                               is visited.
724 * Buffer Modification::     A buffer is @dfn{modified} if it needs to be saved.
725 * Modification Time::       Determining whether the visited file was changed
726                               ``behind Emacs's back''.
727 * Read Only Buffers::       Modifying text is not allowed in a
728                               read-only buffer.
729 * The Buffer List::         How to look at all the existing buffers.
730 * Creating Buffers::        Functions that create buffers.
731 * Killing Buffers::         Buffers exist until explicitly killed.
732 * Indirect Buffers::        An indirect buffer shares text with some
733                               other buffer.
734 * Buffer Gap::              The gap in the buffer.
736 Windows
738 * Basic Windows::           Basic information on using windows.
739 * Splitting Windows::       Splitting one window into two windows.
740 * Deleting Windows::        Deleting a window gives its space to other windows.
741 * Selecting Windows::       The selected window is the one that you edit in.
742 * Cyclic Window Ordering::  Moving around the existing windows.
743 * Buffers and Windows::     Each window displays the contents of a buffer.
744 * Displaying Buffers::      Higher-lever functions for displaying a buffer
745                               and choosing a window for it.
746 * Choosing Window::         How to choose a window for displaying a buffer.
747 * Window Point::            Each window has its own location of point.
748 * Window Start::            The display-start position controls which text
749                               is on-screen in the window.
750 * Textual Scrolling::       Moving text up and down through the window.
751 * Vertical Scrolling::      Moving the contents up and down on the window.
752 * Horizontal Scrolling::    Moving the contents sideways on the window.
753 * Size of Window::          Accessing the size of a window.
754 * Resizing Windows::        Changing the size of a window.
755 * Coordinates and Windows:: Converting coordinates to windows.
756 * Window Configurations::   Saving and restoring the state of the screen.
757 * Window Hooks::            Hooks for scrolling, window size changes,
758                               redisplay going past a certain point,
759                               or window configuration changes.
761 Frames
763 * Creating Frames::         Creating additional frames.
764 * Multiple Displays::       Creating frames on other X displays.
765 * Frame Parameters::        Controlling frame size, position, font, etc.
766 * Frame Titles::            Automatic updating of frame titles.
767 * Deleting Frames::         Frames last until explicitly deleted.
768 * Finding All Frames::      How to examine all existing frames.
769 * Frames and Windows::      A frame contains windows;
770                               display of text always works through windows.
771 * Minibuffers and Frames::  How a frame finds the minibuffer to use.
772 * Input Focus::             Specifying the selected frame.
773 * Visibility of Frames::    Frames may be visible or invisible, or icons.
774 * Raising and Lowering::    Raising a frame makes it hide other X windows;
775                               lowering it puts it underneath the others.
776 * Frame Configurations::    Saving the state of all frames.
777 * Mouse Tracking::          Getting events that say when the mouse moves.
778 * Mouse Position::          Asking where the mouse is, or moving it.
779 * Pop-Up Menus::            Displaying a menu for the user to select from.
780 * Dialog Boxes::            Displaying a box to ask yes or no.
781 * Pointer Shapes::          Specifying the shape of the mouse pointer.
782 * Window System Selections::Transferring text to and from other windows.
783 * Color Names::             Getting the definitions of color names.
784 * Text Terminal Colors::    Defining colors for text-only terminals.
785 * Resources::               Getting resource values from the server.
786 * Display Feature Testing:: Determining the features of a terminal.
788 Positions
790 * Point::                   The special position where editing takes place.
791 * Motion::                  Changing point.
792 * Excursions::              Temporary motion and buffer changes.
793 * Narrowing::               Restricting editing to a portion of the buffer.
795 Motion
797 * Character Motion::        Moving in terms of characters.
798 * Word Motion::             Moving in terms of words.
799 * Buffer End Motion::       Moving to the beginning or end of the buffer.
800 * Text Lines::              Moving in terms of lines of text.
801 * Screen Lines::            Moving in terms of lines as displayed.
802 * List Motion::             Moving by parsing lists and sexps.
803 * Skipping Characters::     Skipping characters belonging to a certain set.
805 Markers
807 * Overview of Markers::     The components of a marker, and how it relocates.
808 * Predicates on Markers::   Testing whether an object is a marker.
809 * Creating Markers::        Making empty markers or markers at certain places.
810 * Information from Markers::Finding the marker's buffer or character
811                               position.
812 * Marker Insertion Types::  Two ways a marker can relocate when you
813                               insert where it points.
814 * Moving Markers::          Moving the marker to a new buffer or position.
815 * The Mark::                How ``the mark'' is implemented with a marker.
816 * The Region::              How to access ``the region''.
818 Text
820 * Near Point::              Examining text in the vicinity of point.
821 * Buffer Contents::         Examining text in a general fashion.
822 * Comparing Text::          Comparing substrings of buffers.
823 * Insertion::               Adding new text to a buffer.
824 * Commands for Insertion::  User-level commands to insert text.
825 * Deletion::                Removing text from a buffer.
826 * User-Level Deletion::     User-level commands to delete text.
827 * The Kill Ring::           Where removed text sometimes is saved for
828                               later use.
829 * Undo::                    Undoing changes to the text of a buffer.
830 * Maintaining Undo::        How to enable and disable undo information.
831                               How to control how much information is kept.
832 * Filling::                 Functions for explicit filling.
833 * Margins::                 How to specify margins for filling commands.
834 * Adaptive Fill::           Adaptive Fill mode chooses a fill prefix
835                               from context.
836 * Auto Filling::            How auto-fill mode is implemented to break lines.
837 * Sorting::                 Functions for sorting parts of the buffer.
838 * Columns::                 Computing horizontal positions, and using them.
839 * Indentation::             Functions to insert or adjust indentation.
840 * Case Changes::            Case conversion of parts of the buffer.
841 * Text Properties::         Assigning Lisp property lists to text characters.
842 * Substitution::            Replacing a given character wherever it appears.
843 * Transposition::           Swapping two portions of a buffer.
844 * Registers::               How registers are implemented.  Accessing
845                               the text or position stored in a register.
846 * Base 64::                 Conversion to or from base 64 encoding.
847 * MD5 Checksum::            Compute the MD5 ``message digest''/``checksum''.
848 * Atomic Changes::          Installing several buffer changes ``atomically''.
849 * Change Hooks::            Supplying functions to be run when text is changed.
851 The Kill Ring
853 * Kill Ring Concepts::      What text looks like in the kill ring.
854 * Kill Functions::          Functions that kill text.
855 * Yanking::                 How yanking is done.
856 * Yank Commands::           Commands that access the kill ring.
857 * Low-Level Kill Ring::     Functions and variables for kill ring access.
858 * Internals of Kill Ring::  Variables that hold kill-ring data.
860 Indentation
862 * Primitive Indent::        Functions used to count and insert indentation.
863 * Mode-Specific Indent::    Customize indentation for different modes.
864 * Region Indent::           Indent all the lines in a region.
865 * Relative Indent::         Indent the current line based on previous lines.
866 * Indent Tabs::             Adjustable, typewriter-like tab stops.
867 * Motion by Indent::        Move to first non-blank character.
869 Text Properties
871 * Examining Properties::    Looking at the properties of one character.
872 * Changing Properties::     Setting the properties of a range of text.
873 * Property Search::         Searching for where a property changes value.
874 * Special Properties::      Particular properties with special meanings.
875 * Format Properties::       Properties for representing formatting of text.
876 * Sticky Properties::       How inserted text gets properties from
877                               neighboring text.
878 * Saving Properties::       Saving text properties in files, and reading
879                               them back.
880 * Lazy Properties::         Computing text properties in a lazy fashion
881                               only when text is examined.
882 * Clickable Text::          Using text properties to make regions of text
883                               do something when you click on them.
884 * Links and Mouse-1::       How to make @key{Mouse-1} follow a link.
885 * Fields::                  The @code{field} property defines
886                               fields within the buffer.
887 * Not Intervals::           Why text properties do not use
888                               Lisp-visible text intervals.
890 Non-ASCII Characters
892 * Text Representations::    Unibyte and multibyte representations
893 * Converting Representations::  Converting unibyte to multibyte and vice versa.
894 * Selecting a Representation::  Treating a byte sequence as unibyte or multi.
895 * Character Codes::         How unibyte and multibyte relate to
896                                 codes of individual characters.
897 * Character Sets::          The space of possible characters codes
898                                 is divided into various character sets.
899 * Chars and Bytes::         More information about multibyte encodings.
900 * Splitting Characters::    Converting a character to its byte sequence.
901 * Scanning Charsets::       Which character sets are used in a buffer?
902 * Translation of Characters::   Translation tables are used for conversion.
903 * Coding Systems::          Coding systems are conversions for saving files.
904 * Input Methods::           Input methods allow users to enter various
905                                 non-ASCII characters without special keyboards.
906 * Locales::                 Interacting with the POSIX locale.
908 Searching and Matching
910 * String Search::           Search for an exact match.
911 * Regular Expressions::     Describing classes of strings.
912 * Regexp Search::           Searching for a match for a regexp.
913 * POSIX Regexps::           Searching POSIX-style for the longest match.
914 * Search and Replace::      Internals of @code{query-replace}.
915 * Match Data::              Finding out which part of the text matched
916                               various parts of a regexp, after regexp search.
917 * Searching and Case::      Case-independent or case-significant searching.
918 * Standard Regexps::        Useful regexps for finding sentences, pages,...
920 Regular Expressions
922 * Syntax of Regexps::       Rules for writing regular expressions.
923 * Regexp Example::          Illustrates regular expression syntax.
924 * Regexp Functions::        Functions for operating on regular expressions.
926 Syntax Tables
928 * Syntax Basics::           Basic concepts of syntax tables.
929 * Syntax Descriptors::      How characters are classified.
930 * Syntax Table Functions::  How to create, examine and alter syntax tables.
931 * Syntax Properties::       Overriding syntax with text properties.
932 * Motion and Syntax::       Moving over characters with certain syntaxes.
933 * Parsing Expressions::     Parsing balanced expressions
934                               using the syntax table.
935 * Standard Syntax Tables::  Syntax tables used by various major modes.
936 * Syntax Table Internals::  How syntax table information is stored.
937 * Categories::              Another way of classifying character syntax.
939 Syntax Descriptors
941 * Syntax Class Table::      Table of syntax classes.
942 * Syntax Flags::            Additional flags each character can have.
944 Abbrevs And Abbrev Expansion
946 * Abbrev Mode::             Setting up Emacs for abbreviation.
947 * Abbrev Tables::           Creating and working with abbrev tables.
948 * Defining Abbrevs::        Specifying abbreviations and their expansions.
949 * Abbrev Files::            Saving abbrevs in files.
950 * Abbrev Expansion::        Controlling expansion; expansion subroutines.
951 * Standard Abbrev Tables::  Abbrev tables used by various major modes.
953 Processes
955 * Subprocess Creation::     Functions that start subprocesses.
956 * Shell Arguments::         Quoting an argument to pass it to a shell.
957 * Synchronous Processes::   Details of using synchronous subprocesses.
958 * Asynchronous Processes::  Starting up an asynchronous subprocess.
959 * Deleting Processes::      Eliminating an asynchronous subprocess.
960 * Process Information::     Accessing run-status and other attributes.
961 * Input to Processes::      Sending input to an asynchronous subprocess.
962 * Signals to Processes::    Stopping, continuing or interrupting
963                               an asynchronous subprocess.
964 * Output from Processes::   Collecting output from an asynchronous subprocess.
965 * Sentinels::               Sentinels run when process run-status changes.
966 * Query Before Exit::       Whether to query if exiting will kill a process.
967 * Transaction Queues::      Transaction-based communication with subprocesses.
968 * Network::                 Opening network connections.
969 * Network Servers::         Network servers let Emacs accept net connections.
970 * Datagrams::               UDP network connections.
971 * Low-Level Network::       Lower-level but more general function
972                               to create connections and servers.
973 * Byte Packing::             Using bindat to pack and unpack binary data.
975 Receiving Output from Processes
977 * Process Buffers::         If no filter, output is put in a buffer.
978 * Filter Functions::        Filter functions accept output from the process.
979 * Decoding Output::         Filters can get unibyte or multibyte strings.
980 * Accepting Output::        How to wait until process output arrives.
982 Emacs Display
984 * Refresh Screen::          Clearing the screen and redrawing everything on it.
985 * Forcing Redisplay::       Forcing redisplay.
986 * Truncation::              Folding or wrapping long text lines.
987 * The Echo Area::           Displaying messages at the bottom of the screen.
988 * Warnings::                Displaying warning messages for the user.
989 * Invisible Text::          Hiding part of the buffer text.
990 * Selective Display::       Hiding part of the buffer text (the old way).
991 * Temporary Displays::      Displays that go away automatically.
992 * Overlays::                Use overlays to highlight parts of the buffer.
993 * Width::                   How wide a character or string is on the screen.
994 * Line Height::             Controlling the height of lines.
995 * Faces::                   A face defines a graphics style
996                               for text characters: font, colors, etc.
997 * Fringes::                 Controlling window fringes.
998 * Scroll Bars::             Controlling vertical scroll bars.
999 * Pointer Shape::           Controlling the mouse pointer shape.
1000 * Display Property::        Enabling special display features.
1001 * Images::                  Displaying images in Emacs buffers.
1002 * Buttons::                 Adding clickable buttons to Emacs buffers.
1003 * Blinking::                How Emacs shows the matching open parenthesis.
1004 * Inverse Video::           Specifying how the screen looks.
1005 * Usual Display::           The usual conventions for displaying nonprinting chars.
1006 * Display Tables::          How to specify other conventions.
1007 * Beeping::                 Audible signal to the user.
1008 * Window Systems::          Which window system is being used.
1010 Operating System Interface
1012 * Starting Up::             Customizing Emacs start-up processing.
1013 * Getting Out::             How exiting works (permanent or temporary).
1014 * System Environment::      Distinguish the name and kind of system.
1015 * User Identification::     Finding the name and user id of the user.
1016 * Time of Day::             Getting the current time.
1017 * Time Conversion::         Converting a time from numeric form to a string, or
1018                               to calendrical data (or vice versa).
1019 * Processor Run Time::      Getting the run time used by Emacs.
1020 * Time Calculations::       Adding, subtracting, comparing times, etc.
1021 * Timers::                  Setting a timer to call a function at a certain time.
1022 * Terminal Input::          Recording terminal input for debugging.
1023 * Terminal Output::         Recording terminal output for debugging.
1024 * Sound Output::            Playing sounds on the computer's speaker.
1025 * X11 Keysyms::             Operating on key symbols for X Windows
1026 * Batch Mode::              Running Emacs without terminal interaction.
1027 * Session Management::      Saving and restoring state with X Session Management.
1029 Starting Up Emacs
1031 * Startup Summary::         Sequence of actions Emacs performs at start-up.
1032 * Init File::               Details on reading the init file (@file{.emacs}).
1033 * Terminal-Specific::       How the terminal-specific Lisp file is read.
1034 * Command-Line Arguments::  How command line arguments are processed,
1035                               and how you can customize them.
1037 Getting out of Emacs
1039 * Killing Emacs::           Exiting Emacs irreversibly.
1040 * Suspending Emacs::        Exiting Emacs reversibly.
1042 Tips and Conventions
1044 * Coding Conventions::      Conventions for clean and robust programs.
1045 * Compilation Tips::        Making compiled code run fast.
1046 * Documentation Tips::      Writing readable documentation strings.
1047 * Comment Tips::            Conventions for writing comments.
1048 * Library Headers::         Standard headers for library packages.
1050 GNU Emacs Internals
1052 * Building Emacs::          How to preload Lisp libraries into Emacs.
1053 * Pure Storage::            A kludge to make preloaded Lisp functions sharable.
1054 * Garbage Collection::      Reclaiming space for Lisp objects no longer used.
1055 * Memory Usage::            Info about total size of Lisp objects made so far.
1056 * Writing Emacs Primitives::  Writing C code for Emacs.
1057 * Object Internals::        Data formats of buffers, windows, processes.
1059 Object Internals
1061 * Buffer Internals::        Components of a buffer structure.
1062 * Window Internals::        Components of a window structure.
1063 * Process Internals::       Components of a process structure.
1064 @end menu
1066 @include intro.texi
1067 @include objects.texi
1068 @include numbers.texi
1069 @include strings.texi
1071 @include lists.texi
1072 @include sequences.texi
1073 @include hash.texi
1074 @include symbols.texi
1075 @include eval.texi
1077 @include control.texi
1078 @include variables.texi
1079 @include functions.texi
1080 @include macros.texi
1082 @include customize.texi
1083 @include loading.texi
1084 @include compile.texi
1085 @include advice.texi
1087 @include debugging.texi
1088 @include streams.texi
1089 @include minibuf.texi
1090 @include commands.texi
1092 @include keymaps.texi
1093 @include modes.texi
1094 @include help.texi
1095 @include files.texi
1097 @include backups.texi
1098 @include buffers.texi
1099 @include windows.texi
1100 @include frames.texi
1102 @include positions.texi
1103 @include markers.texi
1104 @include text.texi
1105 @include nonascii.texi
1107 @include searching.texi
1108 @include syntax.texi
1109 @include abbrevs.texi
1110 @include processes.texi
1112 @include display.texi
1113 @include os.texi
1115 @c MOVE to Emacs Manual:  include misc-modes.texi
1117 @c appendices
1119 @c  REMOVE this:  include non-hacker.texi
1121 @include anti.texi
1122 @include doclicense.texi
1123 @include gpl.texi
1124 @include tips.texi
1125 @include internals.texi
1126 @include errors.texi
1127 @include locals.texi
1128 @include maps.texi
1129 @include hooks.texi
1131 @include index.texi
1133 @node New Symbols, , Index, Top
1134 @unnumbered New Symbols Since the Previous Edition
1136 @printindex tp
1138 @bye
1141 These words prevent "local variables" above from confusing Emacs.
1143 @ignore
1144    arch-tag: f7e9a219-a0e1-4776-b631-08eaa1d49b34
1145 @end ignore