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