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,
169 * New Symbols:: New functions and variables in Emacs @value{EMACSVER}.
171 Detailed Node Listing
172 ---------------------
174 Here are other nodes that are inferiors of those already listed,
175 mentioned here so you can get to them in one step:
179 * Caveats:: Flaws and a request for help.
180 * Lisp History:: Emacs Lisp is descended from Maclisp.
181 * Conventions:: How the manual is formatted.
182 * Version Info:: Which Emacs version is running?
183 * Acknowledgements:: The authors, editors, and sponsors of this manual.
187 * Some Terms:: Explanation of terms we use in this manual.
188 * nil and t:: How the symbols @code{nil} and @code{t} are used.
189 * Evaluation Notation:: The format we use for examples of evaluation.
190 * Printing Notation:: The format we use for examples that print output.
191 * Error Messages:: The format we use for examples of errors.
192 * Buffer Text Notation:: The format we use for buffer contents in examples.
193 * Format of Descriptions:: Notation for describing functions, variables, etc.
195 Format of Descriptions
197 * A Sample Function Description::
198 * A Sample Variable Description::
202 * Printed Representation:: How Lisp objects are represented as text.
203 * Comments:: Comments and their formatting conventions.
204 * Programming Types:: Types found in all Lisp systems.
205 * Editing Types:: Types specific to Emacs.
206 * Circular Objects:: Read syntax for circular structure.
207 * Type Predicates:: Tests related to types.
208 * Equality Predicates:: Tests of equality between any two objects.
212 * Integer Type:: Numbers without fractional parts.
213 * Floating Point Type:: Numbers with fractional parts and with a large range.
214 * Character Type:: The representation of letters, numbers and
216 * Symbol Type:: A multi-use object that refers to a function,
217 variable, property list, or itself.
218 * Sequence Type:: Both lists and arrays are classified as sequences.
219 * Cons Cell Type:: Cons cells, and lists (which are made from cons cells).
220 * Array Type:: Arrays include strings and vectors.
221 * String Type:: An (efficient) array of characters.
222 * Vector Type:: One-dimensional arrays.
223 * Char-Table Type:: One-dimensional sparse arrays indexed by characters.
224 * Bool-Vector Type:: One-dimensional arrays of @code{t} or @code{nil}.
225 * Hash Table Type:: Super-fast lookup tables.
226 * Function Type:: A piece of executable code you can call from elsewhere.
227 * Macro Type:: A method of expanding an expression into another
228 expression, more fundamental but less pretty.
229 * Primitive Function Type:: A function written in C, callable from Lisp.
230 * Byte-Code Type:: A function written in Lisp, then compiled.
231 * Autoload Type:: A type used for automatically loading seldom-used
234 Cons Cell and List Types
236 * Box Diagrams:: Drawing pictures of lists.
237 * Dotted Pair Notation:: An alternative syntax for lists.
238 * Association List Type:: A specially constructed list.
242 * Buffer Type:: The basic object of editing.
243 * Marker Type:: A position in a buffer.
244 * Window Type:: What makes buffers visible.
245 * Frame Type:: Windows subdivide frames.
246 * Window Configuration Type::Save what the screen looks like.
247 * Frame Configuration Type::Recording the status of all frames.
248 * Process Type:: A process running on the underlying OS.
249 * Stream Type:: Receive or send characters.
250 * Keymap Type:: What function a keystroke invokes.
251 * Overlay Type:: How an overlay is represented.
255 * Integer Basics:: Representation and range of integers.
256 * Float Basics:: Representation and range of floating point.
257 * Predicates on Numbers:: Testing for numbers.
258 * Comparison of Numbers:: Equality and inequality predicates.
259 * Numeric Conversions:: Converting float to integer and vice versa.
260 * Arithmetic Operations:: How to add, subtract, multiply and divide.
261 * Rounding Operations:: Explicitly rounding floating point numbers.
262 * Bitwise Operations:: Logical and, or, not, shifting.
263 * Math Functions:: Trig, exponential and logarithmic functions.
264 * Random Numbers:: Obtaining random integers, predictable or not.
266 Strings and Characters
268 * String Basics:: Basic properties of strings and characters.
269 * Predicates for Strings:: Testing whether an object is a string or char.
270 * Creating Strings:: Functions to allocate new strings.
271 * Modifying Strings:: Altering the contents of an existing string.
272 * Text Comparison:: Comparing characters or strings.
273 * String Conversion:: Converting characters or strings and vice versa.
274 * Formatting Strings:: @code{format}: Emacs's analogue of @code{printf}.
275 * Case Conversion:: Case conversion functions.
276 * Case Tables:: Customizing case conversion.
280 * Cons Cells:: How lists are made out of cons cells.
281 * List-related Predicates:: Is this object a list? Comparing two lists.
282 * List Elements:: Extracting the pieces of a list.
283 * Building Lists:: Creating list structure.
284 * Modifying Lists:: Storing new pieces into an existing list.
285 * Sets And Lists:: A list can represent a finite mathematical set.
286 * Association Lists:: A list can represent a finite relation or mapping.
287 * Rings:: Managing a fixed-size ring of objects.
289 Modifying Existing List Structure
291 * Setcar:: Replacing an element in a list.
292 * Setcdr:: Replacing part of the list backbone.
293 This can be used to remove or add elements.
294 * Rearrangement:: Reordering the elements in a list; combining lists.
296 Sequences, Arrays, and Vectors
298 * Sequence Functions:: Functions that accept any kind of sequence.
299 * Arrays:: Characteristics of arrays in Emacs Lisp.
300 * Array Functions:: Functions specifically for arrays.
301 * Vectors:: Functions specifically for vectors.
302 * Vector Functions:: Functions specifically for vectors.
303 * Char-Tables:: How to work with char-tables.
304 * Bool-Vectors:: How to work with bool-vectors.
308 * Creating Hash:: Functions to create hash tables.
309 * Hash Access:: Reading and writing the hash table contents.
310 * Defining Hash:: Defining new comparison methods
311 * Other Hash:: Miscellaneous.
315 * Symbol Components:: Symbols have names, values, function definitions
317 * Definitions:: A definition says how a symbol will be used.
318 * Creating Symbols:: How symbols are kept unique.
319 * Property Lists:: Each symbol has a property list
320 for recording miscellaneous information.
324 * Intro Eval:: Evaluation in the scheme of things.
325 * Forms:: How various sorts of objects are evaluated.
326 * Quoting:: Avoiding evaluation (to put constants in
328 * Eval:: How to invoke the Lisp interpreter explicitly.
332 * Self-Evaluating Forms:: Forms that evaluate to themselves.
333 * Symbol Forms:: Symbols evaluate as variables.
334 * Classifying Lists:: How to distinguish various sorts of list forms.
335 * Function Indirection:: When a symbol appears as the car of a list,
336 we find the real function via the symbol.
337 * Function Forms:: Forms that call functions.
338 * Macro Forms:: Forms that call macros.
339 * Special Forms:: ``Special forms'' are idiosyncratic primitives,
340 most of them extremely important.
341 * Autoloading:: Functions set up to load files
342 containing their real definitions.
346 * Sequencing:: Evaluation in textual order.
347 * Conditionals:: @code{if}, @code{cond}, @code{when}, @code{unless}.
348 * Combining Conditions:: @code{and}, @code{or}, @code{not}.
349 * Iteration:: @code{while} loops.
350 * Nonlocal Exits:: Jumping out of a sequence.
354 * Catch and Throw:: Nonlocal exits for the program's own purposes.
355 * Examples of Catch:: Showing how such nonlocal exits can be written.
356 * Errors:: How errors are signaled and handled.
357 * Cleanups:: Arranging to run a cleanup form if an
362 * Signaling Errors:: How to report an error.
363 * Processing of Errors:: What Emacs does when you report an error.
364 * Handling Errors:: How you can trap errors and continue execution.
365 * Error Symbols:: How errors are classified for trapping them.
369 * Global Variables:: Variable values that exist permanently, everywhere.
370 * Constant Variables:: Certain "variables" have values that never change.
371 * Local Variables:: Variable values that exist only temporarily.
372 * Void Variables:: Symbols that lack values.
373 * Defining Variables:: A definition says a symbol is used as a variable.
374 * Tips for Defining:: Things you should think about when you
376 * Accessing Variables:: Examining values of variables whose names
377 are known only at run time.
378 * Setting Variables:: Storing new values in variables.
379 * Variable Scoping:: How Lisp chooses among local and global values.
380 * Buffer-Local Variables:: Variable values in effect only in one buffer.
381 * Frame-Local Variables:: Variable values in effect only in one frame.
382 * Future Local Variables:: New kinds of local values we might add some day.
383 * File Local Variables:: Handling local variable lists in files.
384 * Variable Aliases:: Variables that are aliases for other variables.
385 * Variables with Restricted Values:: Non-constant variables whose value can
386 @emph{not} be an arbitrary Lisp object.
388 Scoping Rules for Variable Bindings
390 * Scope:: Scope means where in the program a value
391 is visible. Comparison with other languages.
392 * Extent:: Extent means how long in time a value exists.
393 * Impl of Scope:: Two ways to implement dynamic scoping.
394 * Using Scoping:: How to use dynamic scoping carefully and
397 Buffer-Local Variables
399 * Intro to Buffer-Local:: Introduction and concepts.
400 * Creating Buffer-Local:: Creating and destroying buffer-local bindings.
401 * Default Value:: The default value is seen in buffers
402 that don't have their own buffer-local values.
406 * What Is a Function:: Lisp functions vs primitives; terminology.
407 * Lambda Expressions:: How functions are expressed as Lisp objects.
408 * Function Names:: A symbol can serve as the name of a function.
409 * Defining Functions:: Lisp expressions for defining functions.
410 * Calling Functions:: How to use an existing function.
411 * Mapping Functions:: Applying a function to each element of a list, etc.
412 * Anonymous Functions:: Lambda-expressions are functions with no names.
413 * Function Cells:: Accessing or setting the function definition
415 * Obsolete Functions:: Declaring functions obsolete.
416 * Inline Functions:: Defining functions that the compiler will open code.
417 * Function Safety:: Determining whether a function is safe to call.
418 * Related Topics:: Cross-references to specific Lisp primitives
419 that have a special bearing on how
424 * Lambda Components:: The parts of a lambda expression.
425 * Simple Lambda:: A simple example.
426 * Argument List:: Details and special features of argument lists.
427 * Function Documentation:: How to put documentation in a function.
431 * Simple Macro:: A basic example.
432 * Expansion:: How, when and why macros are expanded.
433 * Compiling Macros:: How macros are expanded by the compiler.
434 * Defining Macros:: How to write a macro definition.
435 * Backquote:: Easier construction of list structure.
436 * Problems with Macros:: Don't evaluate the macro arguments too many times.
437 Don't hide the user's variables.
438 * Indenting Macros:: Specifying how to indent macro calls.
440 Writing Customization Definitions
442 * Common Keywords:: Common keyword arguments for all kinds of
443 customization declarations.
444 * Group Definitions:: Writing customization group definitions.
445 * Variable Definitions:: Declaring user options.
446 * Customization Types:: Specifying the type of a user option.
450 * How Programs Do Loading:: The @code{load} function and others.
451 * Load Suffixes:: Details about the suffixes that @code{load} tries.
452 * Library Search:: Finding a library to load.
453 * Loading Non-ASCII:: Non-@acronym{ASCII} characters in Emacs Lisp files.
454 * Autoload:: Setting up a function to autoload.
455 * Repeated Loading:: Precautions about loading a file twice.
456 * Named Features:: Loading a library if it isn't already loaded.
457 * Where Defined:: Finding which file defined a certain symbol.
458 * Unloading:: How to ``unload'' a library that was loaded.
459 * Hooks for Loading:: Providing code to be run when
460 particular libraries are loaded.
464 * Speed of Byte-Code:: An example of speedup from byte compilation.
465 * Compilation Functions:: Byte compilation functions.
466 * Docs and Compilation:: Dynamic loading of documentation strings.
467 * Dynamic Loading:: Dynamic loading of individual functions.
468 * Eval During Compile:: Code to be evaluated when you compile.
469 * Compiler Errors:: Handling compiler error messages.
470 * Byte-Code Objects:: The data type used for byte-compiled functions.
471 * Disassembly:: Disassembling byte-code; how to read byte-code.
473 Advising Emacs Lisp Functions
475 * Simple Advice:: A simple example to explain the basics of advice.
476 * Defining Advice:: Detailed description of @code{defadvice}.
477 * Around-Advice:: Wrapping advice around a function's definition.
478 * Computed Advice:: ...is to @code{defadvice} as @code{fset} is to @code{defun}.
479 * Activation of Advice:: Advice doesn't do anything until you activate it.
480 * Enabling Advice:: You can enable or disable each piece of advice.
481 * Preactivation:: Preactivation is a way of speeding up the
482 loading of compiled advice.
483 * Argument Access in Advice:: How advice can access the function's arguments.
484 * Advising Primitives:: Accessing arguments when advising a primitive.
485 * Combined Definition:: How advice is implemented.
487 Debugging Lisp Programs
489 * Debugger:: How the Emacs Lisp debugger is implemented.
490 * Edebug:: A source-level Emacs Lisp debugger.
491 * Syntax Errors:: How to find syntax errors.
492 * Test Coverage:: Ensuring you have tested all branches in your code.
493 * Compilation Errors:: How to find errors that show up in
498 * Error Debugging:: Entering the debugger when an error happens.
499 * Infinite Loops:: Stopping and debugging a program that doesn't exit.
500 * Function Debugging:: Entering it when a certain function is called.
501 * Explicit Debug:: Entering it at a certain point in the program.
502 * Using Debugger:: What the debugger does; what you see while in it.
503 * Debugger Commands:: Commands used while in the debugger.
504 * Invoking the Debugger:: How to call the function @code{debug}.
505 * Internals of Debugger:: Subroutines of the debugger, and global variables.
509 * Using Edebug:: Introduction to use of Edebug.
510 * Instrumenting:: You must instrument your code
511 in order to debug it with Edebug.
512 * Edebug Execution Modes:: Execution modes, stopping more or less often.
513 * Jumping:: Commands to jump to a specified place.
514 * Edebug Misc:: Miscellaneous commands.
515 * Breaks:: Setting breakpoints to make the program stop.
516 * Trapping Errors:: Trapping errors with Edebug.
517 * Edebug Views:: Views inside and outside of Edebug.
518 * Edebug Eval:: Evaluating expressions within Edebug.
519 * Eval List:: Expressions whose values are displayed
520 each time you enter Edebug.
521 * Printing in Edebug:: Customization of printing.
522 * Trace Buffer:: How to produce trace output in a buffer.
523 * Coverage Testing:: How to test evaluation coverage.
524 * The Outside Context:: Data that Edebug saves and restores.
525 * Edebug and Macros:: Specifying how to handle macro calls.
526 * Edebug Options:: Option variables for customizing Edebug.
528 Debugging Invalid Lisp Syntax
530 * Excess Open:: How to find a spurious open paren or missing close.
531 * Excess Close:: How to find a spurious close paren or missing open.
533 Reading and Printing Lisp Objects
535 * Streams Intro:: Overview of streams, reading and printing.
536 * Input Streams:: Various data types that can be used as
538 * Input Functions:: Functions to read Lisp objects from text.
539 * Output Streams:: Various data types that can be used as
541 * Output Functions:: Functions to print Lisp objects as text.
542 * Output Variables:: Variables that control what the printing
547 * Intro to Minibuffers:: Basic information about minibuffers.
548 * Text from Minibuffer:: How to read a straight text string.
549 * Object from Minibuffer:: How to read a Lisp object or expression.
550 * Minibuffer History:: Recording previous minibuffer inputs
551 so the user can reuse them.
552 * Initial Input:: Specifying initial contents for the minibuffer.
553 * Completion:: How to invoke and customize completion.
554 * Yes-or-No Queries:: Asking a question with a simple answer.
555 * Multiple Queries:: Asking a series of similar questions.
556 * Reading a Password:: Reading a password from the terminal.
557 * Minibuffer Commands:: Commands used as key bindings in minibuffers.
558 * Minibuffer Contents:: How such commands access the minibuffer text.
559 * Minibuffer Windows:: Operating on the special minibuffer windows.
560 * Recursive Mini:: Whether recursive entry to minibuffer is allowed.
561 * Minibuffer Misc:: Various customization hooks and variables.
565 * Basic Completion:: Low-level functions for completing strings.
566 (These are too low level to use the minibuffer.)
567 * Minibuffer Completion:: Invoking the minibuffer with completion.
568 * Completion Commands:: Minibuffer commands that do completion.
569 * High-Level Completion:: Convenient special cases of completion
570 (reading buffer name, file name, etc.)
571 * Reading File Names:: Using completion to read file names.
572 * Programmed Completion:: Finding the completions for a given file name.
576 * Command Overview:: How the command loop reads commands.
577 * Defining Commands:: Specifying how a function should read arguments.
578 * Interactive Call:: Calling a command, so that it will read arguments.
579 * Command Loop Info:: Variables set by the command loop for you to examine.
580 * Adjusting Point:: Adjustment of point after a command.
581 * Input Events:: What input looks like when you read it.
582 * Reading Input:: How to read input events from the keyboard or mouse.
583 * Special Events:: Events processed immediately and individually.
584 * Waiting:: Waiting for user input or elapsed time.
585 * Quitting:: How @kbd{C-g} works. How to catch or defer quitting.
586 * Prefix Command Arguments:: How the commands to set prefix args work.
587 * Recursive Editing:: Entering a recursive edit,
588 and why you usually shouldn't.
589 * Disabling Commands:: How the command loop handles disabled commands.
590 * Command History:: How the command history is set up, and how accessed.
591 * Keyboard Macros:: How keyboard macros are implemented.
595 * Using Interactive:: General rules for @code{interactive}.
596 * Interactive Codes:: The standard letter-codes for reading arguments
598 * Interactive Examples:: Examples of how to read interactive arguments.
602 * Key Sequences:: Key sequences as Lisp objects.
603 * Keymap Basics:: Basic concepts of keymaps.
604 * Format of Keymaps:: What a keymap looks like as a Lisp object.
605 * Creating Keymaps:: Functions to create and copy keymaps.
606 * Inheritance and Keymaps:: How one keymap can inherit the bindings
608 * Prefix Keys:: Defining a key with a keymap as its definition.
609 * Active Keymaps:: Each buffer has a local keymap
610 to override the standard (global) bindings.
611 Each minor mode can also override them.
612 * Key Lookup:: How extracting elements from keymaps works.
613 * Functions for Key Lookup:: How to request key lookup.
614 * Changing Key Bindings:: Redefining a key in a keymap.
615 * Remapping Commands:: Bindings that translate one command to another.
616 * Key Binding Commands:: Interactive interfaces for redefining keys.
617 * Scanning Keymaps:: Looking through all keymaps, for printing help.
618 * Menu Keymaps:: A keymap can define a menu for X
619 or for use from the terminal.
621 Major and Minor Modes
623 * Hooks:: How to use hooks; how to write code that
625 * Major Modes:: Defining major modes.
626 * Minor Modes:: Defining minor modes.
627 * Mode Line Format:: Customizing the text that appears in the mode line.
628 * Imenu:: How a mode can provide a menu
629 of definitions in the buffer.
630 * Font Lock Mode:: How modes can highlight text according to syntax.
631 * Desktop Save Mode:: How modes can have buffer state saved between
636 * Major Mode Basics::
637 * Major Mode Conventions:: Coding conventions for keymaps, etc.
638 * Example Major Modes:: Text mode and Lisp modes.
639 * Auto Major Mode:: How Emacs chooses the major mode automatically.
640 * Mode Help:: Finding out how to use a mode.
641 * Derived Modes:: Defining a new major mode based on another major
643 * Generic Modes:: Defining a simple major mode that supports
644 comment syntax and Font Lock mode.
645 * Mode Hooks:: Hooks run at the end of major mode functions.
649 * Minor Mode Conventions:: Tips for writing a minor mode.
650 * Keymaps and Minor Modes:: How a minor mode can have its own keymap.
651 * Defining Minor Modes:: A convenient facility for defining minor modes.
656 * Mode Line Data:: The data structure that controls the mode line.
657 * Mode Line Variables:: Variables used in that data structure.
658 * %-Constructs:: Putting information into a mode line.
659 * Properties in Mode:: Using text properties in the mode line.
660 * Header Lines:: Like a mode line, but at the top.
661 * Emulating Mode Line:: Formatting text as the mode line would.
665 * Documentation Basics:: Good style for doc strings.
666 Where to put them. How Emacs stores them.
667 * Accessing Documentation:: How Lisp programs can access doc strings.
668 * Keys in Documentation:: Substituting current key bindings.
669 * Describing Characters:: Making printable descriptions of
670 non-printing characters and key sequences.
671 * Help Functions:: Subroutines used by Emacs help facilities.
675 * Visiting Files:: Reading files into Emacs buffers for editing.
676 * Saving Buffers:: Writing changed buffers back into files.
677 * Reading from Files:: Reading files into other buffers.
678 * Writing to Files:: Writing new files from parts of buffers.
679 * File Locks:: Locking and unlocking files, to prevent
680 simultaneous editing by two people.
681 * Information about Files:: Testing existence, accessibility, size of files.
682 * Changing Files:: Renaming files, changing protection, etc.
683 * File Names:: Decomposing and expanding file names.
684 * Contents of Directories:: Getting a list of the files in a directory.
685 * Create/Delete Dirs:: Creating and Deleting Directories.
686 * Magic File Names:: Defining "magic" special handling
687 for certain file names.
688 * Format Conversion:: Conversion to and from various file formats.
692 * Visiting Functions:: The usual interface functions for visiting.
693 * Subroutines of Visiting:: Lower-level subroutines that they use.
695 Information about Files
697 * Testing Accessibility:: Is a given file readable? Writable?
698 * Kinds of Files:: Is it a directory? A symbolic link?
699 * Truenames:: Eliminating symbolic links from a file name.
700 * File Attributes:: How large is it? Any other names? Etc.
704 * File Name Components:: The directory part of a file name, and the rest.
705 * Relative File Names:: Some file names are relative to a
707 * Directory Names:: A directory's name as a directory
708 is different from its name as a file.
709 * File Name Expansion:: Converting relative file names to absolute ones.
710 * Unique File Names:: Generating names for temporary files.
711 * File Name Completion:: Finding the completions for a given file name.
712 * Standard File Names:: If your package uses a fixed file name,
713 how to handle various operating systems simply.
715 Backups and Auto-Saving
717 * Backup Files:: How backup files are made; how their names
719 * Auto-Saving:: How auto-save files are made; how their
721 * Reverting:: @code{revert-buffer}, and how to customize
726 * Making Backups:: How Emacs makes backup files, and when.
727 * Rename or Copy:: Two alternatives: renaming the old file
729 * Numbered Backups:: Keeping multiple backups for each source file.
730 * Backup Names:: How backup file names are computed; customization.
734 * Buffer Basics:: What is a buffer?
735 * Current Buffer:: Designating a buffer as current
736 so primitives will access its contents.
737 * Buffer Names:: Accessing and changing buffer names.
738 * Buffer File Name:: The buffer file name indicates which file
740 * Buffer Modification:: A buffer is @dfn{modified} if it needs to be saved.
741 * Modification Time:: Determining whether the visited file was changed
742 ``behind Emacs's back''.
743 * Read Only Buffers:: Modifying text is not allowed in a
745 * The Buffer List:: How to look at all the existing buffers.
746 * Creating Buffers:: Functions that create buffers.
747 * Killing Buffers:: Buffers exist until explicitly killed.
748 * Indirect Buffers:: An indirect buffer shares text with some
750 * Buffer Gap:: The gap in the buffer.
754 * Basic Windows:: Basic information on using windows.
755 * Splitting Windows:: Splitting one window into two windows.
756 * Deleting Windows:: Deleting a window gives its space to other windows.
757 * Selecting Windows:: The selected window is the one that you edit in.
758 * Cyclic Window Ordering:: Moving around the existing windows.
759 * Buffers and Windows:: Each window displays the contents of a buffer.
760 * Displaying Buffers:: Higher-lever functions for displaying a buffer
761 and choosing a window for it.
762 * Choosing Window:: How to choose a window for displaying a buffer.
763 * Window Point:: Each window has its own location of point.
764 * Window Start:: The display-start position controls which text
765 is on-screen in the window.
766 * Textual Scrolling:: Moving text up and down through the window.
767 * Vertical Scrolling:: Moving the contents up and down on the window.
768 * Horizontal Scrolling:: Moving the contents sideways on the window.
769 * Size of Window:: Accessing the size of a window.
770 * Resizing Windows:: Changing the size of a window.
771 * Coordinates and Windows:: Converting coordinates to windows.
772 * Window Configurations:: Saving and restoring the state of the screen.
773 * Window Hooks:: Hooks for scrolling, window size changes,
774 redisplay going past a certain point,
775 or window configuration changes.
779 * Creating Frames:: Creating additional frames.
780 * Multiple Displays:: Creating frames on other X displays.
781 * Frame Parameters:: Controlling frame size, position, font, etc.
782 * Frame Titles:: Automatic updating of frame titles.
783 * Deleting Frames:: Frames last until explicitly deleted.
784 * Finding All Frames:: How to examine all existing frames.
785 * Frames and Windows:: A frame contains windows;
786 display of text always works through windows.
787 * Minibuffers and Frames:: How a frame finds the minibuffer to use.
788 * Input Focus:: Specifying the selected frame.
789 * Visibility of Frames:: Frames may be visible or invisible, or icons.
790 * Raising and Lowering:: Raising a frame makes it hide other X windows;
791 lowering it puts it underneath the others.
792 * Frame Configurations:: Saving the state of all frames.
793 * Mouse Tracking:: Getting events that say when the mouse moves.
794 * Mouse Position:: Asking where the mouse is, or moving it.
795 * Pop-Up Menus:: Displaying a menu for the user to select from.
796 * Dialog Boxes:: Displaying a box to ask yes or no.
797 * Pointer Shape:: Specifying the shape of the mouse pointer.
798 * Window System Selections::Transferring text to and from other windows.
799 * Color Names:: Getting the definitions of color names.
800 * Text Terminal Colors:: Defining colors for text-only terminals.
801 * Resources:: Getting resource values from the server.
802 * Display Feature Testing:: Determining the features of a terminal.
806 * Point:: The special position where editing takes place.
807 * Motion:: Changing point.
808 * Excursions:: Temporary motion and buffer changes.
809 * Narrowing:: Restricting editing to a portion of the buffer.
813 * Character Motion:: Moving in terms of characters.
814 * Word Motion:: Moving in terms of words.
815 * Buffer End Motion:: Moving to the beginning or end of the buffer.
816 * Text Lines:: Moving in terms of lines of text.
817 * Screen Lines:: Moving in terms of lines as displayed.
818 * List Motion:: Moving by parsing lists and sexps.
819 * Skipping Characters:: Skipping characters belonging to a certain set.
823 * Overview of Markers:: The components of a marker, and how it relocates.
824 * Predicates on Markers:: Testing whether an object is a marker.
825 * Creating Markers:: Making empty markers or markers at certain places.
826 * Information from Markers::Finding the marker's buffer or character
828 * Marker Insertion Types:: Two ways a marker can relocate when you
829 insert where it points.
830 * Moving Markers:: Moving the marker to a new buffer or position.
831 * The Mark:: How ``the mark'' is implemented with a marker.
832 * The Region:: How to access ``the region''.
836 * Near Point:: Examining text in the vicinity of point.
837 * Buffer Contents:: Examining text in a general fashion.
838 * Comparing Text:: Comparing substrings of buffers.
839 * Insertion:: Adding new text to a buffer.
840 * Commands for Insertion:: User-level commands to insert text.
841 * Deletion:: Removing text from a buffer.
842 * User-Level Deletion:: User-level commands to delete text.
843 * The Kill Ring:: Where removed text sometimes is saved for
845 * Undo:: Undoing changes to the text of a buffer.
846 * Maintaining Undo:: How to enable and disable undo information.
847 How to control how much information is kept.
848 * Filling:: Functions for explicit filling.
849 * Margins:: How to specify margins for filling commands.
850 * Adaptive Fill:: Adaptive Fill mode chooses a fill prefix
852 * Auto Filling:: How auto-fill mode is implemented to break lines.
853 * Sorting:: Functions for sorting parts of the buffer.
854 * Columns:: Computing horizontal positions, and using them.
855 * Indentation:: Functions to insert or adjust indentation.
856 * Case Changes:: Case conversion of parts of the buffer.
857 * Text Properties:: Assigning Lisp property lists to text characters.
858 * Substitution:: Replacing a given character wherever it appears.
859 * Transposition:: Swapping two portions of a buffer.
860 * Registers:: How registers are implemented. Accessing
861 the text or position stored in a register.
862 * Base 64:: Conversion to or from base 64 encoding.
863 * MD5 Checksum:: Compute the MD5 ``message digest''/``checksum''.
864 * Atomic Changes:: Installing several buffer changes ``atomically''.
865 * Change Hooks:: Supplying functions to be run when text is changed.
869 * Kill Ring Concepts:: What text looks like in the kill ring.
870 * Kill Functions:: Functions that kill text.
871 * Yanking:: How yanking is done.
872 * Yank Commands:: Commands that access the kill ring.
873 * Low-Level Kill Ring:: Functions and variables for kill ring access.
874 * Internals of Kill Ring:: Variables that hold kill-ring data.
878 * Primitive Indent:: Functions used to count and insert indentation.
879 * Mode-Specific Indent:: Customize indentation for different modes.
880 * Region Indent:: Indent all the lines in a region.
881 * Relative Indent:: Indent the current line based on previous lines.
882 * Indent Tabs:: Adjustable, typewriter-like tab stops.
883 * Motion by Indent:: Move to first non-blank character.
887 * Examining Properties:: Looking at the properties of one character.
888 * Changing Properties:: Setting the properties of a range of text.
889 * Property Search:: Searching for where a property changes value.
890 * Special Properties:: Particular properties with special meanings.
891 * Format Properties:: Properties for representing formatting of text.
892 * Sticky Properties:: How inserted text gets properties from
894 * Saving Properties:: Saving text properties in files, and reading
896 * Lazy Properties:: Computing text properties in a lazy fashion
897 only when text is examined.
898 * Clickable Text:: Using text properties to make regions of text
899 do something when you click on them.
900 * Links and Mouse-1:: How to make @key{Mouse-1} follow a link.
901 * Fields:: The @code{field} property defines
902 fields within the buffer.
903 * Not Intervals:: Why text properties do not use
904 Lisp-visible text intervals.
908 * Text Representations:: Unibyte and multibyte representations
909 * Converting Representations:: Converting unibyte to multibyte and vice versa.
910 * Selecting a Representation:: Treating a byte sequence as unibyte or multi.
911 * Character Codes:: How unibyte and multibyte relate to
912 codes of individual characters.
913 * Character Sets:: The space of possible characters codes
914 is divided into various character sets.
915 * Chars and Bytes:: More information about multibyte encodings.
916 * Splitting Characters:: Converting a character to its byte sequence.
917 * Scanning Charsets:: Which character sets are used in a buffer?
918 * Translation of Characters:: Translation tables are used for conversion.
919 * Coding Systems:: Coding systems are conversions for saving files.
920 * Input Methods:: Input methods allow users to enter various
921 non-ASCII characters without special keyboards.
922 * Locales:: Interacting with the POSIX locale.
924 Searching and Matching
926 * String Search:: Search for an exact match.
927 * Searching and Case:: Case-independent or case-significant searching.
928 * Regular Expressions:: Describing classes of strings.
929 * Regexp Search:: Searching for a match for a regexp.
930 * POSIX Regexps:: Searching POSIX-style for the longest match.
931 * Match Data:: Finding out which part of the text matched,
932 after a string or regexp search.
933 * Search and Replace:: Commands that loop, searching and replacing.
934 * Standard Regexps:: Useful regexps for finding sentences, pages,...
938 * Syntax of Regexps:: Rules for writing regular expressions.
939 * Regexp Example:: Illustrates regular expression syntax.
940 * Regexp Functions:: Functions for operating on regular expressions.
944 * Syntax Basics:: Basic concepts of syntax tables.
945 * Syntax Descriptors:: How characters are classified.
946 * Syntax Table Functions:: How to create, examine and alter syntax tables.
947 * Syntax Properties:: Overriding syntax with text properties.
948 * Motion and Syntax:: Moving over characters with certain syntaxes.
949 * Parsing Expressions:: Parsing balanced expressions
950 using the syntax table.
951 * Standard Syntax Tables:: Syntax tables used by various major modes.
952 * Syntax Table Internals:: How syntax table information is stored.
953 * Categories:: Another way of classifying character syntax.
957 * Syntax Class Table:: Table of syntax classes.
958 * Syntax Flags:: Additional flags each character can have.
960 Abbrevs And Abbrev Expansion
962 * Abbrev Mode:: Setting up Emacs for abbreviation.
963 * Abbrev Tables:: Creating and working with abbrev tables.
964 * Defining Abbrevs:: Specifying abbreviations and their expansions.
965 * Abbrev Files:: Saving abbrevs in files.
966 * Abbrev Expansion:: Controlling expansion; expansion subroutines.
967 * Standard Abbrev Tables:: Abbrev tables used by various major modes.
971 * Subprocess Creation:: Functions that start subprocesses.
972 * Shell Arguments:: Quoting an argument to pass it to a shell.
973 * Synchronous Processes:: Details of using synchronous subprocesses.
974 * Asynchronous Processes:: Starting up an asynchronous subprocess.
975 * Deleting Processes:: Eliminating an asynchronous subprocess.
976 * Process Information:: Accessing run-status and other attributes.
977 * Input to Processes:: Sending input to an asynchronous subprocess.
978 * Signals to Processes:: Stopping, continuing or interrupting
979 an asynchronous subprocess.
980 * Output from Processes:: Collecting output from an asynchronous subprocess.
981 * Sentinels:: Sentinels run when process run-status changes.
982 * Query Before Exit:: Whether to query if exiting will kill a process.
983 * Transaction Queues:: Transaction-based communication with subprocesses.
984 * Network:: Opening network connections.
985 * Network Servers:: Network servers let Emacs accept net connections.
986 * Datagrams:: UDP network connections.
987 * Low-Level Network:: Lower-level but more general function
988 to create connections and servers.
989 * Misc Network:: Additional relevant functions for network connections.
990 * Byte Packing:: Using bindat to pack and unpack binary data.
992 Receiving Output from Processes
994 * Process Buffers:: If no filter, output is put in a buffer.
995 * Filter Functions:: Filter functions accept output from the process.
996 * Decoding Output:: Filters can get unibyte or multibyte strings.
997 * Accepting Output:: How to wait until process output arrives.
1001 * Refresh Screen:: Clearing the screen and redrawing everything on it.
1002 * Forcing Redisplay:: Forcing redisplay.
1003 * Truncation:: Folding or wrapping long text lines.
1004 * The Echo Area:: Displaying messages at the bottom of the screen.
1005 * Warnings:: Displaying warning messages for the user.
1006 * Invisible Text:: Hiding part of the buffer text.
1007 * Selective Display:: Hiding part of the buffer text (the old way).
1008 * Temporary Displays:: Displays that go away automatically.
1009 * Overlays:: Use overlays to highlight parts of the buffer.
1010 * Width:: How wide a character or string is on the screen.
1011 * Line Height:: Controlling the height of lines.
1012 * Faces:: A face defines a graphics style
1013 for text characters: font, colors, etc.
1014 * Fringes:: Controlling window fringes.
1015 * Scroll Bars:: Controlling vertical scroll bars.
1016 * Display Property:: Enabling special display features.
1017 * Images:: Displaying images in Emacs buffers.
1018 * Buttons:: Adding clickable buttons to Emacs buffers.
1019 * Abstract Display:: Emacs' Widget for Object Collections.
1020 * Blinking:: How Emacs shows the matching open parenthesis.
1021 * Usual Display:: The usual conventions for displaying nonprinting chars.
1022 * Display Tables:: How to specify other conventions.
1023 * Beeping:: Audible signal to the user.
1024 * Window Systems:: Which window system is being used.
1026 Operating System Interface
1028 * Starting Up:: Customizing Emacs start-up processing.
1029 * Getting Out:: How exiting works (permanent or temporary).
1030 * System Environment:: Distinguish the name and kind of system.
1031 * User Identification:: Finding the name and user id of the user.
1032 * Time of Day:: Getting the current time.
1033 * Time Conversion:: Converting a time from numeric form to a string, or
1034 to calendrical data (or vice versa).
1035 * Time Parsing:: Converting a time from numeric form to text
1037 * Processor Run Time:: Getting the run time used by Emacs.
1038 * Time Calculations:: Adding, subtracting, comparing times, etc.
1039 * Timers:: Setting a timer to call a function at a certain time.
1040 * Terminal Input:: Recording terminal input for debugging.
1041 * Terminal Output:: Recording terminal output for debugging.
1042 * Sound Output:: Playing sounds on the computer's speaker.
1043 * X11 Keysyms:: Operating on key symbols for X Windows
1044 * Batch Mode:: Running Emacs without terminal interaction.
1045 * Session Management:: Saving and restoring state with X Session Management.
1049 * Startup Summary:: Sequence of actions Emacs performs at start-up.
1050 * Init File:: Details on reading the init file (@file{.emacs}).
1051 * Terminal-Specific:: How the terminal-specific Lisp file is read.
1052 * Command-Line Arguments:: How command line arguments are processed,
1053 and how you can customize them.
1055 Getting out of Emacs
1057 * Killing Emacs:: Exiting Emacs irreversibly.
1058 * Suspending Emacs:: Exiting Emacs reversibly.
1060 Tips and Conventions
1062 * Coding Conventions:: Conventions for clean and robust programs.
1063 * Key Binding Conventions:: Which keys should be bound by which programs.
1064 * Programming Tips:: Making Emacs code fit smoothly in Emacs.
1065 * Compilation Tips:: Making compiled code run fast.
1066 * Warning Tips:: Turning off compiler warnings.
1067 * Documentation Tips:: Writing readable documentation strings.
1068 * Comment Tips:: Conventions for writing comments.
1069 * Library Headers:: Standard headers for library packages.
1073 * Building Emacs:: How to preload Lisp libraries into Emacs.
1074 * Pure Storage:: A kludge to make preloaded Lisp functions sharable.
1075 * Garbage Collection:: Reclaiming space for Lisp objects no longer used.
1076 * Memory Usage:: Info about total size of Lisp objects made so far.
1077 * Writing Emacs Primitives:: Writing C code for Emacs.
1078 * Object Internals:: Data formats of buffers, windows, processes.
1082 * Buffer Internals:: Components of a buffer structure.
1083 * Window Internals:: Components of a window structure.
1084 * Process Internals:: Components of a process structure.
1088 @include objects.texi
1089 @include numbers.texi
1090 @include strings.texi
1093 @include sequences.texi
1095 @include symbols.texi
1098 @include control.texi
1099 @include variables.texi
1100 @include functions.texi
1101 @include macros.texi
1103 @include customize.texi
1104 @include loading.texi
1105 @include compile.texi
1106 @include advice.texi
1108 @include debugging.texi
1109 @include streams.texi
1110 @include minibuf.texi
1111 @include commands.texi
1113 @include keymaps.texi
1118 @include backups.texi
1119 @include buffers.texi
1120 @include windows.texi
1121 @include frames.texi
1123 @include positions.texi
1124 @include markers.texi
1126 @include nonascii.texi
1128 @include searching.texi
1129 @include syntax.texi
1130 @include abbrevs.texi
1131 @include processes.texi
1133 @include display.texi
1136 @c MOVE to Emacs Manual: include misc-modes.texi
1140 @c REMOVE this: include non-hacker.texi
1143 @include doclicense.texi
1146 @include internals.texi
1147 @include errors.texi
1148 @include locals.texi
1154 @node New Symbols, , Index, Top
1155 @unnumbered New Symbols Since the Previous Edition
1162 These words prevent "local variables" above from confusing Emacs.
1165 arch-tag: f7e9a219-a0e1-4776-b631-08eaa1d49b34