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