]> code.delx.au - gnu-emacs/blob - lispref/elisp.texi
* text.texi (Special Properties): Clarify the definition of
[gnu-emacs] / 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 Version of the manual and of Emacs.
8 @c Please remember to update the edition number in README as well.
9 @set VERSION 2.9
10 @set EMACSVER 22.0.50
11
12 @dircategory Emacs
13 @direntry
14 * Elisp: (elisp). The Emacs Lisp Reference Manual.
15 @end direntry
16
17 @smallbook
18 @setchapternewpage odd
19 @finalout
20
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
28
29 @copying
30 This is edition @value{VERSION} of the GNU Emacs Lisp
31 Reference Manual, corresponding to Emacs version @value{EMACSVER}.
32
33 Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000,
34 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
35
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.2 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''.
44
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
50
51 @titlepage
52 @title GNU Emacs Lisp Reference Manual
53 @subtitle For Emacs Version @value{EMACSVER}
54 @subtitle Revision @value{VERSION}, January 2002
55
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
61
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
68
69 @sp 1
70 Cover art by Etienne Suvasa.
71 @end titlepage
72
73
74 @c Print the tables of contents
75 @summarycontents
76 @contents
77
78
79 @ifnottex
80 @node Top, Introduction, (dir), (dir)
81 @top Emacs Lisp
82
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
86
87 @menu
88 * Introduction:: Introduction and conventions used.
89
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.
99
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.
107
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.
112
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.
120
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 system-level windows.
127 * Positions:: Buffer positions and motion functions.
128 * Markers:: Markers represent positions and update
129 automatically when the text is changed.
130
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.
136
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.
141
142 Appendices
143
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.
155
156 * Index:: Index including concepts, functions, variables,
157 and other terms.
158
159 * New Symbols:: New functions and variables in Emacs @value{EMACSVER}.
160
161 Detailed Node Listing
162 ---------------------
163
164 Here are other nodes that are inferiors of those already listed,
165 mentioned here so you can get to them in one step:
166
167 Introduction
168
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.
174
175 Conventions
176
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.
184
185 Format of Descriptions
186
187 * A Sample Function Description::
188 * A Sample Variable Description::
189
190 Lisp Data Types
191
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.
199
200 Programming Types
201
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.
223
224 Cons Cell and List Types
225
226 * Box Diagrams:: Drawing pictures of lists.
227 * Dotted Pair Notation:: An alternative syntax for lists.
228 * Association List Type:: A specially constructed list.
229
230 Editing Types
231
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.
242
243 Numbers
244
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.
255
256 Strings and Characters
257
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.
267
268 Lists
269
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.
278
279 Modifying Existing List Structure
280
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.
285
286 Sequences, Arrays, and Vectors
287
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.
295
296 Hash Tables
297
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.
302
303 Symbols
304
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.
311
312 Evaluation
313
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.
319
320 Kinds of Forms
321
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.
333
334 Control Structures
335
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.
341
342 Nonlocal Exits
343
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.
349
350 Errors
351
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.
356
357 Variables
358
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.
377
378 Scoping Rules for Variable Bindings
379
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.
386
387 Buffer-Local Variables
388
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.
393
394 Functions
395
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.
411
412 Lambda Expressions
413
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.
418
419 Macros
420
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.
429
430 Writing Customization Definitions
431
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.
437
438 Loading
439
440 * How Programs Do Loading:: The @code{load} function and others.
441 * Load Suffixes:: Details about the suffixes that @code{load} tries.
442 * Library Search:: Finding a library to load.
443 * Loading Non-ASCII:: Non-@acronym{ASCII} characters in Emacs Lisp files.
444 * Autoload:: Setting up a function to autoload.
445 * Repeated Loading:: Precautions about loading a file twice.
446 * Named Features:: Loading a library if it isn't already loaded.
447 * Where Defined:: Finding which file defined a certain symbol.
448 * Unloading:: How to ``unload'' a library that was loaded.
449 * Hooks for Loading:: Providing code to be run when
450 particular libraries are loaded.
451
452 Byte Compilation
453
454 * Speed of Byte-Code:: An example of speedup from byte compilation.
455 * Compilation Functions:: Byte compilation functions.
456 * Docs and Compilation:: Dynamic loading of documentation strings.
457 * Dynamic Loading:: Dynamic loading of individual functions.
458 * Eval During Compile:: Code to be evaluated when you compile.
459 * Compiler Errors:: Handling compiler error messages.
460 * Byte-Code Objects:: The data type used for byte-compiled functions.
461 * Disassembly:: Disassembling byte-code; how to read byte-code.
462
463 Advising Emacs Lisp Functions
464
465 * Simple Advice:: A simple example to explain the basics of advice.
466 * Defining Advice:: Detailed description of @code{defadvice}.
467 * Around-Advice:: Wrapping advice around a function's definition.
468 * Computed Advice:: ...is to @code{defadvice} as @code{fset} is to @code{defun}.
469 * Activation of Advice:: Advice doesn't do anything until you activate it.
470 * Enabling Advice:: You can enable or disable each piece of advice.
471 * Preactivation:: Preactivation is a way of speeding up the
472 loading of compiled advice.
473 * Argument Access in Advice:: How advice can access the function's arguments.
474 * Advising Primitives:: Accessing arguments when advising a primitive.
475 * Combined Definition:: How advice is implemented.
476
477 Debugging Lisp Programs
478
479 * Debugger:: How the Emacs Lisp debugger is implemented.
480 * Edebug:: A source-level Emacs Lisp debugger.
481 * Syntax Errors:: How to find syntax errors.
482 * Test Coverage:: Ensuring you have tested all branches in your code.
483 * Compilation Errors:: How to find errors that show up in
484 byte compilation.
485
486 The Lisp Debugger
487
488 * Error Debugging:: Entering the debugger when an error happens.
489 * Infinite Loops:: Stopping and debugging a program that doesn't exit.
490 * Function Debugging:: Entering it when a certain function is called.
491 * Explicit Debug:: Entering it at a certain point in the program.
492 * Using Debugger:: What the debugger does; what you see while in it.
493 * Debugger Commands:: Commands used while in the debugger.
494 * Invoking the Debugger:: How to call the function @code{debug}.
495 * Internals of Debugger:: Subroutines of the debugger, and global variables.
496
497 Edebug
498
499 * Using Edebug:: Introduction to use of Edebug.
500 * Instrumenting:: You must instrument your code
501 in order to debug it with Edebug.
502 * Edebug Execution Modes:: Execution modes, stopping more or less often.
503 * Jumping:: Commands to jump to a specified place.
504 * Edebug Misc:: Miscellaneous commands.
505 * Breaks:: Setting breakpoints to make the program stop.
506 * Trapping Errors:: Trapping errors with Edebug.
507 * Edebug Views:: Views inside and outside of Edebug.
508 * Edebug Eval:: Evaluating expressions within Edebug.
509 * Eval List:: Expressions whose values are displayed
510 each time you enter Edebug.
511 * Printing in Edebug:: Customization of printing.
512 * Trace Buffer:: How to produce trace output in a buffer.
513 * Coverage Testing:: How to test evaluation coverage.
514 * The Outside Context:: Data that Edebug saves and restores.
515 * Edebug and Macros:: Specifying how to handle macro calls.
516 * Edebug Options:: Option variables for customizing Edebug.
517
518 Debugging Invalid Lisp Syntax
519
520 * Excess Open:: How to find a spurious open paren or missing close.
521 * Excess Close:: How to find a spurious close paren or missing open.
522
523 Reading and Printing Lisp Objects
524
525 * Streams Intro:: Overview of streams, reading and printing.
526 * Input Streams:: Various data types that can be used as
527 input streams.
528 * Input Functions:: Functions to read Lisp objects from text.
529 * Output Streams:: Various data types that can be used as
530 output streams.
531 * Output Functions:: Functions to print Lisp objects as text.
532 * Output Variables:: Variables that control what the printing
533 functions do.
534
535 Minibuffers
536
537 * Intro to Minibuffers:: Basic information about minibuffers.
538 * Text from Minibuffer:: How to read a straight text string.
539 * Object from Minibuffer:: How to read a Lisp object or expression.
540 * Minibuffer History:: Recording previous minibuffer inputs
541 so the user can reuse them.
542 * Initial Input:: Specifying initial contents for the minibuffer.
543 * Completion:: How to invoke and customize completion.
544 * Yes-or-No Queries:: Asking a question with a simple answer.
545 * Multiple Queries:: Asking a series of similar questions.
546 * Reading a Password:: Reading a password from the terminal.
547 * Minibuffer Commands:: Commands used as key bindings in minibuffers.
548 * Minibuffer Contents:: How such commands access the minibuffer text.
549 * Minibuffer Windows:: Operating on the special minibuffer windows.
550 * Recursive Mini:: Whether recursive entry to minibuffer is allowed.
551 * Minibuffer Misc:: Various customization hooks and variables.
552
553 Completion
554
555 * Basic Completion:: Low-level functions for completing strings.
556 (These are too low level to use the minibuffer.)
557 * Minibuffer Completion:: Invoking the minibuffer with completion.
558 * Completion Commands:: Minibuffer commands that do completion.
559 * High-Level Completion:: Convenient special cases of completion
560 (reading buffer name, file name, etc.)
561 * Reading File Names:: Using completion to read file names.
562 * Programmed Completion:: Finding the completions for a given file name.
563
564 Command Loop
565
566 * Command Overview:: How the command loop reads commands.
567 * Defining Commands:: Specifying how a function should read arguments.
568 * Interactive Call:: Calling a command, so that it will read arguments.
569 * Command Loop Info:: Variables set by the command loop for you to examine.
570 * Adjusting Point:: Adjustment of point after a command.
571 * Input Events:: What input looks like when you read it.
572 * Reading Input:: How to read input events from the keyboard or mouse.
573 * Special Events:: Events processed immediately and individually.
574 * Waiting:: Waiting for user input or elapsed time.
575 * Quitting:: How @kbd{C-g} works. How to catch or defer quitting.
576 * Prefix Command Arguments:: How the commands to set prefix args work.
577 * Recursive Editing:: Entering a recursive edit,
578 and why you usually shouldn't.
579 * Disabling Commands:: How the command loop handles disabled commands.
580 * Command History:: How the command history is set up, and how accessed.
581 * Keyboard Macros:: How keyboard macros are implemented.
582
583 Defining Commands
584
585 * Using Interactive:: General rules for @code{interactive}.
586 * Interactive Codes:: The standard letter-codes for reading arguments
587 in various ways.
588 * Interactive Examples:: Examples of how to read interactive arguments.
589
590 Keymaps
591
592 * Keymap Terminology:: Definitions of terms pertaining to keymaps.
593 * Format of Keymaps:: What a keymap looks like as a Lisp object.
594 * Creating Keymaps:: Functions to create and copy keymaps.
595 * Inheritance and Keymaps:: How one keymap can inherit the bindings
596 of another keymap.
597 * Prefix Keys:: Defining a key with a keymap as its definition.
598 * Active Keymaps:: Each buffer has a local keymap
599 to override the standard (global) bindings.
600 Each minor mode can also override them.
601 * Key Lookup:: How extracting elements from keymaps works.
602 * Functions for Key Lookup:: How to request key lookup.
603 * Changing Key Bindings:: Redefining a key in a keymap.
604 * Remapping Commands:: Bindings that translate one command to another.
605 * Key Binding Commands:: Interactive interfaces for redefining keys.
606 * Scanning Keymaps:: Looking through all keymaps, for printing help.
607 * Menu Keymaps:: A keymap can define a menu for X
608 or for use from the terminal.
609
610 Major and Minor Modes
611
612 * Hooks:: How to use hooks; how to write code that
613 provides hooks.
614 * Major Modes:: Defining major modes.
615 * Minor Modes:: Defining minor modes.
616 * Mode Line Format:: Customizing the text that appears in the mode line.
617 * Imenu:: How a mode can provide a menu
618 of definitions in the buffer.
619 * Font Lock Mode:: How modes can highlight text according to syntax.
620 * Desktop Save Mode:: How modes can have buffer state saved between
621 Emacs sessions.
622
623 Major Modes
624
625 * Major Mode Basics::
626 * Major Mode Conventions:: Coding conventions for keymaps, etc.
627 * Example Major Modes:: Text mode and Lisp modes.
628 * Auto Major Mode:: How Emacs chooses the major mode automatically.
629 * Mode Help:: Finding out how to use a mode.
630 * Derived Modes:: Defining a new major mode based on another major
631 mode.
632 * Generic Modes:: Defining a simple major mode that supports
633 comment syntax and Font Lock mode.
634 * Mode Hooks:: Hooks run at the end of major mode functions.
635
636 Minor Modes
637
638 * Minor Mode Conventions:: Tips for writing a minor mode.
639 * Keymaps and Minor Modes:: How a minor mode can have its own keymap.
640 * Defining Minor Modes:: A convenient facility for defining minor modes.
641
642 Mode Line Format
643
644 * Mode Line Basics::
645 * Mode Line Data:: The data structure that controls the mode line.
646 * Mode Line Variables:: Variables used in that data structure.
647 * %-Constructs:: Putting information into a mode line.
648 * Properties in Mode:: Using text properties in the mode line.
649 * Header Lines:: Like a mode line, but at the top.
650 * Emulating Mode Line:: Formatting text as the mode line would.
651
652 Documentation
653
654 * Documentation Basics:: Good style for doc strings.
655 Where to put them. How Emacs stores them.
656 * Accessing Documentation:: How Lisp programs can access doc strings.
657 * Keys in Documentation:: Substituting current key bindings.
658 * Describing Characters:: Making printable descriptions of
659 non-printing characters and key sequences.
660 * Help Functions:: Subroutines used by Emacs help facilities.
661
662 Files
663
664 * Visiting Files:: Reading files into Emacs buffers for editing.
665 * Saving Buffers:: Writing changed buffers back into files.
666 * Reading from Files:: Reading files into other buffers.
667 * Writing to Files:: Writing new files from parts of buffers.
668 * File Locks:: Locking and unlocking files, to prevent
669 simultaneous editing by two people.
670 * Information about Files:: Testing existence, accessibility, size of files.
671 * Changing Files:: Renaming files, changing protection, etc.
672 * File Names:: Decomposing and expanding file names.
673 * Contents of Directories:: Getting a list of the files in a directory.
674 * Create/Delete Dirs:: Creating and Deleting Directories.
675 * Magic File Names:: Defining "magic" special handling
676 for certain file names.
677 * Format Conversion:: Conversion to and from various file formats.
678
679 Visiting Files
680
681 * Visiting Functions:: The usual interface functions for visiting.
682 * Subroutines of Visiting:: Lower-level subroutines that they use.
683
684 Information about Files
685
686 * Testing Accessibility:: Is a given file readable? Writable?
687 * Kinds of Files:: Is it a directory? A symbolic link?
688 * Truenames:: Eliminating symbolic links from a file name.
689 * File Attributes:: How large is it? Any other names? Etc.
690
691 File Names
692
693 * File Name Components:: The directory part of a file name, and the rest.
694 * Relative File Names:: Some file names are relative to a
695 current directory.
696 * Directory Names:: A directory's name as a directory
697 is different from its name as a file.
698 * File Name Expansion:: Converting relative file names to absolute ones.
699 * Unique File Names:: Generating names for temporary files.
700 * File Name Completion:: Finding the completions for a given file name.
701 * Standard File Names:: If your package uses a fixed file name,
702 how to handle various operating systems simply.
703
704 Backups and Auto-Saving
705
706 * Backup Files:: How backup files are made; how their names
707 are chosen.
708 * Auto-Saving:: How auto-save files are made; how their
709 names are chosen.
710 * Reverting:: @code{revert-buffer}, and how to customize
711 what it does.
712
713 Backup Files
714
715 * Making Backups:: How Emacs makes backup files, and when.
716 * Rename or Copy:: Two alternatives: renaming the old file
717 or copying it.
718 * Numbered Backups:: Keeping multiple backups for each source file.
719 * Backup Names:: How backup file names are computed; customization.
720
721 Buffers
722
723 * Buffer Basics:: What is a buffer?
724 * Current Buffer:: Designating a buffer as current
725 so primitives will access its contents.
726 * Buffer Names:: Accessing and changing buffer names.
727 * Buffer File Name:: The buffer file name indicates which file
728 is visited.
729 * Buffer Modification:: A buffer is @dfn{modified} if it needs to be saved.
730 * Modification Time:: Determining whether the visited file was changed
731 ``behind Emacs's back''.
732 * Read Only Buffers:: Modifying text is not allowed in a
733 read-only buffer.
734 * The Buffer List:: How to look at all the existing buffers.
735 * Creating Buffers:: Functions that create buffers.
736 * Killing Buffers:: Buffers exist until explicitly killed.
737 * Indirect Buffers:: An indirect buffer shares text with some
738 other buffer.
739 * Buffer Gap:: The gap in the buffer.
740
741 Windows
742
743 * Basic Windows:: Basic information on using windows.
744 * Splitting Windows:: Splitting one window into two windows.
745 * Deleting Windows:: Deleting a window gives its space to other windows.
746 * Selecting Windows:: The selected window is the one that you edit in.
747 * Cyclic Window Ordering:: Moving around the existing windows.
748 * Buffers and Windows:: Each window displays the contents of a buffer.
749 * Displaying Buffers:: Higher-lever functions for displaying a buffer
750 and choosing a window for it.
751 * Choosing Window:: How to choose a window for displaying a buffer.
752 * Window Point:: Each window has its own location of point.
753 * Window Start:: The display-start position controls which text
754 is on-screen in the window.
755 * Textual Scrolling:: Moving text up and down through the window.
756 * Vertical Scrolling:: Moving the contents up and down on the window.
757 * Horizontal Scrolling:: Moving the contents sideways on the window.
758 * Size of Window:: Accessing the size of a window.
759 * Resizing Windows:: Changing the size of a window.
760 * Coordinates and Windows:: Converting coordinates to windows.
761 * Window Configurations:: Saving and restoring the state of the screen.
762 * Window Hooks:: Hooks for scrolling, window size changes,
763 redisplay going past a certain point,
764 or window configuration changes.
765
766 Frames
767
768 * Creating Frames:: Creating additional frames.
769 * Multiple Displays:: Creating frames on other X displays.
770 * Frame Parameters:: Controlling frame size, position, font, etc.
771 * Frame Titles:: Automatic updating of frame titles.
772 * Deleting Frames:: Frames last until explicitly deleted.
773 * Finding All Frames:: How to examine all existing frames.
774 * Frames and Windows:: A frame contains windows;
775 display of text always works through windows.
776 * Minibuffers and Frames:: How a frame finds the minibuffer to use.
777 * Input Focus:: Specifying the selected frame.
778 * Visibility of Frames:: Frames may be visible or invisible, or icons.
779 * Raising and Lowering:: Raising a frame makes it hide other X windows;
780 lowering it puts it underneath the others.
781 * Frame Configurations:: Saving the state of all frames.
782 * Mouse Tracking:: Getting events that say when the mouse moves.
783 * Mouse Position:: Asking where the mouse is, or moving it.
784 * Pop-Up Menus:: Displaying a menu for the user to select from.
785 * Dialog Boxes:: Displaying a box to ask yes or no.
786 * Pointer Shapes:: Specifying the shape of the mouse pointer.
787 * Window System Selections::Transferring text to and from other windows.
788 * Color Names:: Getting the definitions of color names.
789 * Text Terminal Colors:: Defining colors for text-only terminals.
790 * Resources:: Getting resource values from the server.
791 * Display Feature Testing:: Determining the features of a terminal.
792
793 Positions
794
795 * Point:: The special position where editing takes place.
796 * Motion:: Changing point.
797 * Excursions:: Temporary motion and buffer changes.
798 * Narrowing:: Restricting editing to a portion of the buffer.
799
800 Motion
801
802 * Character Motion:: Moving in terms of characters.
803 * Word Motion:: Moving in terms of words.
804 * Buffer End Motion:: Moving to the beginning or end of the buffer.
805 * Text Lines:: Moving in terms of lines of text.
806 * Screen Lines:: Moving in terms of lines as displayed.
807 * List Motion:: Moving by parsing lists and sexps.
808 * Skipping Characters:: Skipping characters belonging to a certain set.
809
810 Markers
811
812 * Overview of Markers:: The components of a marker, and how it relocates.
813 * Predicates on Markers:: Testing whether an object is a marker.
814 * Creating Markers:: Making empty markers or markers at certain places.
815 * Information from Markers::Finding the marker's buffer or character
816 position.
817 * Marker Insertion Types:: Two ways a marker can relocate when you
818 insert where it points.
819 * Moving Markers:: Moving the marker to a new buffer or position.
820 * The Mark:: How ``the mark'' is implemented with a marker.
821 * The Region:: How to access ``the region''.
822
823 Text
824
825 * Near Point:: Examining text in the vicinity of point.
826 * Buffer Contents:: Examining text in a general fashion.
827 * Comparing Text:: Comparing substrings of buffers.
828 * Insertion:: Adding new text to a buffer.
829 * Commands for Insertion:: User-level commands to insert text.
830 * Deletion:: Removing text from a buffer.
831 * User-Level Deletion:: User-level commands to delete text.
832 * The Kill Ring:: Where removed text sometimes is saved for
833 later use.
834 * Undo:: Undoing changes to the text of a buffer.
835 * Maintaining Undo:: How to enable and disable undo information.
836 How to control how much information is kept.
837 * Filling:: Functions for explicit filling.
838 * Margins:: How to specify margins for filling commands.
839 * Adaptive Fill:: Adaptive Fill mode chooses a fill prefix
840 from context.
841 * Auto Filling:: How auto-fill mode is implemented to break lines.
842 * Sorting:: Functions for sorting parts of the buffer.
843 * Columns:: Computing horizontal positions, and using them.
844 * Indentation:: Functions to insert or adjust indentation.
845 * Case Changes:: Case conversion of parts of the buffer.
846 * Text Properties:: Assigning Lisp property lists to text characters.
847 * Substitution:: Replacing a given character wherever it appears.
848 * Transposition:: Swapping two portions of a buffer.
849 * Registers:: How registers are implemented. Accessing
850 the text or position stored in a register.
851 * Base 64:: Conversion to or from base 64 encoding.
852 * MD5 Checksum:: Compute the MD5 ``message digest''/``checksum''.
853 * Atomic Changes:: Installing several buffer changes ``atomically''.
854 * Change Hooks:: Supplying functions to be run when text is changed.
855
856 The Kill Ring
857
858 * Kill Ring Concepts:: What text looks like in the kill ring.
859 * Kill Functions:: Functions that kill text.
860 * Yanking:: How yanking is done.
861 * Yank Commands:: Commands that access the kill ring.
862 * Low-Level Kill Ring:: Functions and variables for kill ring access.
863 * Internals of Kill Ring:: Variables that hold kill-ring data.
864
865 Indentation
866
867 * Primitive Indent:: Functions used to count and insert indentation.
868 * Mode-Specific Indent:: Customize indentation for different modes.
869 * Region Indent:: Indent all the lines in a region.
870 * Relative Indent:: Indent the current line based on previous lines.
871 * Indent Tabs:: Adjustable, typewriter-like tab stops.
872 * Motion by Indent:: Move to first non-blank character.
873
874 Text Properties
875
876 * Examining Properties:: Looking at the properties of one character.
877 * Changing Properties:: Setting the properties of a range of text.
878 * Property Search:: Searching for where a property changes value.
879 * Special Properties:: Particular properties with special meanings.
880 * Format Properties:: Properties for representing formatting of text.
881 * Sticky Properties:: How inserted text gets properties from
882 neighboring text.
883 * Saving Properties:: Saving text properties in files, and reading
884 them back.
885 * Lazy Properties:: Computing text properties in a lazy fashion
886 only when text is examined.
887 * Clickable Text:: Using text properties to make regions of text
888 do something when you click on them.
889 * Links and Mouse-1:: How to make @key{Mouse-1} follow a link.
890 * Fields:: The @code{field} property defines
891 fields within the buffer.
892 * Not Intervals:: Why text properties do not use
893 Lisp-visible text intervals.
894
895 Non-ASCII Characters
896
897 * Text Representations:: Unibyte and multibyte representations
898 * Converting Representations:: Converting unibyte to multibyte and vice versa.
899 * Selecting a Representation:: Treating a byte sequence as unibyte or multi.
900 * Character Codes:: How unibyte and multibyte relate to
901 codes of individual characters.
902 * Character Sets:: The space of possible characters codes
903 is divided into various character sets.
904 * Chars and Bytes:: More information about multibyte encodings.
905 * Splitting Characters:: Converting a character to its byte sequence.
906 * Scanning Charsets:: Which character sets are used in a buffer?
907 * Translation of Characters:: Translation tables are used for conversion.
908 * Coding Systems:: Coding systems are conversions for saving files.
909 * Input Methods:: Input methods allow users to enter various
910 non-ASCII characters without special keyboards.
911 * Locales:: Interacting with the POSIX locale.
912
913 Searching and Matching
914
915 * String Search:: Search for an exact match.
916 * Searching and Case:: Case-independent or case-significant searching.
917 * Regular Expressions:: Describing classes of strings.
918 * Regexp Search:: Searching for a match for a regexp.
919 * POSIX Regexps:: Searching POSIX-style for the longest match.
920 * Match Data:: Finding out which part of the text matched,
921 after a string or regexp search.
922 * Search and Replace:: Commands that loop, searching and replacing.
923 * Standard Regexps:: Useful regexps for finding sentences, pages,...
924
925 Regular Expressions
926
927 * Syntax of Regexps:: Rules for writing regular expressions.
928 * Regexp Example:: Illustrates regular expression syntax.
929 * Regexp Functions:: Functions for operating on regular expressions.
930
931 Syntax Tables
932
933 * Syntax Basics:: Basic concepts of syntax tables.
934 * Syntax Descriptors:: How characters are classified.
935 * Syntax Table Functions:: How to create, examine and alter syntax tables.
936 * Syntax Properties:: Overriding syntax with text properties.
937 * Motion and Syntax:: Moving over characters with certain syntaxes.
938 * Parsing Expressions:: Parsing balanced expressions
939 using the syntax table.
940 * Standard Syntax Tables:: Syntax tables used by various major modes.
941 * Syntax Table Internals:: How syntax table information is stored.
942 * Categories:: Another way of classifying character syntax.
943
944 Syntax Descriptors
945
946 * Syntax Class Table:: Table of syntax classes.
947 * Syntax Flags:: Additional flags each character can have.
948
949 Abbrevs And Abbrev Expansion
950
951 * Abbrev Mode:: Setting up Emacs for abbreviation.
952 * Abbrev Tables:: Creating and working with abbrev tables.
953 * Defining Abbrevs:: Specifying abbreviations and their expansions.
954 * Abbrev Files:: Saving abbrevs in files.
955 * Abbrev Expansion:: Controlling expansion; expansion subroutines.
956 * Standard Abbrev Tables:: Abbrev tables used by various major modes.
957
958 Processes
959
960 * Subprocess Creation:: Functions that start subprocesses.
961 * Shell Arguments:: Quoting an argument to pass it to a shell.
962 * Synchronous Processes:: Details of using synchronous subprocesses.
963 * Asynchronous Processes:: Starting up an asynchronous subprocess.
964 * Deleting Processes:: Eliminating an asynchronous subprocess.
965 * Process Information:: Accessing run-status and other attributes.
966 * Input to Processes:: Sending input to an asynchronous subprocess.
967 * Signals to Processes:: Stopping, continuing or interrupting
968 an asynchronous subprocess.
969 * Output from Processes:: Collecting output from an asynchronous subprocess.
970 * Sentinels:: Sentinels run when process run-status changes.
971 * Query Before Exit:: Whether to query if exiting will kill a process.
972 * Transaction Queues:: Transaction-based communication with subprocesses.
973 * Network:: Opening network connections.
974 * Network Servers:: Network servers let Emacs accept net connections.
975 * Datagrams:: UDP network connections.
976 * Low-Level Network:: Lower-level but more general function
977 to create connections and servers.
978 * Misc Network:: Additional relevant functions for network connections.
979 * Byte Packing:: Using bindat to pack and unpack binary data.
980
981 Receiving Output from Processes
982
983 * Process Buffers:: If no filter, output is put in a buffer.
984 * Filter Functions:: Filter functions accept output from the process.
985 * Decoding Output:: Filters can get unibyte or multibyte strings.
986 * Accepting Output:: How to wait until process output arrives.
987
988 Emacs Display
989
990 * Refresh Screen:: Clearing the screen and redrawing everything on it.
991 * Forcing Redisplay:: Forcing redisplay.
992 * Truncation:: Folding or wrapping long text lines.
993 * The Echo Area:: Displaying messages at the bottom of the screen.
994 * Warnings:: Displaying warning messages for the user.
995 * Invisible Text:: Hiding part of the buffer text.
996 * Selective Display:: Hiding part of the buffer text (the old way).
997 * Temporary Displays:: Displays that go away automatically.
998 * Overlays:: Use overlays to highlight parts of the buffer.
999 * Width:: How wide a character or string is on the screen.
1000 * Line Height:: Controlling the height of lines.
1001 * Faces:: A face defines a graphics style
1002 for text characters: font, colors, etc.
1003 * Fringes:: Controlling window fringes.
1004 * Scroll Bars:: Controlling vertical scroll bars.
1005 * Pointer Shape:: Controlling the mouse pointer shape.
1006 * Display Property:: Enabling special display features.
1007 * Images:: Displaying images in Emacs buffers.
1008 * Buttons:: Adding clickable buttons to Emacs buffers.
1009 * Blinking:: How Emacs shows the matching open parenthesis.
1010 * Usual Display:: The usual conventions for displaying nonprinting chars.
1011 * Display Tables:: How to specify other conventions.
1012 * Beeping:: Audible signal to the user.
1013 * Window Systems:: Which window system is being used.
1014
1015 Operating System Interface
1016
1017 * Starting Up:: Customizing Emacs start-up processing.
1018 * Getting Out:: How exiting works (permanent or temporary).
1019 * System Environment:: Distinguish the name and kind of system.
1020 * User Identification:: Finding the name and user id of the user.
1021 * Time of Day:: Getting the current time.
1022 * Time Conversion:: Converting a time from numeric form to a string, or
1023 to calendrical data (or vice versa).
1024 * Time Parsing:: Converting a time from numeric form to text
1025 and vice versa.
1026 * Processor Run Time:: Getting the run time used by Emacs.
1027 * Time Calculations:: Adding, subtracting, comparing times, etc.
1028 * Timers:: Setting a timer to call a function at a certain time.
1029 * Terminal Input:: Recording terminal input for debugging.
1030 * Terminal Output:: Recording terminal output for debugging.
1031 * Sound Output:: Playing sounds on the computer's speaker.
1032 * X11 Keysyms:: Operating on key symbols for X Windows
1033 * Batch Mode:: Running Emacs without terminal interaction.
1034 * Session Management:: Saving and restoring state with X Session Management.
1035
1036 Starting Up Emacs
1037
1038 * Startup Summary:: Sequence of actions Emacs performs at start-up.
1039 * Init File:: Details on reading the init file (@file{.emacs}).
1040 * Terminal-Specific:: How the terminal-specific Lisp file is read.
1041 * Command-Line Arguments:: How command line arguments are processed,
1042 and how you can customize them.
1043
1044 Getting out of Emacs
1045
1046 * Killing Emacs:: Exiting Emacs irreversibly.
1047 * Suspending Emacs:: Exiting Emacs reversibly.
1048
1049 Tips and Conventions
1050
1051 * Coding Conventions:: Conventions for clean and robust programs.
1052 * Key Binding Conventions:: Which keys should be bound by which programs.
1053 * Programming Tips:: Making Emacs code fit smoothly in Emacs.
1054 * Compilation Tips:: Making compiled code run fast.
1055 * Warning Tips:: Turning off compiler warnings.
1056 * Documentation Tips:: Writing readable documentation strings.
1057 * Comment Tips:: Conventions for writing comments.
1058 * Library Headers:: Standard headers for library packages.
1059
1060 GNU Emacs Internals
1061
1062 * Building Emacs:: How to preload Lisp libraries into Emacs.
1063 * Pure Storage:: A kludge to make preloaded Lisp functions sharable.
1064 * Garbage Collection:: Reclaiming space for Lisp objects no longer used.
1065 * Memory Usage:: Info about total size of Lisp objects made so far.
1066 * Writing Emacs Primitives:: Writing C code for Emacs.
1067 * Object Internals:: Data formats of buffers, windows, processes.
1068
1069 Object Internals
1070
1071 * Buffer Internals:: Components of a buffer structure.
1072 * Window Internals:: Components of a window structure.
1073 * Process Internals:: Components of a process structure.
1074 @end menu
1075
1076 @include intro.texi
1077 @include objects.texi
1078 @include numbers.texi
1079 @include strings.texi
1080
1081 @include lists.texi
1082 @include sequences.texi
1083 @include hash.texi
1084 @include symbols.texi
1085 @include eval.texi
1086
1087 @include control.texi
1088 @include variables.texi
1089 @include functions.texi
1090 @include macros.texi
1091
1092 @include customize.texi
1093 @include loading.texi
1094 @include compile.texi
1095 @include advice.texi
1096
1097 @include debugging.texi
1098 @include streams.texi
1099 @include minibuf.texi
1100 @include commands.texi
1101
1102 @include keymaps.texi
1103 @include modes.texi
1104 @include help.texi
1105 @include files.texi
1106
1107 @include backups.texi
1108 @include buffers.texi
1109 @include windows.texi
1110 @include frames.texi
1111
1112 @include positions.texi
1113 @include markers.texi
1114 @include text.texi
1115 @include nonascii.texi
1116
1117 @include searching.texi
1118 @include syntax.texi
1119 @include abbrevs.texi
1120 @include processes.texi
1121
1122 @include display.texi
1123 @include os.texi
1124
1125 @c MOVE to Emacs Manual: include misc-modes.texi
1126
1127 @c appendices
1128
1129 @c REMOVE this: include non-hacker.texi
1130
1131 @include anti.texi
1132 @include doclicense.texi
1133 @include gpl.texi
1134 @include tips.texi
1135 @include internals.texi
1136 @include errors.texi
1137 @include locals.texi
1138 @include maps.texi
1139 @include hooks.texi
1140
1141 @include index.texi
1142
1143 @node New Symbols, , Index, Top
1144 @unnumbered New Symbols Since the Previous Edition
1145
1146 @printindex tp
1147
1148 @bye
1149
1150 \f
1151 These words prevent "local variables" above from confusing Emacs.
1152
1153 @ignore
1154 arch-tag: f7e9a219-a0e1-4776-b631-08eaa1d49b34
1155 @end ignore