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