This is ../info/elisp, produced by makeinfo version 4.11 from
elisp.texi.

INFO-DIR-SECTION Emacs
START-INFO-DIR-ENTRY
* Elisp: (elisp).       The Emacs Lisp Reference Manual.
END-INFO-DIR-ENTRY

   This is edition 2.9 of the GNU Emacs Lisp Reference Manual,
corresponding to Emacs version 22.3.

   Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999,
2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008  Free Software
Foundation, Inc.

     Permission is granted to copy, distribute and/or modify this
     document under the terms of the GNU Free Documentation License,
     Version 1.2 or any later version published by the Free Software
     Foundation; with the Invariant Sections being "GNU General Public
     License," with the Front-Cover texts being "A GNU Manual," and
     with the Back-Cover Texts as in (a) below.  A copy of the license
     is included in the section entitled "GNU Free Documentation
     License."

     (a) The FSF's Back-Cover Text is: "You are free to copy and modify
     this GNU Manual. Buying copies from GNU Press supports the FSF in
     developing GNU and promoting software freedom."


File: elisp,  Node: Active Display Table,  Next: Glyphs,  Prev: Display Table Format,  Up: Display Tables

38.21.2 Active Display Table
----------------------------

Each window can specify a display table, and so can each buffer.  When
a buffer B is displayed in window W, display uses the display table for
window W if it has one; otherwise, the display table for buffer B if it
has one; otherwise, the standard display table if any.  The display
table chosen is called the "active" display table.

 -- Function: window-display-table &optional window
     This function returns WINDOW's display table, or `nil' if WINDOW
     does not have an assigned display table.  The default for WINDOW
     is the selected window.

 -- Function: set-window-display-table window table
     This function sets the display table of WINDOW to TABLE.  The
     argument TABLE should be either a display table or `nil'.

 -- Variable: buffer-display-table
     This variable is automatically buffer-local in all buffers; its
     value in a particular buffer specifies the display table for that
     buffer.  If it is `nil', that means the buffer does not have an
     assigned display table.

 -- Variable: standard-display-table
     This variable's value is the default display table, used whenever a
     window has no display table and neither does the buffer displayed
     in that window.  This variable is `nil' by default.

   If there is no display table to use for a particular window--that is,
if the window specifies none, its buffer specifies none, and
`standard-display-table' is `nil'--then Emacs uses the usual display
conventions for all character codes in that window.  *Note Usual
Display::.

   A number of functions for changing the standard display table are
defined in the library `disp-table'.


File: elisp,  Node: Glyphs,  Prev: Active Display Table,  Up: Display Tables

38.21.3 Glyphs
--------------

A "glyph" is a generalization of a character; it stands for an image
that takes up a single character position on the screen.  Normally
glyphs come from vectors in the display table (*note Display Tables::).

   A glyph is represented in Lisp as a "glyph code".  A glyph code can
be "simple" or it can be defined by the "glyph table".  A simple glyph
code is just a way of specifying a character and a face to output it
in.  *Note Faces::.

   The following functions are used to manipulate simple glyph codes:

 -- Function: make-glyph-code char &optional face
     This function returns a simple glyph code representing char CHAR
     with face FACE.

 -- Function: glyph-char glyph
     This function returns the character of simple glyph code GLYPH.

 -- Function: glyph-face glyph
     This function returns face of simple glyph code GLYPH, or `nil' if
     GLYPH has the default face (face-id 0).

   On character terminals, you can set up a "glyph table" to define the
meaning of glyph codes (represented as small integers).

 -- Variable: glyph-table
     The value of this variable is the current glyph table.  It should
     be `nil' or a vector whose Gth element defines glyph code G.

     If a glyph code is greater than or equal to the length of the glyph
     table, that code is automatically simple.  If `glyph-table' is
     `nil' then all glyph codes are simple.

     The glyph table is used only on character terminals.  On graphical
     displays, all glyph codes are simple.

   Here are the meaningful types of elements in the glyph table:

STRING
     Send the characters in STRING to the terminal to output this glyph
     code.

CODE
     Define this glyph code as an alias for glyph code CODE created by
     `make-glyph-code'.  You can use such an alias to define a
     small-numbered glyph code which specifies a character with a face.

`nil'
     This glyph code is simple.

 -- Function: create-glyph string
     This function returns a newly-allocated glyph code which is set up
     to display by sending STRING to the terminal.


File: elisp,  Node: Beeping,  Next: Window Systems,  Prev: Display Tables,  Up: Display

38.22 Beeping
=============

This section describes how to make Emacs ring the bell (or blink the
screen) to attract the user's attention.  Be conservative about how
often you do this; frequent bells can become irritating.  Also be
careful not to use just beeping when signaling an error is more
appropriate.  (*Note Errors::.)

 -- Function: ding &optional do-not-terminate
     This function beeps, or flashes the screen (see `visible-bell'
     below).  It also terminates any keyboard macro currently executing
     unless DO-NOT-TERMINATE is non-`nil'.

 -- Function: beep &optional do-not-terminate
     This is a synonym for `ding'.

 -- User Option: visible-bell
     This variable determines whether Emacs should flash the screen to
     represent a bell.  Non-`nil' means yes, `nil' means no.  This is
     effective on graphical displays, and on text-only terminals
     provided the terminal's Termcap entry defines the visible bell
     capability (`vb').

 -- Variable: ring-bell-function
     If this is non-`nil', it specifies how Emacs should "ring the
     bell."  Its value should be a function of no arguments.  If this is
     non-`nil', it takes precedence over the `visible-bell' variable.


File: elisp,  Node: Window Systems,  Prev: Beeping,  Up: Display

38.23 Window Systems
====================

Emacs works with several window systems, most notably the X Window
System.  Both Emacs and X use the term "window," but use it
differently.  An Emacs frame is a single window as far as X is
concerned; the individual Emacs windows are not known to X at all.

 -- Variable: window-system
     This variable tells Lisp programs what window system Emacs is
     running under.  The possible values are

    `x'
          Emacs is displaying using X.

    `pc'
          Emacs is displaying using MS-DOS.

    `w32'
          Emacs is displaying using Windows.

    `mac'
          Emacs is displaying using a Macintosh.

    `nil'
          Emacs is using a character-based terminal.

 -- Variable: window-setup-hook
     This variable is a normal hook which Emacs runs after handling the
     initialization files.  Emacs runs this hook after it has completed
     loading your init file, the default initialization file (if any),
     and the terminal-specific Lisp code, and running the hook
     `term-setup-hook'.

     This hook is used for internal purposes: setting up communication
     with the window system, and creating the initial window.  Users
     should not interfere with it.


File: elisp,  Node: System Interface,  Next: Antinews,  Prev: Display,  Up: Top

39 Operating System Interface
*****************************

This chapter is about starting and getting out of Emacs, access to
values in the operating system environment, and terminal input, output,
and flow control.

   *Note Building Emacs::, for related information.  See also *note
Display::, for additional operating system status information
pertaining to the terminal and the screen.

* Menu:

* Starting Up::         Customizing Emacs startup processing.
* Getting Out::         How exiting works (permanent or temporary).
* System Environment::  Distinguish the name and kind of system.
* User Identification:: Finding the name and user id of the user.
* Time of Day::		Getting the current time.
* Time Conversion::     Converting a time from numeric form
                          to calendrical data, and vice versa).
* Time Parsing::        Converting a time from numeric form to text
                          and vice versa.
* Processor Run Time::  Getting the run time used by Emacs.
* Time Calculations::   Adding, subtracting, comparing times, etc.
* Timers::		Setting a timer to call a function at a certain time.
* Idle Timers::         Setting a timer to call a function when Emacs has
                          been idle for a certain length of time.
* Terminal Input::      Accessing and recording terminal input.
* Terminal Output::     Controlling and recording terminal output.
* Sound Output::        Playing sounds on the computer's speaker.
* X11 Keysyms::         Operating on key symbols for X Windows
* Batch Mode::          Running Emacs without terminal interaction.
* Session Management::  Saving and restoring state with X Session Management.


File: elisp,  Node: Starting Up,  Next: Getting Out,  Up: System Interface

39.1 Starting Up Emacs
======================

This section describes what Emacs does when it is started, and how you
can customize these actions.

* Menu:

* Startup Summary::         Sequence of actions Emacs performs at startup.
* Init File::               Details on reading the init file (`.emacs').
* Terminal-Specific::       How the terminal-specific Lisp file is read.
* Command-Line Arguments::  How command-line arguments are processed,
                              and how you can customize them.


File: elisp,  Node: Startup Summary,  Next: Init File,  Up: Starting Up

39.1.1 Summary: Sequence of Actions at Startup
----------------------------------------------

The order of operations performed (in `startup.el') by Emacs when it is
started up is as follows:

  1. It adds subdirectories to `load-path', by running the file named
     `subdirs.el' in each directory in the list.  Normally this file
     adds the directory's subdirectories to the list, and these will be
     scanned in their turn.  The files `subdirs.el' are normally
     generated automatically by Emacs installation.

  2. It sets the language environment and the terminal coding system,
     if requested by environment variables such as `LANG'.

  3. It loads the initialization library for the window system, if you
     are using a window system.  This library's name is
     `term/WINDOWSYSTEM-win.el'.

  4. It processes the initial options.  (Some of them are handled even
     earlier than this.)

  5. It initializes the window frame and faces, if appropriate.

  6. It runs the normal hook `before-init-hook'.

  7. It loads the library `site-start' (if any), unless the option `-Q'
     (or `--no-site-file') was specified.  The library's file name is
     usually `site-start.el'.  

  8. It loads your init file (usually `~/.emacs'), unless the option
     `-q' (or `--no-init-file'), `-Q', or `--batch' was specified on
     the command line.  The `-u' option can specify another user whose
     home directory should be used instead of `~'.

  9. It loads the library `default' (if any), unless
     `inhibit-default-init' is non-`nil'.  (This is not done in
     `-batch' mode, or if `-Q' or `-q' was specified on the command
     line.)  The library's file name is usually `default.el'.  

 10. It runs the normal hook `after-init-hook'.

 11. It sets the major mode according to `initial-major-mode', provided
     the buffer `*scratch*' is still current and still in Fundamental
     mode.

 12. It loads the terminal-specific Lisp file, if any, except when in
     batch mode or using a window system.

 13. It displays the initial echo area message, unless you have
     suppressed that with `inhibit-startup-echo-area-message'.

 14. It processes the action arguments from the command line.

 15. It runs `emacs-startup-hook' and then `term-setup-hook'.

 16. It calls `frame-notice-user-settings', which modifies the
     parameters of the selected frame according to whatever the init
     files specify.

 17. It runs `window-setup-hook'.  *Note Window Systems::.

 18. It displays copyleft, nonwarranty, and basic use information,
     provided the value of `inhibit-startup-message' is `nil', you
     didn't specify `--no-splash' or `-Q'.

 -- User Option: inhibit-startup-message
     This variable inhibits the initial startup messages (the
     nonwarranty, etc.).  If it is non-`nil', then the messages are not
     printed.

     This variable exists so you can set it in your personal init file,
     once you are familiar with the contents of the startup message.
     Do not set this variable in the init file of a new user, or in a
     way that affects more than one user, because that would prevent
     new users from receiving the information they are supposed to see.

 -- User Option: inhibit-startup-echo-area-message
     This variable controls the display of the startup echo area
     message.  You can suppress the startup echo area message by adding
     text with this form to your init file:

          (setq inhibit-startup-echo-area-message
                "YOUR-LOGIN-NAME")

     Emacs explicitly checks for an expression as shown above in your
     init file; your login name must appear in the expression as a Lisp
     string constant.  Other methods of setting
     `inhibit-startup-echo-area-message' to the same value do not
     inhibit the startup message.

     This way, you can easily inhibit the message for yourself if you
     wish, but thoughtless copying of your init file will not inhibit
     the message for someone else.


File: elisp,  Node: Init File,  Next: Terminal-Specific,  Prev: Startup Summary,  Up: Starting Up

39.1.2 The Init File, `.emacs'
------------------------------

When you start Emacs, it normally attempts to load your "init file", a
file in your home directory.  Its normal name is `.emacs', but you can
also call it `.emacs.el'.  Alternatively, you can use a file named
`init.el' in a subdirectory `.emacs.d'.  Whichever place you use, you
can also compile the file (*note Byte Compilation::); then the actual
file loaded will be `.emacs.elc' or `init.elc'.

   The command-line switches `-q', `-Q', and `-u' control whether and
where to find the init file; `-q' (and the stronger `-Q') says not to
load an init file, while `-u USER' says to load USER's init file
instead of yours.  *Note Entering Emacs: (emacs)Entering Emacs.  If
neither option is specified, Emacs uses the `LOGNAME' environment
variable, or the `USER' (most systems) or `USERNAME' (MS systems)
variable, to find your home directory and thus your init file; this
way, even if you have su'd, Emacs still loads your own init file.  If
those environment variables are absent, though, Emacs uses your user-id
to find your home directory.

   A site may have a "default init file", which is the library named
`default.el'.  Emacs finds the `default.el' file through the standard
search path for libraries (*note How Programs Do Loading::).  The Emacs
distribution does not come with this file; sites may provide one for
local customizations.  If the default init file exists, it is loaded
whenever you start Emacs, except in batch mode or if `-q' (or `-Q') is
specified.  But your own personal init file, if any, is loaded first;
if it sets `inhibit-default-init' to a non-`nil' value, then Emacs does
not subsequently load the `default.el' file.

   Another file for site-customization is `site-start.el'.  Emacs loads
this _before_ the user's init file.  You can inhibit the loading of
this file with the option `--no-site-file'.

 -- Variable: site-run-file
     This variable specifies the site-customization file to load before
     the user's init file.  Its normal value is `"site-start"'.  The
     only way you can change it with real effect is to do so before
     dumping Emacs.

   *Note Init File Examples: (emacs)Init Examples, for examples of how
to make various commonly desired customizations in your `.emacs' file.

 -- User Option: inhibit-default-init
     This variable prevents Emacs from loading the default
     initialization library file for your session of Emacs.  If its
     value is non-`nil', then the default library is not loaded.  The
     default value is `nil'.

 -- Variable: before-init-hook
     This normal hook is run, once, just before loading all the init
     files (the user's init file, `default.el', and/or `site-start.el').
     (The only way to change it with real effect is before dumping
     Emacs.)

 -- Variable: after-init-hook
     This normal hook is run, once, just after loading all the init
     files (the user's init file, `default.el', and/or `site-start.el'),
     before loading the terminal-specific library and processing the
     command-line action arguments.

 -- Variable: emacs-startup-hook
     This normal hook is run, once, just after handling the command line
     arguments, just before `term-setup-hook'.

 -- Variable: user-init-file
     This variable holds the absolute file name of the user's init
     file.  If the actual init file loaded is a compiled file, such as
     `.emacs.elc', the value refers to the corresponding source file.


File: elisp,  Node: Terminal-Specific,  Next: Command-Line Arguments,  Prev: Init File,  Up: Starting Up

39.1.3 Terminal-Specific Initialization
---------------------------------------

Each terminal type can have its own Lisp library that Emacs loads when
run on that type of terminal.  The library's name is constructed by
concatenating the value of the variable `term-file-prefix' and the
terminal type (specified by the environment variable `TERM').
Normally, `term-file-prefix' has the value `"term/"'; changing this is
not recommended.  Emacs finds the file in the normal manner, by
searching the `load-path' directories, and trying the `.elc' and `.el'
suffixes.

   The usual function of a terminal-specific library is to enable
special keys to send sequences that Emacs can recognize.  It may also
need to set or add to `function-key-map' if the Termcap or Terminfo
entry does not specify all the terminal's function keys.  *Note
Terminal Input::.

   When the name of the terminal type contains a hyphen, and no library
is found whose name is identical to the terminal's name, Emacs strips
from the terminal's name the last hyphen and everything that follows
it, and tries again.  This process is repeated until Emacs finds a
matching library or until there are no more hyphens in the name (the
latter means the terminal doesn't have any library specific to it).
Thus, for example, if there are no `aaa-48' and `aaa-30' libraries,
Emacs will try the same library `term/aaa.el' for terminal types
`aaa-48' and `aaa-30-rv'.  If necessary, the library can evaluate
`(getenv "TERM")' to find the full name of the terminal type.

   Your init file can prevent the loading of the terminal-specific
library by setting the variable `term-file-prefix' to `nil'.  This
feature is useful when experimenting with your own peculiar
customizations.

   You can also arrange to override some of the actions of the
terminal-specific library by setting the variable `term-setup-hook'.
This is a normal hook which Emacs runs using `run-hooks' at the end of
Emacs initialization, after loading both your init file and any
terminal-specific libraries.  You can use this variable to define
initializations for terminals that do not have their own libraries.
*Note Hooks::.

 -- Variable: term-file-prefix
     If the `term-file-prefix' variable is non-`nil', Emacs loads a
     terminal-specific initialization file as follows:

          (load (concat term-file-prefix (getenv "TERM")))

     You may set the `term-file-prefix' variable to `nil' in your init
     file if you do not wish to load the terminal-initialization file.
     To do this, put the following in your init file: `(setq
     term-file-prefix nil)'.

     On MS-DOS, if the environment variable `TERM' is not set, Emacs
     uses `internal' as the terminal type.

 -- Variable: term-setup-hook
     This variable is a normal hook that Emacs runs after loading your
     init file, the default initialization file (if any) and the
     terminal-specific Lisp file.

     You can use `term-setup-hook' to override the definitions made by a
     terminal-specific file.

   See `window-setup-hook' in *note Window Systems::, for a related
feature.


File: elisp,  Node: Command-Line Arguments,  Prev: Terminal-Specific,  Up: Starting Up

39.1.4 Command-Line Arguments
-----------------------------

You can use command-line arguments to request various actions when you
start Emacs.  Since you do not need to start Emacs more than once per
day, and will often leave your Emacs session running longer than that,
command-line arguments are hardly ever used.  As a practical matter, it
is best to avoid making the habit of using them, since this habit would
encourage you to kill and restart Emacs unnecessarily often.  These
options exist for two reasons: to be compatible with other editors (for
invocation by other programs) and to enable shell scripts to run
specific Lisp programs.

   This section describes how Emacs processes command-line arguments,
and how you can customize them.

 -- Function: command-line
     This function parses the command line that Emacs was called with,
     processes it, loads the user's init file and displays the startup
     messages.

 -- Variable: command-line-processed
     The value of this variable is `t' once the command line has been
     processed.

     If you redump Emacs by calling `dump-emacs', you may wish to set
     this variable to `nil' first in order to cause the new dumped Emacs
     to process its new command-line arguments.

 -- Variable: command-switch-alist
     The value of this variable is an alist of user-defined command-line
     options and associated handler functions.  This variable exists so
     you can add elements to it.

     A "command-line option" is an argument on the command line, which
     has the form:

          -OPTION

     The elements of the `command-switch-alist' look like this:

          (OPTION . HANDLER-FUNCTION)

     The CAR, OPTION, is a string, the name of a command-line option
     (not including the initial hyphen).  The HANDLER-FUNCTION is
     called to handle OPTION, and receives the option name as its sole
     argument.

     In some cases, the option is followed in the command line by an
     argument.  In these cases, the HANDLER-FUNCTION can find all the
     remaining command-line arguments in the variable
     `command-line-args-left'.  (The entire list of command-line
     arguments is in `command-line-args'.)

     The command-line arguments are parsed by the `command-line-1'
     function in the `startup.el' file.  See also *note Command Line
     Arguments for Emacs Invocation: (emacs)Emacs Invocation.

 -- Variable: command-line-args
     The value of this variable is the list of command-line arguments
     passed to Emacs.

 -- Variable: command-line-functions
     This variable's value is a list of functions for handling an
     unrecognized command-line argument.  Each time the next argument
     to be processed has no special meaning, the functions in this list
     are called, in order of appearance, until one of them returns a
     non-`nil' value.

     These functions are called with no arguments.  They can access the
     command-line argument under consideration through the variable
     `argi', which is bound temporarily at this point.  The remaining
     arguments (not including the current one) are in the variable
     `command-line-args-left'.

     When a function recognizes and processes the argument in `argi', it
     should return a non-`nil' value to say it has dealt with that
     argument.  If it has also dealt with some of the following
     arguments, it can indicate that by deleting them from
     `command-line-args-left'.

     If all of these functions return `nil', then the argument is used
     as a file name to visit.


File: elisp,  Node: Getting Out,  Next: System Environment,  Prev: Starting Up,  Up: System Interface

39.2 Getting Out of Emacs
=========================

There are two ways to get out of Emacs: you can kill the Emacs job,
which exits permanently, or you can suspend it, which permits you to
reenter the Emacs process later.  As a practical matter, you seldom kill
Emacs--only when you are about to log out.  Suspending is much more
common.

* Menu:

* Killing Emacs::        Exiting Emacs irreversibly.
* Suspending Emacs::     Exiting Emacs reversibly.


File: elisp,  Node: Killing Emacs,  Next: Suspending Emacs,  Up: Getting Out

39.2.1 Killing Emacs
--------------------

Killing Emacs means ending the execution of the Emacs process.  The
parent process normally resumes control.  The low-level primitive for
killing Emacs is `kill-emacs'.

 -- Function: kill-emacs &optional exit-data
     This function exits the Emacs process and kills it.

     If EXIT-DATA is an integer, then it is used as the exit status of
     the Emacs process.  (This is useful primarily in batch operation;
     see *note Batch Mode::.)

     If EXIT-DATA is a string, its contents are stuffed into the
     terminal input buffer so that the shell (or whatever program next
     reads input) can read them.

   All the information in the Emacs process, aside from files that have
been saved, is lost when the Emacs process is killed.  Because killing
Emacs inadvertently can lose a lot of work, Emacs queries for
confirmation before actually terminating if you have buffers that need
saving or subprocesses that are running.  This is done in the function
`save-buffers-kill-emacs', the higher level function from which
`kill-emacs' is usually called.

 -- Variable: kill-emacs-query-functions
     After asking the standard questions, `save-buffers-kill-emacs'
     calls the functions in the list `kill-emacs-query-functions', in
     order of appearance, with no arguments.  These functions can ask
     for additional confirmation from the user.  If any of them returns
     `nil', `save-buffers-kill-emacs' does not kill Emacs, and does not
     run the remaining functions in this hook.  Calling `kill-emacs'
     directly does not run this hook.

 -- Variable: kill-emacs-hook
     This variable is a normal hook; once `save-buffers-kill-emacs' is
     finished with all file saving and confirmation, it calls
     `kill-emacs' which runs the functions in this hook.  `kill-emacs'
     does not run this hook in batch mode.

     `kill-emacs' may be invoked directly (that is not via
     `save-buffers-kill-emacs') if the terminal is disconnected, or in
     similar situations where interaction with the user is not possible.
     Thus, if your hook needs to interact with the user, put it on
     `kill-emacs-query-functions'; if it needs to run regardless of how
     Emacs is killed, put it on `kill-emacs-hook'.


File: elisp,  Node: Suspending Emacs,  Prev: Killing Emacs,  Up: Getting Out

39.2.2 Suspending Emacs
-----------------------

"Suspending Emacs" means stopping Emacs temporarily and returning
control to its superior process, which is usually the shell.  This
allows you to resume editing later in the same Emacs process, with the
same buffers, the same kill ring, the same undo history, and so on.  To
resume Emacs, use the appropriate command in the parent shell--most
likely `fg'.

   Some operating systems do not support suspension of jobs; on these
systems, "suspension" actually creates a new shell temporarily as a
subprocess of Emacs.  Then you would exit the shell to return to Emacs.

   Suspension is not useful with window systems, because the Emacs job
may not have a parent that can resume it again, and in any case you can
give input to some other job such as a shell merely by moving to a
different window.  Therefore, suspending is not allowed when Emacs is
using a window system (X, MS Windows, or Mac).

 -- Function: suspend-emacs &optional string
     This function stops Emacs and returns control to the superior
     process.  If and when the superior process resumes Emacs,
     `suspend-emacs' returns `nil' to its caller in Lisp.

     If STRING is non-`nil', its characters are sent to be read as
     terminal input by Emacs's superior shell.  The characters in
     STRING are not echoed by the superior shell; only the results
     appear.

     Before suspending, `suspend-emacs' runs the normal hook
     `suspend-hook'.

     After the user resumes Emacs, `suspend-emacs' runs the normal hook
     `suspend-resume-hook'.  *Note Hooks::.

     The next redisplay after resumption will redraw the entire screen,
     unless the variable `no-redraw-on-reenter' is non-`nil' (*note
     Refresh Screen::).

     In the following example, note that `pwd' is not echoed after
     Emacs is suspended.  But it is read and executed by the shell.

          (suspend-emacs)
               => nil

          (add-hook 'suspend-hook
                    (function (lambda ()
                                (or (y-or-n-p
                                      "Really suspend? ")
                                    (error "Suspend canceled")))))
               => (lambda nil
                    (or (y-or-n-p "Really suspend? ")
                        (error "Suspend canceled")))
          (add-hook 'suspend-resume-hook
                    (function (lambda () (message "Resumed!"))))
               => (lambda nil (message "Resumed!"))
          (suspend-emacs "pwd")
               => nil
          ---------- Buffer: Minibuffer ----------
          Really suspend? y
          ---------- Buffer: Minibuffer ----------

          ---------- Parent Shell ----------
          lewis@slug[23] % /user/lewis/manual
          lewis@slug[24] % fg

          ---------- Echo Area ----------
          Resumed!

 -- Variable: suspend-hook
     This variable is a normal hook that Emacs runs before suspending.

 -- Variable: suspend-resume-hook
     This variable is a normal hook that Emacs runs on resuming after a
     suspension.


File: elisp,  Node: System Environment,  Next: User Identification,  Prev: Getting Out,  Up: System Interface

39.3 Operating System Environment
=================================

Emacs provides access to variables in the operating system environment
through various functions.  These variables include the name of the
system, the user's UID, and so on.

 -- Variable: system-configuration
     This variable holds the standard GNU configuration name for the
     hardware/software configuration of your system, as a string.  The
     convenient way to test parts of this string is with `string-match'.

 -- Variable: system-type
     The value of this variable is a symbol indicating the type of
     operating system Emacs is operating on.  Here is a table of the
     possible values:

    `alpha-vms'
          VMS on the Alpha.

    `aix-v3'
          AIX.

    `berkeley-unix'
          Berkeley BSD.

    `cygwin'
          Cygwin.

    `dgux'
          Data General DGUX operating system.

    `gnu'
          the GNU system (using the GNU kernel, which consists of the
          HURD and Mach).

    `gnu/linux'
          A GNU/Linux system--that is, a variant GNU system, using the
          Linux kernel.  (These systems are the ones people often call
          "Linux," but actually Linux is just the kernel, not the whole
          system.)

    `hpux'
          Hewlett-Packard HPUX operating system.

    `irix'
          Silicon Graphics Irix system.

    `ms-dos'
          Microsoft MS-DOS "operating system."  Emacs compiled with
          DJGPP for MS-DOS binds `system-type' to `ms-dos' even when
          you run it on MS-Windows.

    `next-mach'
          NeXT Mach-based system.

    `rtu'
          Masscomp RTU, UCB universe.

    `unisoft-unix'
          UniSoft UniPlus.

    `usg-unix-v'
          AT&T System V.

    `vax-vms'
          VAX VMS.

    `windows-nt'
          Microsoft windows NT.  The same executable supports Windows
          9X, but the value of `system-type' is `windows-nt' in either
          case.

    `xenix'
          SCO Xenix 386.

     We do not wish to add new symbols to make finer distinctions
     unless it is absolutely necessary!  In fact, we hope to eliminate
     some of these alternatives in the future.  We recommend using
     `system-configuration' to distinguish between different operating
     systems.

 -- Function: system-name
     This function returns the name of the machine you are running on.
          (system-name)
               => "www.gnu.org"

   The symbol `system-name' is a variable as well as a function.  In
fact, the function returns whatever value the variable `system-name'
currently holds.  Thus, you can set the variable `system-name' in case
Emacs is confused about the name of your system.  The variable is also
useful for constructing frame titles (*note Frame Titles::).

 -- Variable: mail-host-address
     If this variable is non-`nil', it is used instead of `system-name'
     for purposes of generating email addresses.  For example, it is
     used when constructing the default value of `user-mail-address'.
     *Note User Identification::.  (Since this is done when Emacs
     starts up, the value actually used is the one saved when Emacs was
     dumped.  *Note Building Emacs::.)

 -- Command: getenv var
     This function returns the value of the environment variable VAR,
     as a string.  VAR should be a string.  If VAR is undefined in the
     environment, `getenv' returns `nil'.  If returns `""' if VAR is
     set but null.  Within Emacs, the environment variable values are
     kept in the Lisp variable `process-environment'.

          (getenv "USER")
               => "lewis"

          lewis@slug[10] % printenv
          PATH=.:/user/lewis/bin:/usr/bin:/usr/local/bin
          USER=lewis
          TERM=ibmapa16
          SHELL=/bin/csh
          HOME=/user/lewis

 -- Command: setenv variable &optional value
     This command sets the value of the environment variable named
     VARIABLE to VALUE.  VARIABLE should be a string.  Internally,
     Emacs Lisp can handle any string.  However, normally VARIABLE
     should be a valid shell identifier, that is, a sequence of
     letters, digits and underscores, starting with a letter or
     underscore.  Otherwise, errors may occur if subprocesses of Emacs
     try to access the value of VARIABLE.  If VALUE is omitted or
     `nil', `setenv' removes VARIABLE from the environment.  Otherwise,
     VALUE should be a string.

     `setenv' works by modifying `process-environment'; binding that
     variable with `let' is also reasonable practice.

     `setenv' returns the new value of VARIABLE, or `nil' if it removed
     VARIABLE from the environment.

 -- Variable: process-environment
     This variable is a list of strings, each describing one environment
     variable.  The functions `getenv' and `setenv' work by means of
     this variable.

          process-environment
          => ("l=/usr/stanford/lib/gnuemacs/lisp"
              "PATH=.:/user/lewis/bin:/usr/class:/nfsusr/local/bin"
              "USER=lewis"
              "TERM=ibmapa16"
              "SHELL=/bin/csh"
              "HOME=/user/lewis")

     If `process-environment' contains "duplicate" elements that
     specify the same environment variable, the first of these elements
     specifies the variable, and the other "duplicates" are ignored.

 -- Variable: path-separator
     This variable holds a string which says which character separates
     directories in a search path (as found in an environment
     variable).  Its value is `":"' for Unix and GNU systems, and `";"'
     for MS-DOS and MS-Windows.

 -- Function: parse-colon-path path
     This function takes a search path string such as would be the
     value of the `PATH' environment variable, and splits it at the
     separators, returning a list of directory names.  `nil' in this
     list stands for "use the current directory."  Although the
     function's name says "colon," it actually uses the value of
     `path-separator'.

          (parse-colon-path ":/foo:/bar")
               => (nil "/foo/" "/bar/")

 -- Variable: invocation-name
     This variable holds the program name under which Emacs was
     invoked.  The value is a string, and does not include a directory
     name.

 -- Variable: invocation-directory
     This variable holds the directory from which the Emacs executable
     was invoked, or perhaps `nil' if that directory cannot be
     determined.

 -- Variable: installation-directory
     If non-`nil', this is a directory within which to look for the
     `lib-src' and `etc' subdirectories.  This is non-`nil' when Emacs
     can't find those directories in their standard installed
     locations, but can find them in a directory related somehow to the
     one containing the Emacs executable.

 -- Function: load-average &optional use-float
     This function returns the current 1-minute, 5-minute, and
     15-minute load averages, in a list.

     By default, the values are integers that are 100 times the system
     load averages, which indicate the average number of processes
     trying to run.  If USE-FLOAT is non-`nil', then they are returned
     as floating point numbers and without multiplying by 100.

     If it is impossible to obtain the load average, this function
     signals an error.  On some platforms, access to load averages
     requires installing Emacs as setuid or setgid so that it can read
     kernel information, and that usually isn't advisable.

     If the 1-minute load average is available, but the 5- or 15-minute
     averages are not, this function returns a shortened list containing
     the available averages.

          (load-average)
               => (169 48 36)
          (load-average t)
               => (1.69 0.48 0.36)

          lewis@rocky[5] % uptime
           11:55am  up 1 day, 19:37,  3 users,
           load average: 1.69, 0.48, 0.36

 -- Function: emacs-pid
     This function returns the process ID of the Emacs process, as an
     integer.

 -- Variable: tty-erase-char
     This variable holds the erase character that was selected in the
     system's terminal driver, before Emacs was started.  The value is
     `nil' if Emacs is running under a window system.

 -- Function: setprv privilege-name &optional setp getprv
     This function sets or resets a VMS privilege.  (It does not exist
     on other systems.)  The first argument is the privilege name, as a
     string.  The second argument, SETP, is `t' or `nil', indicating
     whether the privilege is to be turned on or off.  Its default is
     `nil'.  The function returns `t' if successful, `nil' otherwise.

     If the third argument, GETPRV, is non-`nil', `setprv' does not
     change the privilege, but returns `t' or `nil' indicating whether
     the privilege is currently enabled.


File: elisp,  Node: User Identification,  Next: Time of Day,  Prev: System Environment,  Up: System Interface

39.4 User Identification
========================

 -- Variable: init-file-user
     This variable says which user's init files should be used by
     Emacs--or `nil' if none.  `""' stands for the user who originally
     logged in.  The value reflects command-line options such as `-q'
     or `-u USER'.

     Lisp packages that load files of customizations, or any other sort
     of user profile, should obey this variable in deciding where to
     find it.  They should load the profile of the user name found in
     this variable.  If `init-file-user' is `nil', meaning that the `-q'
     option was used, then Lisp packages should not load any
     customization files or user profile.

 -- Variable: user-mail-address
     This holds the nominal email address of the user who is using
     Emacs.  Emacs normally sets this variable to a default value after
     reading your init files, but not if you have already set it.  So
     you can set the variable to some other value in your init file if
     you do not want to use the default value.

 -- Function: user-login-name &optional uid
     If you don't specify UID, this function returns the name under
     which the user is logged in.  If the environment variable `LOGNAME'
     is set, that value is used.  Otherwise, if the environment variable
     `USER' is set, that value is used.  Otherwise, the value is based
     on the effective UID, not the real UID.

     If you specify UID, the value is the user name that corresponds to
     UID (which should be an integer), or `nil' if there is no such
     user.

          (user-login-name)
               => "lewis"

 -- Function: user-real-login-name
     This function returns the user name corresponding to Emacs's real
     UID.  This ignores the effective UID and ignores the environment
     variables `LOGNAME' and `USER'.

 -- Function: user-full-name &optional uid
     This function returns the full name of the logged-in user--or the
     value of the environment variable `NAME', if that is set.

          (user-full-name)
               => "Bil Lewis"

     If the Emacs job's user-id does not correspond to any known user
     (and provided `NAME' is not set), the value is `"unknown"'.

     If UID is non-`nil', then it should be a number (a user-id) or a
     string (a login name).  Then `user-full-name' returns the full
     name corresponding to that user-id or login name.  If you specify a
     user-id or login name that isn't defined, it returns `nil'.

   The symbols `user-login-name', `user-real-login-name' and
`user-full-name' are variables as well as functions.  The functions
return the same values that the variables hold.  These variables allow
you to "fake out" Emacs by telling the functions what to return.  The
variables are also useful for constructing frame titles (*note Frame
Titles::).

 -- Function: user-real-uid
     This function returns the real UID of the user.  The value may be
     a floating point number.

          (user-real-uid)
               => 19

 -- Function: user-uid
     This function returns the effective UID of the user.  The value
     may be a floating point number.


File: elisp,  Node: Time of Day,  Next: Time Conversion,  Prev: User Identification,  Up: System Interface

39.5 Time of Day
================

This section explains how to determine the current time and the time
zone.

 -- Function: current-time-string &optional time-value
     This function returns the current time and date as a human-readable
     string.  The format of the string is unvarying; the number of
     characters used for each part is always the same, so you can
     reliably use `substring' to extract pieces of it.  It is wise to
     count the characters from the beginning of the string rather than
     from the end, as additional information may some day be added at
     the end.

     The argument TIME-VALUE, if given, specifies a time to format
     instead of the current time.  The argument should be a list whose
     first two elements are integers.  Thus, you can use times obtained
     from `current-time' (see below) and from `file-attributes' (*note
     Definition of file-attributes::).  TIME-VALUE can also be a cons
     of two integers, but this is considered obsolete.

          (current-time-string)
               => "Wed Oct 14 22:21:05 1987"

 -- Function: current-time
     This function returns the system's time value as a list of three
     integers: `(HIGH LOW MICROSEC)'.  The integers HIGH and LOW
     combine to give the number of seconds since 0:00 January 1, 1970
     UTC (Coordinated Universal Time), which is HIGH * 2**16 + LOW.

     The third element, MICROSEC, gives the microseconds since the
     start of the current second (or 0 for systems that return time with
     the resolution of only one second).

     The first two elements can be compared with file time values such
     as you get with the function `file-attributes'.  *Note Definition
     of file-attributes::.

 -- Function: current-time-zone &optional time-value
     This function returns a list describing the time zone that the
     user is in.

     The value has the form `(OFFSET NAME)'.  Here OFFSET is an integer
     giving the number of seconds ahead of UTC (east of Greenwich).  A
     negative value means west of Greenwich.  The second element, NAME,
     is a string giving the name of the time zone.  Both elements
     change when daylight saving time begins or ends; if the user has
     specified a time zone that does not use a seasonal time
     adjustment, then the value is constant through time.

     If the operating system doesn't supply all the information
     necessary to compute the value, the unknown elements of the list
     are `nil'.

     The argument TIME-VALUE, if given, specifies a time to analyze
     instead of the current time.  The argument should have the same
     form as for `current-time-string' (see above).  Thus, you can use
     times obtained from `current-time' (see above) and from
     `file-attributes'.  *Note Definition of file-attributes::.

 -- Function: set-time-zone-rule tz
     This function specifies the local time zone according to TZ.  If
     TZ is `nil', that means to use an implementation-defined default
     time zone.  If TZ is `t', that means to use Universal Time.
     Otherwise, TZ should be a string specifying a time zone rule.

 -- Function: float-time &optional time-value
     This function returns the current time as a floating-point number
     of seconds since the epoch.  The argument TIME-VALUE, if given,
     specifies a time to convert instead of the current time.  The
     argument should have the same form as for `current-time-string'
     (see above).  Thus, it accepts the output of `current-time' and
     `file-attributes'.

     _Warning_: Since the result is floating point, it may not be
     exact.  Do not use this function if precise time stamps are
     required.


File: elisp,  Node: Time Conversion,  Next: Time Parsing,  Prev: Time of Day,  Up: System Interface

39.6 Time Conversion
====================

These functions convert time values (lists of two or three integers) to
calendrical information and vice versa.  You can get time values from
the functions `current-time' (*note Time of Day::) and
`file-attributes' (*note Definition of file-attributes::).

   Many operating systems are limited to time values that contain 32
bits of information; these systems typically handle only the times from
1901-12-13 20:45:52 UTC through 2038-01-19 03:14:07 UTC.  However, some
operating systems have larger time values, and can represent times far
in the past or future.

   Time conversion functions always use the Gregorian calendar, even
for dates before the Gregorian calendar was introduced.  Year numbers
count the number of years since the year 1 B.C., and do not skip zero
as traditional Gregorian years do; for example, the year number -37
represents the Gregorian year 38 B.C.

 -- Function: decode-time &optional time
     This function converts a time value into calendrical information.
     If you don't specify TIME, it decodes the current time.  The return
     value is a list of nine elements, as follows:

          (SECONDS MINUTES HOUR DAY MONTH YEAR DOW DST ZONE)

     Here is what the elements mean:

    SECONDS
          The number of seconds past the minute, as an integer between
          0 and 59.  On some operating systems, this is 60 for leap
          seconds.

    MINUTES
          The number of minutes past the hour, as an integer between 0
          and 59.

    HOUR
          The hour of the day, as an integer between 0 and 23.

    DAY
          The day of the month, as an integer between 1 and 31.

    MONTH
          The month of the year, as an integer between 1 and 12.

    YEAR
          The year, an integer typically greater than 1900.

    DOW
          The day of week, as an integer between 0 and 6, where 0
          stands for Sunday.

    DST
          `t' if daylight saving time is effect, otherwise `nil'.

    ZONE
          An integer indicating the time zone, as the number of seconds
          east of Greenwich.

     *Common Lisp Note:* Common Lisp has different meanings for DOW and
     ZONE.

 -- Function: encode-time seconds minutes hour day month year &optional
          zone
     This function is the inverse of `decode-time'.  It converts seven
     items of calendrical data into a time value.  For the meanings of
     the arguments, see the table above under `decode-time'.

     Year numbers less than 100 are not treated specially.  If you want
     them to stand for years above 1900, or years above 2000, you must
     alter them yourself before you call `encode-time'.

     The optional argument ZONE defaults to the current time zone and
     its daylight saving time rules.  If specified, it can be either a
     list (as you would get from `current-time-zone'), a string as in
     the `TZ' environment variable, `t' for Universal Time, or an
     integer (as you would get from `decode-time').  The specified zone
     is used without any further alteration for daylight saving time.

     If you pass more than seven arguments to `encode-time', the first
     six are used as SECONDS through YEAR, the last argument is used as
     ZONE, and the arguments in between are ignored.  This feature
     makes it possible to use the elements of a list returned by
     `decode-time' as the arguments to `encode-time', like this:

          (apply 'encode-time (decode-time ...))

     You can perform simple date arithmetic by using out-of-range
     values for the SECONDS, MINUTES, HOUR, DAY, and MONTH arguments;
     for example, day 0 means the day preceding the given month.

     The operating system puts limits on the range of possible time
     values; if you try to encode a time that is out of range, an error
     results.  For instance, years before 1970 do not work on some
     systems; on others, years as early as 1901 do work.


File: elisp,  Node: Time Parsing,  Next: Processor Run Time,  Prev: Time Conversion,  Up: System Interface

39.7 Parsing and Formatting Times
=================================

These functions convert time values (lists of two or three integers) to
text in a string, and vice versa.

 -- Function: date-to-time string
     This function parses the time-string STRING and returns the
     corresponding time value.

 -- Function: format-time-string format-string &optional time universal
     This function converts TIME (or the current time, if TIME is
     omitted) to a string according to FORMAT-STRING.  The argument
     FORMAT-STRING may contain `%'-sequences which say to substitute
     parts of the time.  Here is a table of what the `%'-sequences mean:

    `%a'
          This stands for the abbreviated name of the day of week.

    `%A'
          This stands for the full name of the day of week.

    `%b'
          This stands for the abbreviated name of the month.

    `%B'
          This stands for the full name of the month.

    `%c'
          This is a synonym for `%x %X'.

    `%C'
          This has a locale-specific meaning.  In the default locale
          (named C), it is equivalent to `%A, %B %e, %Y'.

    `%d'
          This stands for the day of month, zero-padded.

    `%D'
          This is a synonym for `%m/%d/%y'.

    `%e'
          This stands for the day of month, blank-padded.

    `%h'
          This is a synonym for `%b'.

    `%H'
          This stands for the hour (00-23).

    `%I'
          This stands for the hour (01-12).

    `%j'
          This stands for the day of the year (001-366).

    `%k'
          This stands for the hour (0-23), blank padded.

    `%l'
          This stands for the hour (1-12), blank padded.

    `%m'
          This stands for the month (01-12).

    `%M'
          This stands for the minute (00-59).

    `%n'
          This stands for a newline.

    `%p'
          This stands for `AM' or `PM', as appropriate.

    `%r'
          This is a synonym for `%I:%M:%S %p'.

    `%R'
          This is a synonym for `%H:%M'.

    `%S'
          This stands for the seconds (00-59).

    `%t'
          This stands for a tab character.

    `%T'
          This is a synonym for `%H:%M:%S'.

    `%U'
          This stands for the week of the year (01-52), assuming that
          weeks start on Sunday.

    `%w'
          This stands for the numeric day of week (0-6).  Sunday is day
          0.

    `%W'
          This stands for the week of the year (01-52), assuming that
          weeks start on Monday.

    `%x'
          This has a locale-specific meaning.  In the default locale
          (named `C'), it is equivalent to `%D'.

    `%X'
          This has a locale-specific meaning.  In the default locale
          (named `C'), it is equivalent to `%T'.

    `%y'
          This stands for the year without century (00-99).

    `%Y'
          This stands for the year with century.

    `%Z'
          This stands for the time zone abbreviation (e.g., `EST').

    `%z'
          This stands for the time zone numerical offset (e.g.,
          `-0500').

     You can also specify the field width and type of padding for any of
     these `%'-sequences.  This works as in `printf': you write the
     field width as digits in the middle of a `%'-sequences.  If you
     start the field width with `0', it means to pad with zeros.  If you
     start the field width with `_', it means to pad with spaces.

     For example, `%S' specifies the number of seconds since the minute;
     `%03S' means to pad this with zeros to 3 positions, `%_3S' to pad
     with spaces to 3 positions.  Plain `%3S' pads with zeros, because
     that is how `%S' normally pads to two positions.

     The characters `E' and `O' act as modifiers when used between `%'
     and one of the letters in the table above.  `E' specifies using
     the current locale's "alternative" version of the date and time.
     In a Japanese locale, for example, `%Ex' might yield a date format
     based on the Japanese Emperors' reigns.  `E' is allowed in `%Ec',
     `%EC', `%Ex', `%EX', `%Ey', and `%EY'.

     `O' means to use the current locale's "alternative" representation
     of numbers, instead of the ordinary decimal digits.  This is
     allowed with most letters, all the ones that output numbers.

     If UNIVERSAL is non-`nil', that means to describe the time as
     Universal Time; `nil' means describe it using what Emacs believes
     is the local time zone (see `current-time-zone').

     This function uses the C library function `strftime' (*note
     Formatting Calendar Time: (libc)Formatting Calendar Time.) to do
     most of the work.  In order to communicate with that function, it
     first encodes its argument using the coding system specified by
     `locale-coding-system' (*note Locales::); after `strftime' returns
     the resulting string, `format-time-string' decodes the string
     using that same coding system.

 -- Function: seconds-to-time seconds
     This function converts SECONDS, a floating point number of seconds
     since the epoch, to a time value and returns that.  To perform the
     inverse conversion, use `float-time'.


File: elisp,  Node: Processor Run Time,  Next: Time Calculations,  Prev: Time Parsing,  Up: System Interface

39.8 Processor Run time
=======================

 -- Function: get-internal-run-time
     This function returns the processor run time used by Emacs as a
     list of three integers: `(HIGH LOW MICROSEC)'.  The integers HIGH
     and LOW combine to give the number of seconds, which is HIGH *
     2**16 + LOW.

     The third element, MICROSEC, gives the microseconds (or 0 for
     systems that return time with the resolution of only one second).

     If the system doesn't provide a way to determine the processor run
     time, get-internal-run-time returns the same time as current-time.


File: elisp,  Node: Time Calculations,  Next: Timers,  Prev: Processor Run Time,  Up: System Interface

39.9 Time Calculations
======================

These functions perform calendrical computations using time values (the
kind of list that `current-time' returns).

 -- Function: time-less-p t1 t2
     This returns `t' if time value T1 is less than time value T2.

 -- Function: time-subtract t1 t2
     This returns the time difference T1 - T2 between two time values,
     in the same format as a time value.

 -- Function: time-add t1 t2
     This returns the sum of two time values, one of which ought to
     represent a time difference rather than a point in time.  Here is
     how to add a number of seconds to a time value:

          (time-add TIME (seconds-to-time SECONDS))

 -- Function: time-to-days time
     This function returns the number of days between the beginning of
     year 1 and TIME.

 -- Function: time-to-day-in-year time
     This returns the day number within the year corresponding to TIME.

 -- Function: date-leap-year-p year
     This function returns `t' if YEAR is a leap year.


File: elisp,  Node: Timers,  Next: Idle Timers,  Prev: Time Calculations,  Up: System Interface

39.10 Timers for Delayed Execution
==================================

You can set up a "timer" to call a function at a specified future time
or after a certain length of idleness.

   Emacs cannot run timers at any arbitrary point in a Lisp program; it
can run them only when Emacs could accept output from a subprocess:
namely, while waiting or inside certain primitive functions such as
`sit-for' or `read-event' which _can_ wait.  Therefore, a timer's
execution may be delayed if Emacs is busy.  However, the time of
execution is very precise if Emacs is idle.

   Emacs binds `inhibit-quit' to `t' before calling the timer function,
because quitting out of many timer functions can leave things in an
inconsistent state.  This is normally unproblematical because most
timer functions don't do a lot of work.  Indeed, for a timer to call a
function that takes substantial time to run is likely to be annoying.
If a timer function needs to allow quitting, it should use
`with-local-quit' (*note Quitting::).  For example, if a timer function
calls `accept-process-output' to receive output from an external
process, that call should be wrapped inside `with-local-quit', to
ensure that `C-g' works if the external process hangs.

   It is usually a bad idea for timer functions to alter buffer
contents.  When they do, they usually should call `undo-boundary' both
before and after changing the buffer, to separate the timer's changes
from user commands' changes and prevent a single undo entry from
growing to be quite large.

   Timer functions should also avoid calling functions that cause Emacs
to wait, such as `sit-for' (*note Waiting::).  This can lead to
unpredictable effects, since other timers (or even the same timer) can
run while waiting.  If a timer function needs to perform an action
after a certain time has elapsed, it can do this by scheduling a new
timer.

   If a timer function calls functions that can change the match data,
it should save and restore the match data.  *Note Saving Match Data::.

 -- Command: run-at-time time repeat function &rest args
     This sets up a timer that calls the function FUNCTION with
     arguments ARGS at time TIME.  If REPEAT is a number (integer or
     floating point), the timer is scheduled to run again every REPEAT
     seconds after TIME.  If REPEAT is `nil', the timer runs only once.

     TIME may specify an absolute or a relative time.

     Absolute times may be specified using a string with a limited
     variety of formats, and are taken to be times _today_, even if
     already in the past.  The recognized forms are `XXXX', `X:XX', or
     `XX:XX' (military time), and `XXam', `XXAM', `XXpm', `XXPM',
     `XX:XXam', `XX:XXAM', `XX:XXpm', or `XX:XXPM'.  A period can be
     used instead of a colon to separate the hour and minute parts.

     To specify a relative time as a string, use numbers followed by
     units.  For example:

    `1 min'
          denotes 1 minute from now.

    `1 min 5 sec'
          denotes 65 seconds from now.

    `1 min 2 sec 3 hour 4 day 5 week 6 fortnight 7 month 8 year'
          denotes exactly 103 months, 123 days, and 10862 seconds from
          now.

     For relative time values, Emacs considers a month to be exactly
     thirty days, and a year to be exactly 365.25 days.

     Not all convenient formats are strings.  If TIME is a number
     (integer or floating point), that specifies a relative time
     measured in seconds.  The result of `encode-time' can also be used
     to specify an absolute value for TIME.

     In most cases, REPEAT has no effect on when _first_ call takes
     place--TIME alone specifies that.  There is one exception: if TIME
     is `t', then the timer runs whenever the time is a multiple of
     REPEAT seconds after the epoch.  This is useful for functions like
     `display-time'.

     The function `run-at-time' returns a timer value that identifies
     the particular scheduled future action.  You can use this value to
     call `cancel-timer' (see below).

   A repeating timer nominally ought to run every REPEAT seconds, but
remember that any invocation of a timer can be late.  Lateness of one
repetition has no effect on the scheduled time of the next repetition.
For instance, if Emacs is busy computing for long enough to cover three
scheduled repetitions of the timer, and then starts to wait, it will
immediately call the timer function three times in immediate succession
(presuming no other timers trigger before or between them).  If you
want a timer to run again no less than N seconds after the last
invocation, don't use the REPEAT argument.  Instead, the timer function
should explicitly reschedule the timer.

 -- Variable: timer-max-repeats
     This variable's value specifies the maximum number of times to
     repeat calling a timer function in a row, when many previously
     scheduled calls were unavoidably delayed.

 -- Macro: with-timeout (seconds timeout-forms...) body...
     Execute BODY, but give up after SECONDS seconds.  If BODY finishes
     before the time is up, `with-timeout' returns the value of the
     last form in BODY.  If, however, the execution of BODY is cut
     short by the timeout, then `with-timeout' executes all the
     TIMEOUT-FORMS and returns the value of the last of them.

     This macro works by setting a timer to run after SECONDS seconds.
     If BODY finishes before that time, it cancels the timer.  If the
     timer actually runs, it terminates execution of BODY, then
     executes TIMEOUT-FORMS.

     Since timers can run within a Lisp program only when the program
     calls a primitive that can wait, `with-timeout' cannot stop
     executing BODY while it is in the midst of a computation--only
     when it calls one of those primitives.  So use `with-timeout' only
     with a BODY that waits for input, not one that does a long
     computation.

   The function `y-or-n-p-with-timeout' provides a simple way to use a
timer to avoid waiting too long for an answer.  *Note Yes-or-No
Queries::.

 -- Function: cancel-timer timer
     This cancels the requested action for TIMER, which should be a
     timer--usually, one previously returned by `run-at-time' or
     `run-with-idle-timer'.  This cancels the effect of that call to
     one of these functions; the arrival of the specified time will not
     cause anything special to happen.


File: elisp,  Node: Idle Timers,  Next: Terminal Input,  Prev: Timers,  Up: System Interface

39.11 Idle Timers
=================

Here is how to set up a timer that runs when Emacs is idle for a
certain length of time.  Aside from how to set them up, idle timers
work just like ordinary timers.

 -- Command: run-with-idle-timer secs repeat function &rest args
     Set up a timer which runs when Emacs has been idle for SECS
     seconds.  The value of SECS may be an integer or a floating point
     number; a value of the type returned by `current-idle-time' is
     also allowed.

     If REPEAT is `nil', the timer runs just once, the first time Emacs
     remains idle for a long enough time.  More often REPEAT is
     non-`nil', which means to run the timer _each time_ Emacs remains
     idle for SECS seconds.

     The function `run-with-idle-timer' returns a timer value which you
     can use in calling `cancel-timer' (*note Timers::).

   Emacs becomes "idle" when it starts waiting for user input, and it
remains idle until the user provides some input.  If a timer is set for
five seconds of idleness, it runs approximately five seconds after Emacs
first becomes idle.  Even if REPEAT is non-`nil', this timer will not
run again as long as Emacs remains idle, because the duration of
idleness will continue to increase and will not go down to five seconds
again.

   Emacs can do various things while idle: garbage collect, autosave or
handle data from a subprocess.  But these interludes during idleness do
not interfere with idle timers, because they do not reset the clock of
idleness to zero.  An idle timer set for 600 seconds will run when ten
minutes have elapsed since the last user command was finished, even if
subprocess output has been accepted thousands of times within those ten
minutes, and even if there have been garbage collections and autosaves.

   When the user supplies input, Emacs becomes non-idle while executing
the input.  Then it becomes idle again, and all the idle timers that are
set up to repeat will subsequently run another time, one by one.

 -- Function: current-idle-time
     If Emacs is idle, this function returns the length of time Emacs
     has been idle, as a list of three integers: `(HIGH LOW MICROSEC)'.
     The integers HIGH and LOW combine to give the number of seconds of
     idleness, which is HIGH * 2**16 + LOW.

     The third element, MICROSEC, gives the microseconds since the
     start of the current second (or 0 for systems that return time with
     the resolution of only one second).

     When Emacs is not idle, `current-idle-time' returns `nil'.  This
     is a convenient way to test whether Emacs is idle.

     The main use of this function is when an idle timer function wants
     to "take a break" for a while.  It can set up another idle timer to
     call the same function again, after a few seconds more idleness.
     Here's an example:

          (defvar resume-timer nil
            "Timer that `timer-function' used to reschedule itself, or nil.")

          (defun timer-function ()
            ;; If the user types a command while `resume-timer'
            ;; is active, the next time this function is called from
            ;; its main idle timer, deactivate `resume-timer'.
            (when resume-timer
              (cancel-timer resume-timer))
            ...DO THE WORK FOR A WHILE...
            (when TAKING-A-BREAK
              (setq resume-timer
                    (run-with-idle-timer
                      ;; Compute an idle time BREAK-LENGTH
                      ;; more than the current value.
                      (time-add (current-idle-time)
                                (seconds-to-time BREAK-LENGTH))
                      nil
                      'timer-function))))

   Some idle timer functions in user Lisp packages have a loop that
does a certain amount of processing each time around, and exits when
`(input-pending-p)' is non-`nil'.  That approach seems very natural but
has two problems:

   * It blocks out all process output (since Emacs accepts process
     output only while waiting).

   * It blocks out any idle timers that ought to run during that time.

To avoid these problems, don't use that technique.  Instead, write such
idle timers to reschedule themselves after a brief pause, using the
method in the `timer-function' example above.


File: elisp,  Node: Terminal Input,  Next: Terminal Output,  Prev: Idle Timers,  Up: System Interface

39.12 Terminal Input
====================

This section describes functions and variables for recording or
manipulating terminal input.  See *note Display::, for related
functions.

* Menu:

* Input Modes::		Options for how input is processed.
* Recording Input::	Saving histories of recent or all input events.


File: elisp,  Node: Input Modes,  Next: Recording Input,  Up: Terminal Input

39.12.1 Input Modes
-------------------

 -- Function: set-input-mode interrupt flow meta &optional quit-char
     This function sets the mode for reading keyboard input.  If
     INTERRUPT is non-null, then Emacs uses input interrupts.  If it is
     `nil', then it uses CBREAK mode.  The default setting is
     system-dependent.  Some systems always use CBREAK mode regardless
     of what is specified.

     When Emacs communicates directly with X, it ignores this argument
     and uses interrupts if that is the way it knows how to communicate.

     If FLOW is non-`nil', then Emacs uses XON/XOFF (`C-q', `C-s') flow
     control for output to the terminal.  This has no effect except in
     CBREAK mode.

     The argument META controls support for input character codes above
     127.  If META is `t', Emacs converts characters with the 8th bit
     set into Meta characters.  If META is `nil', Emacs disregards the
     8th bit; this is necessary when the terminal uses it as a parity
     bit.  If META is neither `t' nor `nil', Emacs uses all 8 bits of
     input unchanged.  This is good for terminals that use 8-bit
     character sets.

     If QUIT-CHAR is non-`nil', it specifies the character to use for
     quitting.  Normally this character is `C-g'.  *Note Quitting::.

   The `current-input-mode' function returns the input mode settings
Emacs is currently using.

 -- Function: current-input-mode
     This function returns the current mode for reading keyboard input.
     It returns a list, corresponding to the arguments of
     `set-input-mode', of the form `(INTERRUPT FLOW META QUIT)' in
     which:
    INTERRUPT
          is non-`nil' when Emacs is using interrupt-driven input.  If
          `nil', Emacs is using CBREAK mode.

    FLOW
          is non-`nil' if Emacs uses XON/XOFF (`C-q', `C-s') flow
          control for output to the terminal.  This value is meaningful
          only when INTERRUPT is `nil'.

    META
          is `t' if Emacs treats the eighth bit of input characters as
          the meta bit; `nil' means Emacs clears the eighth bit of every
          input character; any other value means Emacs uses all eight
          bits as the basic character code.

    QUIT
          is the character Emacs currently uses for quitting, usually
          `C-g'.


File: elisp,  Node: Recording Input,  Prev: Input Modes,  Up: Terminal Input

39.12.2 Recording Input
-----------------------

 -- Function: recent-keys
     This function returns a vector containing the last 300 input
     events from the keyboard or mouse.  All input events are included,
     whether or not they were used as parts of key sequences.  Thus,
     you always get the last 100 input events, not counting events
     generated by keyboard macros.  (These are excluded because they
     are less interesting for debugging; it should be enough to see the
     events that invoked the macros.)

     A call to `clear-this-command-keys' (*note Command Loop Info::)
     causes this function to return an empty vector immediately
     afterward.

 -- Command: open-dribble-file filename
     This function opens a "dribble file" named FILENAME.  When a
     dribble file is open, each input event from the keyboard or mouse
     (but not those from keyboard macros) is written in that file.  A
     non-character event is expressed using its printed representation
     surrounded by `<...>'.

     You close the dribble file by calling this function with an
     argument of `nil'.

     This function is normally used to record the input necessary to
     trigger an Emacs bug, for the sake of a bug report.

          (open-dribble-file "~/dribble")
               => nil

   See also the `open-termscript' function (*note Terminal Output::).


File: elisp,  Node: Terminal Output,  Next: Sound Output,  Prev: Terminal Input,  Up: System Interface

39.13 Terminal Output
=====================

The terminal output functions send output to a text terminal, or keep
track of output sent to the terminal.  The variable `baud-rate' tells
you what Emacs thinks is the output speed of the terminal.

 -- Variable: baud-rate
     This variable's value is the output speed of the terminal, as far
     as Emacs knows.  Setting this variable does not change the speed
     of actual data transmission, but the value is used for
     calculations such as padding.

     It also affects decisions about whether to scroll part of the
     screen or repaint on text terminals.  *Note Forcing Redisplay::,
     for the corresponding functionality on graphical terminals.

     The value is measured in baud.

   If you are running across a network, and different parts of the
network work at different baud rates, the value returned by Emacs may be
different from the value used by your local terminal.  Some network
protocols communicate the local terminal speed to the remote machine, so
that Emacs and other programs can get the proper value, but others do
not.  If Emacs has the wrong value, it makes decisions that are less
than optimal.  To fix the problem, set `baud-rate'.

 -- Function: baud-rate
     This obsolete function returns the value of the variable
     `baud-rate'.

 -- Function: send-string-to-terminal string
     This function sends STRING to the terminal without alteration.
     Control characters in STRING have terminal-dependent effects.
     This function operates only on text terminals.

     One use of this function is to define function keys on terminals
     that have downloadable function key definitions.  For example,
     this is how (on certain terminals) to define function key 4 to
     move forward four characters (by transmitting the characters `C-u
     C-f' to the computer):

          (send-string-to-terminal "\eF4\^U\^F")
               => nil

 -- Command: open-termscript filename
     This function is used to open a "termscript file" that will record
     all the characters sent by Emacs to the terminal.  It returns
     `nil'.  Termscript files are useful for investigating problems
     where Emacs garbles the screen, problems that are due to incorrect
     Termcap entries or to undesirable settings of terminal options more
     often than to actual Emacs bugs.  Once you are certain which
     characters were actually output, you can determine reliably
     whether they correspond to the Termcap specifications in use.

     You close the termscript file by calling this function with an
     argument of `nil'.

     See also `open-dribble-file' in *note Recording Input::.

          (open-termscript "../junk/termscript")
               => nil


File: elisp,  Node: Sound Output,  Next: X11 Keysyms,  Prev: Terminal Output,  Up: System Interface

39.14 Sound Output
==================

To play sound using Emacs, use the function `play-sound'.  Only certain
systems are supported; if you call `play-sound' on a system which
cannot really do the job, it gives an error.  Emacs version 20 and
earlier did not support sound at all.

   The sound must be stored as a file in RIFF-WAVE format (`.wav') or
Sun Audio format (`.au').

 -- Function: play-sound sound
     This function plays a specified sound.  The argument, SOUND, has
     the form `(sound PROPERTIES...)', where the PROPERTIES consist of
     alternating keywords (particular symbols recognized specially) and
     values corresponding to them.

     Here is a table of the keywords that are currently meaningful in
     SOUND, and their meanings:

    `:file FILE'
          This specifies the file containing the sound to play.  If the
          file name is not absolute, it is expanded against the
          directory `data-directory'.

    `:data DATA'
          This specifies the sound to play without need to refer to a
          file.  The value, DATA, should be a string containing the
          same bytes as a sound file.  We recommend using a unibyte
          string.

    `:volume VOLUME'
          This specifies how loud to play the sound.  It should be a
          number in the range of 0 to 1.  The default is to use
          whatever volume has been specified before.

    `:device DEVICE'
          This specifies the system device on which to play the sound,
          as a string.  The default device is system-dependent.

     Before actually playing the sound, `play-sound' calls the
     functions in the list `play-sound-functions'.  Each function is
     called with one argument, SOUND.

 -- Function: play-sound-file file &optional volume device
     This function is an alternative interface to playing a sound FILE
     specifying an optional VOLUME and DEVICE.

 -- Variable: play-sound-functions
     A list of functions to be called before playing a sound.  Each
     function is called with one argument, a property list that
     describes the sound.


File: elisp,  Node: X11 Keysyms,  Next: Batch Mode,  Prev: Sound Output,  Up: System Interface

39.15 Operating on X11 Keysyms
==============================

To define system-specific X11 keysyms, set the variable
`system-key-alist'.

 -- Variable: system-key-alist
     This variable's value should be an alist with one element for each
     system-specific keysym.  Each element has the form `(CODE .
     SYMBOL)', where CODE is the numeric keysym code (not including the
     "vendor specific" bit, -2**28), and SYMBOL is the name for the
     function key.

     For example `(168 . mute-acute)' defines a system-specific key
     (used by HP X servers) whose numeric code is -2**28 + 168.

     It is not crucial to exclude from the alist the keysyms of other X
     servers; those do no harm, as long as they don't conflict with the
     ones used by the X server actually in use.

     The variable is always local to the current terminal, and cannot be
     buffer-local.  *Note Multiple Displays::.

   You can specify which keysyms Emacs should use for the Meta, Alt,
Hyper, and Super modifiers by setting these variables:

 -- Variable: x-alt-keysym
 -- Variable: x-meta-keysym
 -- Variable: x-hyper-keysym
 -- Variable: x-super-keysym
     The name of the keysym that should stand for the Alt modifier
     (respectively, for Meta, Hyper, and Super).  For example, here is
     how to swap the Meta and Alt modifiers within Emacs:
          (setq x-alt-keysym 'meta)
          (setq x-meta-keysym 'alt)


File: elisp,  Node: Batch Mode,  Next: Session Management,  Prev: X11 Keysyms,  Up: System Interface

39.16 Batch Mode
================

The command-line option `-batch' causes Emacs to run noninteractively.
In this mode, Emacs does not read commands from the terminal, it does
not alter the terminal modes, and it does not expect to be outputting
to an erasable screen.  The idea is that you specify Lisp programs to
run; when they are finished, Emacs should exit.  The way to specify the
programs to run is with `-l FILE', which loads the library named FILE,
or `-f FUNCTION', which calls FUNCTION with no arguments, or `--eval
FORM'.

   Any Lisp program output that would normally go to the echo area,
either using `message', or using `prin1', etc., with `t' as the stream,
goes instead to Emacs's standard error descriptor when in batch mode.
Similarly, input that would normally come from the minibuffer is read
from the standard input descriptor.  Thus, Emacs behaves much like a
noninteractive application program.  (The echo area output that Emacs
itself normally generates, such as command echoing, is suppressed
entirely.)

 -- Variable: noninteractive
     This variable is non-`nil' when Emacs is running in batch mode.


File: elisp,  Node: Session Management,  Prev: Batch Mode,  Up: System Interface

39.17 Session Management
========================

Emacs supports the X Session Management Protocol for suspension and
restart of applications.  In the X Window System, a program called the
"session manager" has the responsibility to keep track of the
applications that are running.  During shutdown, the session manager
asks applications to save their state, and delays the actual shutdown
until they respond.  An application can also cancel the shutdown.

   When the session manager restarts a suspended session, it directs
these applications to individually reload their saved state.  It does
this by specifying a special command-line argument that says what saved
session to restore.  For Emacs, this argument is `--smid SESSION'.

 -- Variable: emacs-save-session-functions
     Emacs supports saving state by using a hook called
     `emacs-save-session-functions'.  Each function in this hook is
     called when the session manager tells Emacs that the window system
     is shutting down.  The functions are called with no arguments and
     with the current buffer set to a temporary buffer.  Each function
     can use `insert' to add Lisp code to this buffer.  At the end,
     Emacs saves the buffer in a file that a subsequent Emacs
     invocation will load in order to restart the saved session.

     If a function in `emacs-save-session-functions' returns non-`nil',
     Emacs tells the session manager to cancel the shutdown.

   Here is an example that just inserts some text into `*scratch*' when
Emacs is restarted by the session manager.

     (add-hook 'emacs-save-session-functions 'save-yourself-test)

     (defun save-yourself-test ()
       (insert "(save-excursion
       (switch-to-buffer \"*scratch*\")
       (insert \"I am restored\"))")
       nil)


File: elisp,  Node: Antinews,  Next: GNU Free Documentation License,  Prev: System Interface,  Up: Top

Appendix A Emacs 21 Antinews
****************************

For those users who live backwards in time, here is information about
downgrading to Emacs version 21.4.  We hope you will enjoy the greater
simplicity that results from the absence of many Emacs 22.3 features.

A.1 Old Lisp Features in Emacs 21
=================================

   * Many unnecessary features of redisplay have been eliminated.  (The
     earlier major release, Emacs 20, will have a completely rewritten
     redisplay engine, which will be even simpler.)

        - The function `redisplay' has been removed.  To update the
          display without delay, call `(sit-for 0)'.  Since it is
          generally considered wasteful to update the display if there
          are any pending input events, no replacement for `(redisplay
          t)' is provided.

        - The function `force-window-update' has been removed.  It
          shouldn't be needed, since changes in window contents are
          detected automatically.  In case they aren't, call
          `redraw-display' to redraw everything.

        - Point no longer moves out from underneath invisible text at
          the end of each command.  This allows the user to detect
          invisible text by moving the cursor around--if the cursor
          gets stuck, there is something invisible in the way.  If you
          really want cursor motion to ignore the text, try marking it
          as intangible.

        - Support for image maps and image slices has been removed.
          Emacs was always meant for editing text, anyway.

        - The mode line now accepts all text properties, as well as
          `:propertize' and `:eval' forms, regardless of the
          `risky-local-variable' property.

        - The `line-height' and `line-spacing' properties no longer
          have any meaning for newline characters.  Such properties
          wouldn't make sense, since newlines are not really
          characters; they just tell you where to break a line.

        - Considerable simplifications have been made to the display
          specification `(space . PROPS)', which is used for displaying
          a space of specified width and height.  Pixel-based
          specifications and Lisp expressions are no longer accepted.

        - Many features associated with the fringe areas have been
          removed, to encourage people to concentrate on the main
          editing area (the fringe will be completely removed in Emacs
          20.)  Arbitrary bitmaps can no longer be displayed in the
          fringe; an overlay arrow can still be displayed, but there
          can only be one overlay arrow at a time (any more would be
          confusing.)  The fringe widths cannot be adjusted, and
          individual windows cannot have their own fringe settings.  A
          mouse click on the fringe no longer generates a special event.

        - Individual windows cannot have their own scroll-bar settings.

        - You can no longer use `default' in a `defface' to specify
          defaults for subsequent faces.

        - The function `display-supports-face-attributes-p' has been
          removed.  In `defface' specifications, the `supports'
          predicate is no longer supported.

        - The functions `merge-face-attribute' and
          `face-attribute-relative-p' have been removed.

        - The priority of faces in a list supplied by the `:inherit'
          face attribute has been reversed.  We like to make changes
          like this once in a while, to keep Emacs Lisp programmers on
          their toes.

        - The `min-colors' face attribute, used for tailoring faces to
          limited-color displays, does not exist.  If in doubt, use
          colors like "white" and "black," which ought to be defined
          everywhere.

        - The `tty-color-mode' frame parameter does not exist.  You
          should just trust the terminal capabilities database.

   * Several simplifications have been made to mouse support:

        - Clicking `mouse-1' won't follow links, as that is alien to the
          spirit of Emacs.  Therefore, the `follow-link' property
          doesn't have any special meaning, and the function
          `mouse-on-link-p' has been removed.

        - The variable `void-text-area-pointer' has been removed, so the
          mouse pointer shape remains unchanged when moving between
          valid text areas and void text areas.  The `pointer' image
          and text properties are no longer supported.

        - Mouse events will no longer specify the timestamp, the object
          clicked, equivalent buffer positions (for marginal or fringe
          areas), glyph coordinates, or relative pixel coordinates.

   * Simplifications have also been made to the way Emacs handles
     keymaps and key sequences:

        - The `kbd' macro is now obsolete and is no longer documented.
          It isn't that difficult to write key sequences using the
          string and vector representations, and we want to encourage
          users to learn.

        - Emacs no longer supports key remapping.  You can do pretty
          much the same thing with `substitute-key-definition', or by
          advising the relevant command.

        - The `keymap' text and overlay property is now overridden by
          minor mode keymaps, and will not work at the ends of text
          properties and overlays.

        - The functions `map-keymap', `keymap-prompt', and
          `current-active-maps' have been removed.

   * Process support has been pared down to a functional minimum.  The
     functions `call-process-shell-command' and `process-file' have
     been deleted.  Processes no longer maintain property lists, and
     they won't ask any questions when the user tries to exit Emacs
     (which would simply be rude.)  The function `signal-process' won't
     accept a process object, only the process id; determining the
     process id from a process object is left as an exercise to the
     programmer.

   * Networking has also been simplified: `make-network-process' and
     its various associated function have all been replaced with a
     single easy-to-use function, `open-network-stream', which can't
     use UDP, can't act as a server, and can't set up non-blocking
     connections.  Also, deleting a network process with
     `delete-process' won't call the sentinel.

   * Many programming shortcuts have been deleted, to provide you with
     the enjoyment of "rolling your own."  The macros `while-no-input',
     `with-local-quit', and `with-selected-window', along with
     `dynamic-completion-table' and `lazy-completion-table' no longer
     exist.  Also, there are no built-in progress reporters; with
     Emacs, you can take progress for granted.

   * Variable aliases are no longer supported.  Aliases are for
     functions, not for variables.

   * The variables `most-positive-fixnum' and `most-negative-fixnum' do
     not exist.  On 32 bit machines, the most positive integer is
     probably 134217727, and the most negative integer is probably
     -134217728.

   * The functions `eql' and `macroexpand-all' are no longer available.
     However, you can find similar functions in the `cl' package.

   * The list returned by `split-string' won't include null substrings
     for separators at the beginning or end of a string.  If you want to
     check for such separators, do it separately.

   * The function `assoc-string' has been removed.  Use
     `assoc-ignore-case' or `assoc-ignore-representation' (which are no
     longer obsolete.)

   * The escape sequence `\s' is always interpreted as a super
     modifier, never a space.

   * The variable `buffer-save-without-query' has been removed, to
     prevent Emacs from sneakily saving buffers.  Also, the hook
     `before-save-hook' has been removed, so if you want something to
     be done before saving, advise or redefine `basic-save-buffer'.

   * The variable `buffer-auto-save-file-format' has been renamed to
     `auto-save-file-format', and is no longer a permanent local.

   * The function `visited-file-modtime' now returns a cons, instead of
     a list of two integers.  The primitive `set-file-times' has been
     eliminated.

   * The function `file-remote-p' is no longer available.

   * When determining the filename extension, a leading dot in a
     filename is no longer ignored.  Thus, `.emacs' is considered to
     have extension `emacs', rather than being extensionless.

   * Emacs looks for special file handlers in a more efficient manner:
     it will choose the first matching handler in
     `file-name-handler-alist', rather than trying to figure out which
     provides the closest match.

   * The `predicate' argument for `read-file-name' has been removed,
     and so have the variables `read-file-name-function' and
     `read-file-name-completion-ignore-case'.  The function
     `read-directory-name' has also been removed.

   * The functions `all-completions' and `try-completion' will no
     longer accept lists of strings or hash tables (it will still accept
     alists, obarrays, and functions.)  In addition, the function
     `test-completion' is no longer available.

   * The `G' interactive code character is no longer supported.  Use
     `F' instead.

   * Arbitrary Lisp functions can no longer be recorded into
     `buffer-undo-list'.  As a consequence, `yank-undo-function' is
     obsolete, and has been removed.

   * Emacs will never complain about commands that accumulate too much
     undo information, so you no longer have to worry about binding
     `buffer-undo-list' to `t' for such commands (though you may want
     to do that anyway, to avoid taking up unnecessary memory space.)

   * Atomic change groups are no longer supported.

   * The list returned by `(match-data t)' no longer records the buffer
     as a final element.

   * The function `looking-back' has been removed, so we no longer have
     the benefit of hindsight.

   * The variable `search-spaces-regexp' does not exist.  Spaces always
     stand for themselves in regular expression searches.

   * The functions `skip-chars-forward' and `skip-chars-backward' no
     longer accepts character classes such as `[:alpha:]'.  All
     characters are created equal.

   * The `yank-handler' text property no longer has any meaning.  Also,
     `yank-excluded-properties', `insert-for-yank', and
     `insert-buffer-substring-as-yank' have all been removed.

   * The variable `char-property-alias-alist' has been deleted.
     Aliases are for functions, not for properties.

   * The function `get-char-property-and-overlay' has been deleted.  If
     you want the properties at a point, find the text properties at the
     point; then, find the overlays at the point, and find the
     properties on those overlays.

   * Font Lock mode only manages `face' properties; you can't use
     font-lock keywords to specify arbitrary text properties for it to
     manage.  After all, it is called Font Lock mode, not Arbitrary
     Properties Lock mode.

   * The arguments to `remove-overlays' are no longer optional.

   * In `replace-match', the replacement text now inherits properties
     from the surrounding text.

   * The variable `mode-line-format' no longer supports the
     `:propertize', `%i', and `%I' constructs.  The function
     `format-mode-line' has been removed.

   * The functions `window-inside-edges' and `window-body-height' have
     been removed.  You should do the relevant calculations yourself,
     starting with `window-width' and `window-height'.

   * The functions `window-pixel-edges' and `window-inside-pixel-edges'
     have been removed.  We prefer to think in terms of lines and
     columns, not pixel coordinates.  (Sometime in the distant past, we
     will do away with graphical terminals entirely, in favor of text
     terminals.)  For similar reasons, the functions `posn-at-point',
     `posn-at-x-y', and `window-line-height' have been removed, and
     `pos-visible-in-window-p' no longer worries about partially
     visible rows.

   * The macro `save-selected-window' only saves the selected window of
     the selected frame, so don't try selecting windows in other frames.

   * The function `minibufferp' is no longer available.

   * The function `modify-all-frames-parameters' has been removed (we
     always suspected the name was ungrammatical, anyway.)

   * The `line-spacing' variable no longer accepts float values.

   * The function `tool-bar-local-item-from-menu' has been deleted.  If
     you need to make an entry in the tool bar, you can still use
     `tool-bar-add-item-from-menu', but that modifies the binding in
     the source keymap instead of copying it into the local keymap.

   * When determining the major mode, the file name takes precedence
     over the interpreter magic line.  The variable `magic-mode-alist',
     which associates certain buffer beginnings with major modes, has
     been eliminated.

   * The hook `after-change-major-mode-hook' is not defined, and
     neither are `run-mode-hooks' and `delay-mode-hooks'.

   * The variable `minor-mode-list' has been removed.

   * `define-derived-mode' will copy abbrevs from the parent mode's
     abbrev table, instead of creating a new, empty abbrev table.

   * There are no "system" abbrevs.  When the user saves into the
     abbrevs file, all abbrevs are saved.

   * The Warnings facility has been removed.  Just use `error'.

   * Several hook variables have been renamed to flout the Emacs naming
     conventions.  We feel that consistency is boring, and having
     non-standard hook names encourages users to check the documentation
     before using a hook.  For instance, the normal hook
     `find-file-hook' has been renamed to `find-file-hooks', and the
     abnormal hook `delete-frame-functions' has been renamed to
     `delete-frame-hook'.

   * The function `symbol-file' does not exist.  If you want to know
     which file defined a function or variable, try grepping for it.

   * The variable `load-history' records function definitions just like
     variable definitions, instead of indicating which functions were
     previously autoloaded.

   * There is a new variable, `recursive-load-depth-limit', which
     specifies how many times files can recursively load themselves; it
     is 50 by default, and `nil' means infinity.  Previously, Emacs
     signaled an error after just 3 recursive loads, which was boring.

   * Byte-compiler warnings and error messages will leave out the line
     and character positions, in order to exercise your debugging
     skills.  Also, there is no `with-no-warnings' macro--instead of
     suppressing compiler warnings, fix your code to avoid them!

   * The function `unsafep' has been removed.

   * File local variables can now specify a string with text properties.
     Since arbitrary Lisp expressions can be embedded in text
     properties, this can provide you with a great deal of flexibility
     and power.  On the other hand, `safe-local-eval-forms' and the
     `safe-local-eval-function' function property have no special
     meaning.

   * You can no longer use `char-displayable-p' to test if Emacs can
     display a certain character.

   * The function `string-to-multibyte' is no longer available.

   * The `translation-table-for-input' translation table has been
     removed.  Also, translation hash tables are no longer available,
     so we don't need the functions `lookup-character' and
     `lookup-integer'.

   * The `table' argument to `translate-region' can no longer be a
     char-table; it has to be a string.

   * The variable `auto-coding-functions' and the two functions
     `merge-coding-systems' and `decode-coding-inserted-region' have
     been deleted.  The coding system property `mime-text-unsuitable'
     no longer has any special meaning.

   * If pure storage overflows while dumping, Emacs won't tell you how
     much additional pure storage it needs.  Try adding in increments
     of 20000, until you have enough.

   * The variables `gc-elapsed', `gcs-done', and `post-gc-hook' have
     been garbage-collected.


File: elisp,  Node: GNU Free Documentation License,  Next: GPL,  Prev: Antinews,  Up: Top

Appendix B GNU Free Documentation License
*****************************************

                      Version 1.2, November 2002

     Copyright (C) 2000,2001,2002  Free Software Foundation, Inc.
     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

     Everyone is permitted to copy and distribute verbatim copies
     of this license document, but changing it is not allowed.


  0. PREAMBLE

     The purpose of this License is to make a manual, textbook, or other
     functional and useful document "free" in the sense of freedom: to
     assure everyone the effective freedom to copy and redistribute it,
     with or without modifying it, either commercially or
     noncommercially.  Secondarily, this License preserves for the
     author and publisher a way to get credit for their work, while not
     being considered responsible for modifications made by others.

     This License is a kind of "copyleft," which means that derivative
     works of the document must themselves be free in the same sense.
     It complements the GNU General Public License, which is a copyleft
     license designed for free software.

     We have designed this License in order to use it for manuals for
     free software, because free software needs free documentation: a
     free program should come with manuals providing the same freedoms
     that the software does.  But this License is not limited to
     software manuals; it can be used for any textual work, regardless
     of subject matter or whether it is published as a printed book.
     We recommend this License principally for works whose purpose is
     instruction or reference.


  1. APPLICABILITY AND DEFINITIONS

     This License applies to any manual or other work, in any medium,
     that contains a notice placed by the copyright holder saying it
     can be distributed under the terms of this License.  Such a notice
     grants a world-wide, royalty-free license, unlimited in duration,
     to use that work under the conditions stated herein.  The
     "Document," below, refers to any such manual or work.  Any member
     of the public is a licensee, and is addressed as "you."  You
     accept the license if you copy, modify or distribute the work in a
     way requiring permission under copyright law.

     A "Modified Version" of the Document means any work containing the
     Document or a portion of it, either copied verbatim, or with
     modifications and/or translated into another language.

     A "Secondary Section" is a named appendix or a front-matter
     section of the Document that deals exclusively with the
     relationship of the publishers or authors of the Document to the
     Document's overall subject (or to related matters) and contains
     nothing that could fall directly within that overall subject.
     (Thus, if the Document is in part a textbook of mathematics, a
     Secondary Section may not explain any mathematics.)  The
     relationship could be a matter of historical connection with the
     subject or with related matters, or of legal, commercial,
     philosophical, ethical or political position regarding them.

     The "Invariant Sections" are certain Secondary Sections whose
     titles are designated, as being those of Invariant Sections, in
     the notice that says that the Document is released under this
     License.  If a section does not fit the above definition of
     Secondary then it is not allowed to be designated as Invariant.
     The Document may contain zero Invariant Sections.  If the Document
     does not identify any Invariant Sections then there are none.

     The "Cover Texts" are certain short passages of text that are
     listed, as Front-Cover Texts or Back-Cover Texts, in the notice
     that says that the Document is released under this License.  A
     Front-Cover Text may be at most 5 words, and a Back-Cover Text may
     be at most 25 words.

     A "Transparent" copy of the Document means a machine-readable copy,
     represented in a format whose specification is available to the
     general public, that is suitable for revising the document
     straightforwardly with generic text editors or (for images
     composed of pixels) generic paint programs or (for drawings) some
     widely available drawing editor, and that is suitable for input to
     text formatters or for automatic translation to a variety of
     formats suitable for input to text formatters.  A copy made in an
     otherwise Transparent file format whose markup, or absence of
     markup, has been arranged to thwart or discourage subsequent
     modification by readers is not Transparent.  An image format is
     not Transparent if used for any substantial amount of text.  A
     copy that is not "Transparent" is called "Opaque."

     Examples of suitable formats for Transparent copies include plain
     ASCII without markup, Texinfo input format, LaTeX input format,
     SGML or XML using a publicly available DTD, and
     standard-conforming simple HTML, PostScript or PDF designed for
     human modification.  Examples of transparent image formats include
     PNG, XCF and JPG.  Opaque formats include proprietary formats that
     can be read and edited only by proprietary word processors, SGML
     or XML for which the DTD and/or processing tools are not generally
     available, and the machine-generated HTML, PostScript or PDF
     produced by some word processors for output purposes only.

     The "Title Page" means, for a printed book, the title page itself,
     plus such following pages as are needed to hold, legibly, the
     material this License requires to appear in the title page.  For
     works in formats which do not have any title page as such, "Title
     Page" means the text near the most prominent appearance of the
     work's title, preceding the beginning of the body of the text.

     A section "Entitled XYZ" means a named subunit of the Document
     whose title either is precisely XYZ or contains XYZ in parentheses
     following text that translates XYZ in another language.  (Here XYZ
     stands for a specific section name mentioned below, such as
     "Acknowledgements," "Dedications," "Endorsements," or "History.")
     To "Preserve the Title" of such a section when you modify the
     Document means that it remains a section "Entitled XYZ" according
     to this definition.

     The Document may include Warranty Disclaimers next to the notice
     which states that this License applies to the Document.  These
     Warranty Disclaimers are considered to be included by reference in
     this License, but only as regards disclaiming warranties: any other
     implication that these Warranty Disclaimers may have is void and
     has no effect on the meaning of this License.

  2. VERBATIM COPYING

     You may copy and distribute the Document in any medium, either
     commercially or noncommercially, provided that this License, the
     copyright notices, and the license notice saying this License
     applies to the Document are reproduced in all copies, and that you
     add no other conditions whatsoever to those of this License.  You
     may not use technical measures to obstruct or control the reading
     or further copying of the copies you make or distribute.  However,
     you may accept compensation in exchange for copies.  If you
     distribute a large enough number of copies you must also follow
     the conditions in section 3.

     You may also lend copies, under the same conditions stated above,
     and you may publicly display copies.

  3. COPYING IN QUANTITY

     If you publish printed copies (or copies in media that commonly
     have printed covers) of the Document, numbering more than 100, and
     the Document's license notice requires Cover Texts, you must
     enclose the copies in covers that carry, clearly and legibly, all
     these Cover Texts: Front-Cover Texts on the front cover, and
     Back-Cover Texts on the back cover.  Both covers must also clearly
     and legibly identify you as the publisher of these copies.  The
     front cover must present the full title with all words of the
     title equally prominent and visible.  You may add other material
     on the covers in addition.  Copying with changes limited to the
     covers, as long as they preserve the title of the Document and
     satisfy these conditions, can be treated as verbatim copying in
     other respects.

     If the required texts for either cover are too voluminous to fit
     legibly, you should put the first ones listed (as many as fit
     reasonably) on the actual cover, and continue the rest onto
     adjacent pages.

     If you publish or distribute Opaque copies of the Document
     numbering more than 100, you must either include a
     machine-readable Transparent copy along with each Opaque copy, or
     state in or with each Opaque copy a computer-network location from
     which the general network-using public has access to download
     using public-standard network protocols a complete Transparent
     copy of the Document, free of added material.  If you use the
     latter option, you must take reasonably prudent steps, when you
     begin distribution of Opaque copies in quantity, to ensure that
     this Transparent copy will remain thus accessible at the stated
     location until at least one year after the last time you
     distribute an Opaque copy (directly or through your agents or
     retailers) of that edition to the public.

     It is requested, but not required, that you contact the authors of
     the Document well before redistributing any large number of
     copies, to give them a chance to provide you with an updated
     version of the Document.

  4. MODIFICATIONS

     You may copy and distribute a Modified Version of the Document
     under the conditions of sections 2 and 3 above, provided that you
     release the Modified Version under precisely this License, with
     the Modified Version filling the role of the Document, thus
     licensing distribution and modification of the Modified Version to
     whoever possesses a copy of it.  In addition, you must do these
     things in the Modified Version:

     A. Use in the Title Page (and on the covers, if any) a title
     distinct    from that of the Document, and from those of previous
     versions    (which should, if there were any, be listed in the
     History section    of the Document).  You may use the same title
     as a previous version    if the original publisher of that version
     gives permission.
     B. List on the Title Page, as authors, one or more persons or
     entities    responsible for authorship of the modifications in the
     Modified    Version, together with at least five of the principal
     authors of the    Document (all of its principal authors, if it
     has fewer than five),    unless they release you from this
     requirement.
     C. State on the Title page the name of the publisher of the
     Modified Version, as the publisher.
     D. Preserve all the copyright notices of the Document.
     E. Add an appropriate copyright notice for your modifications
     adjacent to the other copyright notices.
     F. Include, immediately after the copyright notices, a license
     notice    giving the public permission to use the Modified Version
     under the    terms of this License, in the form shown in the
     Addendum below.
     G. Preserve in that license notice the full lists of Invariant
     Sections    and required Cover Texts given in the Document's
     license notice.
     H. Include an unaltered copy of this License.
     I. Preserve the section Entitled "History," Preserve its Title,
     and add    to it an item stating at least the title, year, new
     authors, and    publisher of the Modified Version as given on the
     Title Page.  If    there is no section Entitled "History" in the
     Document, create one    stating the title, year, authors, and
     publisher of the Document as    given on its Title Page, then add
     an item describing the Modified    Version as stated in the
     previous sentence.
     J. Preserve the network location, if any, given in the Document for
       public access to a Transparent copy of the Document, and likewise
       the network locations given in the Document for previous versions
       it was based on.  These may be placed in the "History" section.
       You may omit a network location for a work that was published at
       least four years before the Document itself, or if the original
      publisher of the version it refers to gives permission.
     K. For any section Entitled "Acknowledgements" or "Dedications,"
     Preserve the Title of the section, and preserve in the section all
       the substance and tone of each of the contributor
     acknowledgements    and/or dedications given therein.
     L. Preserve all the Invariant Sections of the Document,
     unaltered in their text and in their titles.  Section numbers
     or the equivalent are not considered part of the section titles.
     M. Delete any section Entitled "Endorsements."  Such a section
     may not be included in the Modified Version.
     N. Do not retitle any existing section to be Entitled
     "Endorsements"    or to conflict in title with any Invariant
     Section.
     O. Preserve any Warranty Disclaimers.

     If the Modified Version includes new front-matter sections or
     appendices that qualify as Secondary Sections and contain no
     material copied from the Document, you may at your option
     designate some or all of these sections as invariant.  To do this,
     add their titles to the list of Invariant Sections in the Modified
     Version's license notice.  These titles must be distinct from any
     other section titles.

     You may add a section Entitled "Endorsements," provided it contains
     nothing but endorsements of your Modified Version by various
     parties-for example, statements of peer review or that the text has
     been approved by an organization as the authoritative definition
     of a standard.

     You may add a passage of up to five words as a Front-Cover Text,
     and a passage of up to 25 words as a Back-Cover Text, to the end
     of the list of Cover Texts in the Modified Version.  Only one
     passage of Front-Cover Text and one of Back-Cover Text may be
     added by (or through arrangements made by) any one entity.  If the
     Document already includes a cover text for the same cover,
     previously added by you or by arrangement made by the same entity
     you are acting on behalf of, you may not add another; but you may
     replace the old one, on explicit permission from the previous
     publisher that added the old one.

     The author(s) and publisher(s) of the Document do not by this
     License give permission to use their names for publicity for or to
     assert or imply endorsement of any Modified Version.

  5. COMBINING DOCUMENTS

     You may combine the Document with other documents released under
     this License, under the terms defined in section 4 above for
     modified versions, provided that you include in the combination
     all of the Invariant Sections of all of the original documents,
     unmodified, and list them all as Invariant Sections of your
     combined work in its license notice, and that you preserve all
     their Warranty Disclaimers.

     The combined work need only contain one copy of this License, and
     multiple identical Invariant Sections may be replaced with a single
     copy.  If there are multiple Invariant Sections with the same name
     but different contents, make the title of each such section unique
     by adding at the end of it, in parentheses, the name of the
     original author or publisher of that section if known, or else a
     unique number.  Make the same adjustment to the section titles in
     the list of Invariant Sections in the license notice of the
     combined work.

     In the combination, you must combine any sections Entitled
     "History" in the various original documents, forming one section
     Entitled "History"; likewise combine any sections Entitled
     "Acknowledgements," and any sections Entitled "Dedications."  You
     must delete all sections Entitled "Endorsements."

  6. COLLECTIONS OF DOCUMENTS

     You may make a collection consisting of the Document and other
     documents released under this License, and replace the individual
     copies of this License in the various documents with a single copy
     that is included in the collection, provided that you follow the
     rules of this License for verbatim copying of each of the
     documents in all other respects.

     You may extract a single document from such a collection, and
     distribute it individually under this License, provided you insert
     a copy of this License into the extracted document, and follow
     this License in all other respects regarding verbatim copying of
     that document.

  7. AGGREGATION WITH INDEPENDENT WORKS

     A compilation of the Document or its derivatives with other
     separate and independent documents or works, in or on a volume of
     a storage or distribution medium, is called an "aggregate" if the
     copyright resulting from the compilation is not used to limit the
     legal rights of the compilation's users beyond what the individual
     works permit.  When the Document is included in an aggregate, this
     License does not apply to the other works in the aggregate which
     are not themselves derivative works of the Document.

     If the Cover Text requirement of section 3 is applicable to these
     copies of the Document, then if the Document is less than one half
     of the entire aggregate, the Document's Cover Texts may be placed
     on covers that bracket the Document within the aggregate, or the
     electronic equivalent of covers if the Document is in electronic
     form.  Otherwise they must appear on printed covers that bracket
     the whole aggregate.

  8. TRANSLATION

     Translation is considered a kind of modification, so you may
     distribute translations of the Document under the terms of section
     4.  Replacing Invariant Sections with translations requires special
     permission from their copyright holders, but you may include
     translations of some or all Invariant Sections in addition to the
     original versions of these Invariant Sections.  You may include a
     translation of this License, and all the license notices in the
     Document, and any Warranty Disclaimers, provided that you also
     include the original English version of this License and the
     original versions of those notices and disclaimers.  In case of a
     disagreement between the translation and the original version of
     this License or a notice or disclaimer, the original version will
     prevail.

     If a section in the Document is Entitled "Acknowledgements,"
     "Dedications," or "History," the requirement (section 4) to
     Preserve its Title (section 1) will typically require changing the
     actual title.

  9. TERMINATION

     You may not copy, modify, sublicense, or distribute the Document
     except as expressly provided for under this License.  Any other
     attempt to copy, modify, sublicense or distribute the Document is
     void, and will automatically terminate your rights under this
     License.  However, parties who have received copies, or rights,
     from you under this License will not have their licenses
     terminated so long as such parties remain in full compliance.

 10. FUTURE REVISIONS OF THIS LICENSE

     The Free Software Foundation may publish new, revised versions of
     the GNU Free Documentation License from time to time.  Such new
     versions will be similar in spirit to the present version, but may
     differ in detail to address new problems or concerns.  See
     http://www.gnu.org/copyleft/.

     Each version of the License is given a distinguishing version
     number.  If the Document specifies that a particular numbered
     version of this License "or any later version" applies to it, you
     have the option of following the terms and conditions either of
     that specified version or of any later version that has been
     published (not as a draft) by the Free Software Foundation.  If
     the Document does not specify a version number of this License,
     you may choose any version ever published (not as a draft) by the
     Free Software Foundation.


ADDENDUM: How to use this License for your documents
====================================================

To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and license
notices just after the title page:

     Copyright (C)  YEAR  YOUR NAME.
     Permission is granted to copy, distribute and/or modify this document
     under the terms of the GNU Free Documentation License, Version 1.2
     or any later version published by the Free Software Foundation;
     with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.
     A copy of the license is included in the section entitled ``GNU
     Free Documentation License.''

   If you have Invariant Sections, Front-Cover Texts and Back-Cover
Texts, replace the "with...Texts." line with this:

     with the Invariant Sections being LIST THEIR TITLES, with the
     Front-Cover Texts being LIST, and with the Back-Cover Texts being
     LIST.

   If you have Invariant Sections without Cover Texts, or some other
combination of the three, merge those two alternatives to suit the
situation.

   If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of
free software license, such as the GNU General Public License, to
permit their use in free software.


File: elisp,  Node: GPL,  Next: Tips,  Prev: GNU Free Documentation License,  Up: Top

Appendix C GNU General Public License
*************************************

                        Version 3, 29 June 2007

     Copyright (C) 2007 Free Software Foundation, Inc. `http://fsf.org/'

     Everyone is permitted to copy and distribute verbatim copies of this
     license document, but changing it is not allowed.

Preamble
========

The GNU General Public License is a free, copyleft license for software
and other kinds of works.

   The licenses for most software and other practical works are designed
to take away your freedom to share and change the works.  By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains
free software for all its users.  We, the Free Software Foundation, use
the GNU General Public License for most of our software; it applies
also to any other work released this way by its authors.  You can apply
it to your programs, too.

   When we speak of free software, we are referring to freedom, not
price.  Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.

   To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights.  Therefore, you
have certain responsibilities if you distribute copies of the software,
or if you modify it: responsibilities to respect the freedom of others.

   For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received.  You must make sure that they, too, receive
or can get the source code.  And you must show them these terms so they
know their rights.

   Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.

   For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software.  For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.

   Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the
manufacturer can do so.  This is fundamentally incompatible with the
aim of protecting users' freedom to change the software.  The
systematic pattern of such abuse occurs in the area of products for
individuals to use, which is precisely where it is most unacceptable.
Therefore, we have designed this version of the GPL to prohibit the
practice for those products.  If such problems arise substantially in
other domains, we stand ready to extend this provision to those domains
in future versions of the GPL, as needed to protect the freedom of
users.

   Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary.  To prevent this, the GPL assures that
patents cannot be used to render the program non-free.

   The precise terms and conditions for copying, distribution and
modification follow.

TERMS AND CONDITIONS
====================

  0. Definitions.

     "This License" refers to version 3 of the GNU General Public
     License.

     "Copyright" also means copyright-like laws that apply to other
     kinds of works, such as semiconductor masks.

     "The Program" refers to any copyrightable work licensed under this
     License.  Each licensee is addressed as "you".  "Licensees" and
     "recipients" may be individuals or organizations.

     To "modify" a work means to copy from or adapt all or part of the
     work in a fashion requiring copyright permission, other than the
     making of an exact copy.  The resulting work is called a "modified
     version" of the earlier work or a work "based on" the earlier work.

     A "covered work" means either the unmodified Program or a work
     based on the Program.

     To "propagate" a work means to do anything with it that, without
     permission, would make you directly or secondarily liable for
     infringement under applicable copyright law, except executing it
     on a computer or modifying a private copy.  Propagation includes
     copying, distribution (with or without modification), making
     available to the public, and in some countries other activities as
     well.

     To "convey" a work means any kind of propagation that enables other
     parties to make or receive copies.  Mere interaction with a user
     through a computer network, with no transfer of a copy, is not
     conveying.

     An interactive user interface displays "Appropriate Legal Notices"
     to the extent that it includes a convenient and prominently visible
     feature that (1) displays an appropriate copyright notice, and (2)
     tells the user that there is no warranty for the work (except to
     the extent that warranties are provided), that licensees may
     convey the work under this License, and how to view a copy of this
     License.  If the interface presents a list of user commands or
     options, such as a menu, a prominent item in the list meets this
     criterion.

  1. Source Code.

     The "source code" for a work means the preferred form of the work
     for making modifications to it.  "Object code" means any
     non-source form of a work.

     A "Standard Interface" means an interface that either is an
     official standard defined by a recognized standards body, or, in
     the case of interfaces specified for a particular programming
     language, one that is widely used among developers working in that
     language.

     The "System Libraries" of an executable work include anything,
     other than the work as a whole, that (a) is included in the normal
     form of packaging a Major Component, but which is not part of that
     Major Component, and (b) serves only to enable use of the work
     with that Major Component, or to implement a Standard Interface
     for which an implementation is available to the public in source
     code form.  A "Major Component", in this context, means a major
     essential component (kernel, window system, and so on) of the
     specific operating system (if any) on which the executable work
     runs, or a compiler used to produce the work, or an object code
     interpreter used to run it.

     The "Corresponding Source" for a work in object code form means all
     the source code needed to generate, install, and (for an executable
     work) run the object code and to modify the work, including
     scripts to control those activities.  However, it does not include
     the work's System Libraries, or general-purpose tools or generally
     available free programs which are used unmodified in performing
     those activities but which are not part of the work.  For example,
     Corresponding Source includes interface definition files
     associated with source files for the work, and the source code for
     shared libraries and dynamically linked subprograms that the work
     is specifically designed to require, such as by intimate data
     communication or control flow between those subprograms and other
     parts of the work.

     The Corresponding Source need not include anything that users can
     regenerate automatically from other parts of the Corresponding
     Source.

     The Corresponding Source for a work in source code form is that
     same work.

  2. Basic Permissions.

     All rights granted under this License are granted for the term of
     copyright on the Program, and are irrevocable provided the stated
     conditions are met.  This License explicitly affirms your unlimited
     permission to run the unmodified Program.  The output from running
     a covered work is covered by this License only if the output,
     given its content, constitutes a covered work.  This License
     acknowledges your rights of fair use or other equivalent, as
     provided by copyright law.

     You may make, run and propagate covered works that you do not
     convey, without conditions so long as your license otherwise
     remains in force.  You may convey covered works to others for the
     sole purpose of having them make modifications exclusively for
     you, or provide you with facilities for running those works,
     provided that you comply with the terms of this License in
     conveying all material for which you do not control copyright.
     Those thus making or running the covered works for you must do so
     exclusively on your behalf, under your direction and control, on
     terms that prohibit them from making any copies of your
     copyrighted material outside their relationship with you.

     Conveying under any other circumstances is permitted solely under
     the conditions stated below.  Sublicensing is not allowed; section
     10 makes it unnecessary.

  3. Protecting Users' Legal Rights From Anti-Circumvention Law.

     No covered work shall be deemed part of an effective technological
     measure under any applicable law fulfilling obligations under
     article 11 of the WIPO copyright treaty adopted on 20 December
     1996, or similar laws prohibiting or restricting circumvention of
     such measures.

     When you convey a covered work, you waive any legal power to forbid
     circumvention of technological measures to the extent such
     circumvention is effected by exercising rights under this License
     with respect to the covered work, and you disclaim any intention
     to limit operation or modification of the work as a means of
     enforcing, against the work's users, your or third parties' legal
     rights to forbid circumvention of technological measures.

  4. Conveying Verbatim Copies.

     You may convey verbatim copies of the Program's source code as you
     receive it, in any medium, provided that you conspicuously and
     appropriately publish on each copy an appropriate copyright notice;
     keep intact all notices stating that this License and any
     non-permissive terms added in accord with section 7 apply to the
     code; keep intact all notices of the absence of any warranty; and
     give all recipients a copy of this License along with the Program.

     You may charge any price or no price for each copy that you convey,
     and you may offer support or warranty protection for a fee.

  5. Conveying Modified Source Versions.

     You may convey a work based on the Program, or the modifications to
     produce it from the Program, in the form of source code under the
     terms of section 4, provided that you also meet all of these
     conditions:

       a. The work must carry prominent notices stating that you
          modified it, and giving a relevant date.

       b. The work must carry prominent notices stating that it is
          released under this License and any conditions added under
          section 7.  This requirement modifies the requirement in
          section 4 to "keep intact all notices".

       c. You must license the entire work, as a whole, under this
          License to anyone who comes into possession of a copy.  This
          License will therefore apply, along with any applicable
          section 7 additional terms, to the whole of the work, and all
          its parts, regardless of how they are packaged.  This License
          gives no permission to license the work in any other way, but
          it does not invalidate such permission if you have separately
          received it.

       d. If the work has interactive user interfaces, each must display
          Appropriate Legal Notices; however, if the Program has
          interactive interfaces that do not display Appropriate Legal
          Notices, your work need not make them do so.

     A compilation of a covered work with other separate and independent
     works, which are not by their nature extensions of the covered
     work, and which are not combined with it such as to form a larger
     program, in or on a volume of a storage or distribution medium, is
     called an "aggregate" if the compilation and its resulting
     copyright are not used to limit the access or legal rights of the
     compilation's users beyond what the individual works permit.
     Inclusion of a covered work in an aggregate does not cause this
     License to apply to the other parts of the aggregate.

  6. Conveying Non-Source Forms.

     You may convey a covered work in object code form under the terms
     of sections 4 and 5, provided that you also convey the
     machine-readable Corresponding Source under the terms of this
     License, in one of these ways:

       a. Convey the object code in, or embodied in, a physical product
          (including a physical distribution medium), accompanied by the
          Corresponding Source fixed on a durable physical medium
          customarily used for software interchange.

       b. Convey the object code in, or embodied in, a physical product
          (including a physical distribution medium), accompanied by a
          written offer, valid for at least three years and valid for
          as long as you offer spare parts or customer support for that
          product model, to give anyone who possesses the object code
          either (1) a copy of the Corresponding Source for all the
          software in the product that is covered by this License, on a
          durable physical medium customarily used for software
          interchange, for a price no more than your reasonable cost of
          physically performing this conveying of source, or (2) access
          to copy the Corresponding Source from a network server at no
          charge.

       c. Convey individual copies of the object code with a copy of
          the written offer to provide the Corresponding Source.  This
          alternative is allowed only occasionally and noncommercially,
          and only if you received the object code with such an offer,
          in accord with subsection 6b.

       d. Convey the object code by offering access from a designated
          place (gratis or for a charge), and offer equivalent access
          to the Corresponding Source in the same way through the same
          place at no further charge.  You need not require recipients
          to copy the Corresponding Source along with the object code.
          If the place to copy the object code is a network server, the
          Corresponding Source may be on a different server (operated
          by you or a third party) that supports equivalent copying
          facilities, provided you maintain clear directions next to
          the object code saying where to find the Corresponding Source.
          Regardless of what server hosts the Corresponding Source, you
          remain obligated to ensure that it is available for as long
          as needed to satisfy these requirements.

       e. Convey the object code using peer-to-peer transmission,
          provided you inform other peers where the object code and
          Corresponding Source of the work are being offered to the
          general public at no charge under subsection 6d.


     A separable portion of the object code, whose source code is
     excluded from the Corresponding Source as a System Library, need
     not be included in conveying the object code work.

     A "User Product" is either (1) a "consumer product", which means
     any tangible personal property which is normally used for personal,
     family, or household purposes, or (2) anything designed or sold for
     incorporation into a dwelling.  In determining whether a product
     is a consumer product, doubtful cases shall be resolved in favor of
     coverage.  For a particular product received by a particular user,
     "normally used" refers to a typical or common use of that class of
     product, regardless of the status of the particular user or of the
     way in which the particular user actually uses, or expects or is
     expected to use, the product.  A product is a consumer product
     regardless of whether the product has substantial commercial,
     industrial or non-consumer uses, unless such uses represent the
     only significant mode of use of the product.

     "Installation Information" for a User Product means any methods,
     procedures, authorization keys, or other information required to
     install and execute modified versions of a covered work in that
     User Product from a modified version of its Corresponding Source.
     The information must suffice to ensure that the continued
     functioning of the modified object code is in no case prevented or
     interfered with solely because modification has been made.

     If you convey an object code work under this section in, or with,
     or specifically for use in, a User Product, and the conveying
     occurs as part of a transaction in which the right of possession
     and use of the User Product is transferred to the recipient in
     perpetuity or for a fixed term (regardless of how the transaction
     is characterized), the Corresponding Source conveyed under this
     section must be accompanied by the Installation Information.  But
     this requirement does not apply if neither you nor any third party
     retains the ability to install modified object code on the User
     Product (for example, the work has been installed in ROM).

     The requirement to provide Installation Information does not
     include a requirement to continue to provide support service,
     warranty, or updates for a work that has been modified or
     installed by the recipient, or for the User Product in which it
     has been modified or installed.  Access to a network may be denied
     when the modification itself materially and adversely affects the
     operation of the network or violates the rules and protocols for
     communication across the network.

     Corresponding Source conveyed, and Installation Information
     provided, in accord with this section must be in a format that is
     publicly documented (and with an implementation available to the
     public in source code form), and must require no special password
     or key for unpacking, reading or copying.

  7. Additional Terms.

     "Additional permissions" are terms that supplement the terms of
     this License by making exceptions from one or more of its
     conditions.  Additional permissions that are applicable to the
     entire Program shall be treated as though they were included in
     this License, to the extent that they are valid under applicable
     law.  If additional permissions apply only to part of the Program,
     that part may be used separately under those permissions, but the
     entire Program remains governed by this License without regard to
     the additional permissions.

     When you convey a copy of a covered work, you may at your option
     remove any additional permissions from that copy, or from any part
     of it.  (Additional permissions may be written to require their own
     removal in certain cases when you modify the work.)  You may place
     additional permissions on material, added by you to a covered work,
     for which you have or can give appropriate copyright permission.

     Notwithstanding any other provision of this License, for material
     you add to a covered work, you may (if authorized by the copyright
     holders of that material) supplement the terms of this License
     with terms:

       a. Disclaiming warranty or limiting liability differently from
          the terms of sections 15 and 16 of this License; or

       b. Requiring preservation of specified reasonable legal notices
          or author attributions in that material or in the Appropriate
          Legal Notices displayed by works containing it; or

       c. Prohibiting misrepresentation of the origin of that material,
          or requiring that modified versions of such material be
          marked in reasonable ways as different from the original
          version; or

       d. Limiting the use for publicity purposes of names of licensors
          or authors of the material; or

       e. Declining to grant rights under trademark law for use of some
          trade names, trademarks, or service marks; or

       f. Requiring indemnification of licensors and authors of that
          material by anyone who conveys the material (or modified
          versions of it) with contractual assumptions of liability to
          the recipient, for any liability that these contractual
          assumptions directly impose on those licensors and authors.

     All other non-permissive additional terms are considered "further
     restrictions" within the meaning of section 10.  If the Program as
     you received it, or any part of it, contains a notice stating that
     it is governed by this License along with a term that is a further
     restriction, you may remove that term.  If a license document
     contains a further restriction but permits relicensing or
     conveying under this License, you may add to a covered work
     material governed by the terms of that license document, provided
     that the further restriction does not survive such relicensing or
     conveying.

     If you add terms to a covered work in accord with this section, you
     must place, in the relevant source files, a statement of the
     additional terms that apply to those files, or a notice indicating
     where to find the applicable terms.

     Additional terms, permissive or non-permissive, may be stated in
     the form of a separately written license, or stated as exceptions;
     the above requirements apply either way.

  8. Termination.

     You may not propagate or modify a covered work except as expressly
     provided under this License.  Any attempt otherwise to propagate or
     modify it is void, and will automatically terminate your rights
     under this License (including any patent licenses granted under
     the third paragraph of section 11).

     However, if you cease all violation of this License, then your
     license from a particular copyright holder is reinstated (a)
     provisionally, unless and until the copyright holder explicitly
     and finally terminates your license, and (b) permanently, if the
     copyright holder fails to notify you of the violation by some
     reasonable means prior to 60 days after the cessation.

     Moreover, your license from a particular copyright holder is
     reinstated permanently if the copyright holder notifies you of the
     violation by some reasonable means, this is the first time you have
     received notice of violation of this License (for any work) from
     that copyright holder, and you cure the violation prior to 30 days
     after your receipt of the notice.

     Termination of your rights under this section does not terminate
     the licenses of parties who have received copies or rights from
     you under this License.  If your rights have been terminated and
     not permanently reinstated, you do not qualify to receive new
     licenses for the same material under section 10.

  9. Acceptance Not Required for Having Copies.

     You are not required to accept this License in order to receive or
     run a copy of the Program.  Ancillary propagation of a covered work
     occurring solely as a consequence of using peer-to-peer
     transmission to receive a copy likewise does not require
     acceptance.  However, nothing other than this License grants you
     permission to propagate or modify any covered work.  These actions
     infringe copyright if you do not accept this License.  Therefore,
     by modifying or propagating a covered work, you indicate your
     acceptance of this License to do so.

 10. Automatic Licensing of Downstream Recipients.

     Each time you convey a covered work, the recipient automatically
     receives a license from the original licensors, to run, modify and
     propagate that work, subject to this License.  You are not
     responsible for enforcing compliance by third parties with this
     License.

     An "entity transaction" is a transaction transferring control of an
     organization, or substantially all assets of one, or subdividing an
     organization, or merging organizations.  If propagation of a
     covered work results from an entity transaction, each party to that
     transaction who receives a copy of the work also receives whatever
     licenses to the work the party's predecessor in interest had or
     could give under the previous paragraph, plus a right to
     possession of the Corresponding Source of the work from the
     predecessor in interest, if the predecessor has it or can get it
     with reasonable efforts.

     You may not impose any further restrictions on the exercise of the
     rights granted or affirmed under this License.  For example, you
     may not impose a license fee, royalty, or other charge for
     exercise of rights granted under this License, and you may not
     initiate litigation (including a cross-claim or counterclaim in a
     lawsuit) alleging that any patent claim is infringed by making,
     using, selling, offering for sale, or importing the Program or any
     portion of it.

 11. Patents.

     A "contributor" is a copyright holder who authorizes use under this
     License of the Program or a work on which the Program is based.
     The work thus licensed is called the contributor's "contributor
     version".

     A contributor's "essential patent claims" are all patent claims
     owned or controlled by the contributor, whether already acquired or
     hereafter acquired, that would be infringed by some manner,
     permitted by this License, of making, using, or selling its
     contributor version, but do not include claims that would be
     infringed only as a consequence of further modification of the
     contributor version.  For purposes of this definition, "control"
     includes the right to grant patent sublicenses in a manner
     consistent with the requirements of this License.

     Each contributor grants you a non-exclusive, worldwide,
     royalty-free patent license under the contributor's essential
     patent claims, to make, use, sell, offer for sale, import and
     otherwise run, modify and propagate the contents of its
     contributor version.

     In the following three paragraphs, a "patent license" is any
     express agreement or commitment, however denominated, not to
     enforce a patent (such as an express permission to practice a
     patent or covenant not to sue for patent infringement).  To
     "grant" such a patent license to a party means to make such an
     agreement or commitment not to enforce a patent against the party.

     If you convey a covered work, knowingly relying on a patent
     license, and the Corresponding Source of the work is not available
     for anyone to copy, free of charge and under the terms of this
     License, through a publicly available network server or other
     readily accessible means, then you must either (1) cause the
     Corresponding Source to be so available, or (2) arrange to deprive
     yourself of the benefit of the patent license for this particular
     work, or (3) arrange, in a manner consistent with the requirements
     of this License, to extend the patent license to downstream
     recipients.  "Knowingly relying" means you have actual knowledge
     that, but for the patent license, your conveying the covered work
     in a country, or your recipient's use of the covered work in a
     country, would infringe one or more identifiable patents in that
     country that you have reason to believe are valid.

     If, pursuant to or in connection with a single transaction or
     arrangement, you convey, or propagate by procuring conveyance of, a
     covered work, and grant a patent license to some of the parties
     receiving the covered work authorizing them to use, propagate,
     modify or convey a specific copy of the covered work, then the
     patent license you grant is automatically extended to all
     recipients of the covered work and works based on it.

     A patent license is "discriminatory" if it does not include within
     the scope of its coverage, prohibits the exercise of, or is
     conditioned on the non-exercise of one or more of the rights that
     are specifically granted under this License.  You may not convey a
     covered work if you are a party to an arrangement with a third
     party that is in the business of distributing software, under
     which you make payment to the third party based on the extent of
     your activity of conveying the work, and under which the third
     party grants, to any of the parties who would receive the covered
     work from you, a discriminatory patent license (a) in connection
     with copies of the covered work conveyed by you (or copies made
     from those copies), or (b) primarily for and in connection with
     specific products or compilations that contain the covered work,
     unless you entered into that arrangement, or that patent license
     was granted, prior to 28 March 2007.

     Nothing in this License shall be construed as excluding or limiting
     any implied license or other defenses to infringement that may
     otherwise be available to you under applicable patent law.

 12. No Surrender of Others' Freedom.

     If conditions are imposed on you (whether by court order,
     agreement or otherwise) that contradict the conditions of this
     License, they do not excuse you from the conditions of this
     License.  If you cannot convey a covered work so as to satisfy
     simultaneously your obligations under this License and any other
     pertinent obligations, then as a consequence you may not convey it
     at all.  For example, if you agree to terms that obligate you to
     collect a royalty for further conveying from those to whom you
     convey the Program, the only way you could satisfy both those
     terms and this License would be to refrain entirely from conveying
     the Program.

 13. Use with the GNU Affero General Public License.

     Notwithstanding any other provision of this License, you have
     permission to link or combine any covered work with a work licensed
     under version 3 of the GNU Affero General Public License into a
     single combined work, and to convey the resulting work.  The terms
     of this License will continue to apply to the part which is the
     covered work, but the special requirements of the GNU Affero
     General Public License, section 13, concerning interaction through
     a network will apply to the combination as such.

 14. Revised Versions of this License.

     The Free Software Foundation may publish revised and/or new
     versions of the GNU General Public License from time to time.
     Such new versions will be similar in spirit to the present
     version, but may differ in detail to address new problems or
     concerns.

     Each version is given a distinguishing version number.  If the
     Program specifies that a certain numbered version of the GNU
     General Public License "or any later version" applies to it, you
     have the option of following the terms and conditions either of
     that numbered version or of any later version published by the
     Free Software Foundation.  If the Program does not specify a
     version number of the GNU General Public License, you may choose
     any version ever published by the Free Software Foundation.

     If the Program specifies that a proxy can decide which future
     versions of the GNU General Public License can be used, that
     proxy's public statement of acceptance of a version permanently
     authorizes you to choose that version for the Program.

     Later license versions may give you additional or different
     permissions.  However, no additional obligations are imposed on any
     author or copyright holder as a result of your choosing to follow a
     later version.

 15. Disclaimer of Warranty.

     THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
     APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE
     COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS"
     WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
     INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
     MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE
     RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.
     SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL
     NECESSARY SERVICING, REPAIR OR CORRECTION.

 16. Limitation of Liability.

     IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
     WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES
     AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU
     FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
     CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE
     THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
     BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
     PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
     PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF
     THE POSSIBILITY OF SUCH DAMAGES.

 17. Interpretation of Sections 15 and 16.

     If the disclaimer of warranty and limitation of liability provided
     above cannot be given local legal effect according to their terms,
     reviewing courts shall apply local law that most closely
     approximates an absolute waiver of all civil liability in
     connection with the Program, unless a warranty or assumption of
     liability accompanies a copy of the Program in return for a fee.


END OF TERMS AND CONDITIONS
===========================

How to Apply These Terms to Your New Programs
=============================================

If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.

   To do so, attach the following notices to the program.  It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.

     ONE LINE TO GIVE THE PROGRAM'S NAME AND A BRIEF IDEA OF WHAT IT DOES.
     Copyright (C) YEAR NAME OF AUTHOR

     This program is free software: you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation, either version 3 of the License, or (at
     your option) any later version.

     This program is distributed in the hope that it will be useful, but
     WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     General Public License for more details.

     You should have received a copy of the GNU General Public License
     along with this program.  If not, see `http://www.gnu.org/licenses/'.

   Also add information on how to contact you by electronic and paper
mail.

   If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:

     PROGRAM Copyright (C) YEAR NAME OF AUTHOR
     This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
     This is free software, and you are welcome to redistribute it
     under certain conditions; type `show c' for details.

   The hypothetical commands `show w' and `show c' should show the
appropriate parts of the General Public License.  Of course, your
program's commands might be different; for a GUI interface, you would
use an "about box".

   You should also get your employer (if you work as a programmer) or
school, if any, to sign a "copyright disclaimer" for the program, if
necessary.  For more information on this, and how to apply and follow
the GNU GPL, see `http://www.gnu.org/licenses/'.

   The GNU General Public License does not permit incorporating your
program into proprietary programs.  If your program is a subroutine
library, you may consider it more useful to permit linking proprietary
applications with the library.  If this is what you want to do, use the
GNU Lesser General Public License instead of this License.  But first,
please read `http://www.gnu.org/philosophy/why-not-lgpl.html'.


File: elisp,  Node: Tips,  Next: GNU Emacs Internals,  Prev: GPL,  Up: Top

Appendix D Tips and Conventions
*******************************

This chapter describes no additional features of Emacs Lisp.  Instead
it gives advice on making effective use of the features described in the
previous chapters, and describes conventions Emacs Lisp programmers
should follow.

   You can automatically check some of the conventions described below
by running the command `M-x checkdoc RET' when visiting a Lisp file.
It cannot check all of the conventions, and not all the warnings it
gives necessarily correspond to problems, but it is worth examining them
all.

* Menu:

* Coding Conventions::        Conventions for clean and robust programs.
* Key Binding Conventions::   Which keys should be bound by which programs.
* Programming Tips::          Making Emacs code fit smoothly in Emacs.
* Compilation Tips::          Making compiled code run fast.
* Warning Tips::              Turning off compiler warnings.
* Documentation Tips::        Writing readable documentation strings.
* Comment Tips::	      Conventions for writing comments.
* Library Headers::           Standard headers for library packages.


File: elisp,  Node: Coding Conventions,  Next: Key Binding Conventions,  Up: Tips

D.1 Emacs Lisp Coding Conventions
=================================

Here are conventions that you should follow when writing Emacs Lisp
code intended for widespread use:

   * Simply loading the package should not change Emacs's editing
     behavior.  Include a command or commands to enable and disable the
     feature, or to invoke it.

     This convention is mandatory for any file that includes custom
     definitions.  If fixing such a file to follow this convention
     requires an incompatible change, go ahead and make the
     incompatible change; don't postpone it.

   * Since all global variables share the same name space, and all
     functions share another name space, you should choose a short word
     to distinguish your program from other Lisp programs(1).  Then
     take care to begin the names of all global variables, constants,
     and functions in your program with the chosen prefix.  This helps
     avoid name conflicts.

     Occasionally, for a command name intended for users to use, it is
     more convenient if some words come before the package's name
     prefix.  And constructs that define functions, variables, etc.,
     work better if they start with `defun' or `defvar', so put the
     name prefix later on in the name.

     This recommendation applies even to names for traditional Lisp
     primitives that are not primitives in Emacs Lisp--such as
     `copy-list'.  Believe it or not, there is more than one plausible
     way to define `copy-list'.  Play it safe; append your name prefix
     to produce a name like `foo-copy-list' or `mylib-copy-list'
     instead.

     If you write a function that you think ought to be added to Emacs
     under a certain name, such as `twiddle-files', don't call it by
     that name in your program.  Call it `mylib-twiddle-files' in your
     program, and send mail to `bug-gnu-emacs@gnu.org' suggesting we add
     it to Emacs.  If and when we do, we can change the name easily
     enough.

     If one prefix is insufficient, your package can use two or three
     alternative common prefixes, so long as they make sense.

     Separate the prefix from the rest of the symbol name with a hyphen,
     `-'.  This will be consistent with Emacs itself and with most Emacs
     Lisp programs.

   * Put a call to `provide' at the end of each separate Lisp file.

   * If a file requires certain other Lisp programs to be loaded
     beforehand, then the comments at the beginning of the file should
     say so.  Also, use `require' to make sure they are loaded.

   * If one file FOO uses a macro defined in another file BAR, FOO
     should contain this expression before the first use of the macro:

          (eval-when-compile (require 'BAR))

     (And the library BAR should contain `(provide 'BAR)', to make the
     `require' work.)  This will cause BAR to be loaded when you
     byte-compile FOO.  Otherwise, you risk compiling FOO without the
     necessary macro loaded, and that would produce compiled code that
     won't work right.  *Note Compiling Macros::.

     Using `eval-when-compile' avoids loading BAR when the compiled
     version of FOO is _used_.

   * Please don't require the `cl' package of Common Lisp extensions at
     run time.  Use of this package is optional, and it is not part of
     the standard Emacs namespace.  If your package loads `cl' at run
     time, that could cause name clashes for users who don't use that
     package.

     However, there is no problem with using the `cl' package at
     compile time, with `(eval-when-compile (require 'cl))'.  That's
     sufficient for using the macros in the `cl' package, because the
     compiler expands them before generating the byte-code.

   * When defining a major mode, please follow the major mode
     conventions.  *Note Major Mode Conventions::.

   * When defining a minor mode, please follow the minor mode
     conventions.  *Note Minor Mode Conventions::.

   * If the purpose of a function is to tell you whether a certain
     condition is true or false, give the function a name that ends in
     `p'.  If the name is one word, add just `p'; if the name is
     multiple words, add `-p'.  Examples are `framep' and
     `frame-live-p'.

   * If a user option variable records a true-or-false condition, give
     it a name that ends in `-flag'.

   * If the purpose of a variable is to store a single function, give
     it a name that ends in `-function'.  If the purpose of a variable
     is to store a list of functions (i.e., the variable is a hook),
     please follow the naming conventions for hooks.  *Note Hooks::.

   * If loading the file adds functions to hooks, define a function
     `FEATURE-unload-hook', where FEATURE is the name of the feature
     the package provides, and make it undo any such changes.  Using
     `unload-feature' to unload the file will run this function.  *Note
     Unloading::.

   * It is a bad idea to define aliases for the Emacs primitives.
     Normally you should use the standard names instead.  The case
     where an alias may be useful is where it facilitates backwards
     compatibility or portability.

   * If a package needs to define an alias or a new function for
     compatibility with some other version of Emacs, name it with the
     package prefix, not with the raw name with which it occurs in the
     other version.  Here is an example from Gnus, which provides many
     examples of such compatibility issues.

          (defalias 'gnus-point-at-bol
            (if (fboundp 'point-at-bol)
                'point-at-bol
              'line-beginning-position))

   * Redefining (or advising) an Emacs primitive is a bad idea.  It may
     do the right thing for a particular program, but there is no
     telling what other programs might break as a result.  In any case,
     it is a problem for debugging, because the advised function
     doesn't do what its source code says it does.  If the programmer
     investigating the problem is unaware that there is advice on the
     function, the experience can be very frustrating.

     We hope to remove all the places in Emacs that advise primitives.
     In the mean time, please don't add any more.

   * It is likewise a bad idea for one Lisp package to advise a function
     in another Lisp package.

   * Likewise, avoid using `eval-after-load' (*note Hooks for
     Loading::) in libraries and packages.  This feature is meant for
     personal customizations; using it in a Lisp program is unclean,
     because it modifies the behavior of another Lisp file in a way
     that's not visible in that file.  This is an obstacle for
     debugging, much like advising a function in the other package.

   * If a file does replace any of the functions or library programs of
     standard Emacs, prominent comments at the beginning of the file
     should say which functions are replaced, and how the behavior of
     the replacements differs from that of the originals.

   * Constructs that define a function or variable should be macros,
     not functions, and their names should start with `def'.

   * A macro that defines a function or variable should have a name that
     starts with `define-'.  The macro should receive the name to be
     defined as the first argument.  That will help various tools find
     the definition automatically.  Avoid constructing the names in the
     macro itself, since that would confuse these tools.

   * Please keep the names of your Emacs Lisp source files to 13
     characters or less.  This way, if the files are compiled, the
     compiled files' names will be 14 characters or less, which is
     short enough to fit on all kinds of Unix systems.

   * In some other systems there is a convention of choosing variable
     names that begin and end with `*'.  We don't use that convention
     in Emacs Lisp, so please don't use it in your programs.  (Emacs
     uses such names only for special-purpose buffers.)  The users will
     find Emacs more coherent if all libraries use the same conventions.

   * If your program contains non-ASCII characters in string or
     character constants, you should make sure Emacs always decodes
     these characters the same way, regardless of the user's settings.
     There are two ways to do that:

        - Use coding system `emacs-mule', and specify that for `coding'
          in the `-*-' line or the local variables list.

               ;; XXX.el  -*- coding: emacs-mule; -*-

        - Use one of the coding systems based on ISO 2022 (such as
          iso-8859-N and iso-2022-7bit), and specify it with `!' at the
          end for `coding'.  (The `!' turns off any possible character
          translation.)

               ;; XXX.el -*- coding: iso-latin-2!; -*-

   * Indent each function with `C-M-q' (`indent-sexp') using the
     default indentation parameters.

   * Don't make a habit of putting close-parentheses on lines by
     themselves; Lisp programmers find this disconcerting.  Once in a
     while, when there is a sequence of many consecutive
     close-parentheses, it may make sense to split the sequence in one
     or two significant places.

   * Please put a copyright notice and copying permission notice on the
     file if you distribute copies.  Use a notice like this one:

          ;; Copyright (C) YEAR NAME

          ;; This program is free software; you can redistribute it and/or
          ;; modify it under the terms of the GNU General Public License as
          ;; published by the Free Software Foundation; either version 3 of
          ;; the License, or (at your option) any later version.

          ;; This program is distributed in the hope that it will be
          ;; useful, but WITHOUT ANY WARRANTY; without even the implied
          ;; warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
          ;; PURPOSE.  See the GNU General Public License for more details.

          ;; You should have received a copy of the GNU General Public
          ;; License along with this program; if not, write to the Free
          ;; Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
          ;; Boston, MA 02110-1301 USA

     If you have signed papers to assign the copyright to the
     Foundation, then use `Free Software Foundation, Inc.' as NAME.
     Otherwise, use your name.  See also *Note Library Headers::.

   ---------- Footnotes ----------

   (1) The benefits of a Common Lisp-style package system are
considered not to outweigh the costs.


File: elisp,  Node: Key Binding Conventions,  Next: Programming Tips,  Prev: Coding Conventions,  Up: Tips

D.2 Key Binding Conventions
===========================

   * Special major modes used for read-only text should usually redefine
     `mouse-2' and <RET> to trace some sort of reference in the text.
     Modes such as Dired, Info, Compilation, and Occur redefine it in
     this way.

     In addition, they should mark the text as a kind of "link" so that
     `mouse-1' will follow it also.  *Note Links and Mouse-1::.

   * Please do not define `C-c LETTER' as a key in Lisp programs.
     Sequences consisting of `C-c' and a letter (either upper or lower
     case) are reserved for users; they are the *only* sequences
     reserved for users, so do not block them.

     Changing all the Emacs major modes to respect this convention was a
     lot of work; abandoning this convention would make that work go to
     waste, and inconvenience users.  Please comply with it.

   * Function keys <F5> through <F9> without modifier keys are also
     reserved for users to define.

   * Applications should not bind mouse events based on button 1 with
     the shift key held down.  These events include `S-mouse-1',
     `M-S-mouse-1', `C-S-mouse-1', and so on.  They are reserved for
     users.

   * Sequences consisting of `C-c' followed by a control character or a
     digit are reserved for major modes.

   * Sequences consisting of `C-c' followed by `{', `}', `<', `>', `:'
     or `;' are also reserved for major modes.

   * Sequences consisting of `C-c' followed by any other punctuation
     character are allocated for minor modes.  Using them in a major
     mode is not absolutely prohibited, but if you do that, the major
     mode binding may be shadowed from time to time by minor modes.

   * Do not bind `C-h' following any prefix character (including
     `C-c').  If you don't bind `C-h', it is automatically available as
     a help character for listing the subcommands of the prefix
     character.

   * Do not bind a key sequence ending in <ESC> except following
     another <ESC>.  (That is, it is OK to bind a sequence ending in
     `<ESC> <ESC>'.)

     The reason for this rule is that a non-prefix binding for <ESC> in
     any context prevents recognition of escape sequences as function
     keys in that context.

   * Anything which acts like a temporary mode or state which the user
     can enter and leave should define `<ESC> <ESC>' or `<ESC> <ESC>
     <ESC>' as a way to escape.

     For a state which accepts ordinary Emacs commands, or more
     generally any kind of state in which <ESC> followed by a function
     key or arrow key is potentially meaningful, then you must not
     define `<ESC> <ESC>', since that would preclude recognizing an
     escape sequence after <ESC>.  In these states, you should define
     `<ESC> <ESC> <ESC>' as the way to escape.  Otherwise, define
     `<ESC> <ESC>' instead.


File: elisp,  Node: Programming Tips,  Next: Compilation Tips,  Prev: Key Binding Conventions,  Up: Tips

D.3 Emacs Programming Tips
==========================

Following these conventions will make your program fit better into
Emacs when it runs.

   * Don't use `next-line' or `previous-line' in programs; nearly
     always, `forward-line' is more convenient as well as more
     predictable and robust.  *Note Text Lines::.

   * Don't call functions that set the mark, unless setting the mark is
     one of the intended features of your program.  The mark is a
     user-level feature, so it is incorrect to change the mark except
     to supply a value for the user's benefit.  *Note The Mark::.

     In particular, don't use any of these functions:

        * `beginning-of-buffer', `end-of-buffer'

        * `replace-string', `replace-regexp'

        * `insert-file', `insert-buffer'

     If you just want to move point, or replace a certain string, or
     insert a file or buffer's contents, without any of the other
     features intended for interactive users, you can replace these
     functions with one or two lines of simple Lisp code.

   * Use lists rather than vectors, except when there is a particular
     reason to use a vector.  Lisp has more facilities for manipulating
     lists than for vectors, and working with lists is usually more
     convenient.

     Vectors are advantageous for tables that are substantial in size
     and are accessed in random order (not searched front to back),
     provided there is no need to insert or delete elements (only lists
     allow that).

   * The recommended way to show a message in the echo area is with the
     `message' function, not `princ'.  *Note The Echo Area::.

   * When you encounter an error condition, call the function `error'
     (or `signal').  The function `error' does not return.  *Note
     Signaling Errors::.

     Do not use `message', `throw', `sleep-for', or `beep' to report
     errors.

   * An error message should start with a capital letter but should not
     end with a period.

   * A question asked in the minibuffer with `y-or-n-p' or
     `yes-or-no-p' should start with a capital letter and end with `? '.

   * When you mention a default value in a minibuffer prompt, put it
     and the word `default' inside parentheses.  It should look like
     this:

          Enter the answer (default 42):

   * In `interactive', if you use a Lisp expression to produce a list
     of arguments, don't try to provide the "correct" default values for
     region or position arguments.  Instead, provide `nil' for those
     arguments if they were not specified, and have the function body
     compute the default value when the argument is `nil'.  For
     instance, write this:

          (defun foo (pos)
            (interactive
             (list (if SPECIFIED SPECIFIED-POS)))
            (unless pos (setq pos DEFAULT-POS))
            ...)

     rather than this:

          (defun foo (pos)
            (interactive
             (list (if SPECIFIED SPECIFIED-POS
                       DEFAULT-POS)))
            ...)

     This is so that repetition of the command will recompute these
     defaults based on the current circumstances.

     You do not need to take such precautions when you use interactive
     specs `d', `m' and `r', because they make special arrangements to
     recompute the argument values on repetition of the command.

   * Many commands that take a long time to execute display a message
     that says something like `Operating...' when they start, and
     change it to `Operating...done' when they finish.  Please keep the
     style of these messages uniform: _no_ space around the ellipsis,
     and _no_ period after `done'.

   * Try to avoid using recursive edits.  Instead, do what the Rmail `e'
     command does: use a new local keymap that contains one command
     defined to switch back to the old local keymap.  Or do what the
     `edit-options' command does: switch to another buffer and let the
     user switch back at will.  *Note Recursive Editing::.


File: elisp,  Node: Compilation Tips,  Next: Warning Tips,  Prev: Programming Tips,  Up: Tips

D.4 Tips for Making Compiled Code Fast
======================================

Here are ways of improving the execution speed of byte-compiled Lisp
programs.

   * Profile your program with the `elp' library.  See the file
     `elp.el' for instructions.

   * Check the speed of individual Emacs Lisp forms using the
     `benchmark' library.  See the functions `benchmark-run' and
     `benchmark-run-compiled' in `benchmark.el'.

   * Use iteration rather than recursion whenever possible.  Function
     calls are slow in Emacs Lisp even when a compiled function is
     calling another compiled function.

   * Using the primitive list-searching functions `memq', `member',
     `assq', or `assoc' is even faster than explicit iteration.  It can
     be worth rearranging a data structure so that one of these
     primitive search functions can be used.

   * Certain built-in functions are handled specially in byte-compiled
     code, avoiding the need for an ordinary function call.  It is a
     good idea to use these functions rather than alternatives.  To see
     whether a function is handled specially by the compiler, examine
     its `byte-compile' property.  If the property is non-`nil', then
     the function is handled specially.

     For example, the following input will show you that `aref' is
     compiled specially (*note Array Functions::):

          (get 'aref 'byte-compile)
               => byte-compile-two-args

   * If calling a small function accounts for a substantial part of your
     program's running time, make the function inline.  This eliminates
     the function call overhead.  Since making a function inline reduces
     the flexibility of changing the program, don't do it unless it
     gives a noticeable speedup in something slow enough that users
     care about the speed.  *Note Inline Functions::.


File: elisp,  Node: Warning Tips,  Next: Documentation Tips,  Prev: Compilation Tips,  Up: Tips

D.5 Tips for Avoiding Compiler Warnings
=======================================

   * Try to avoid compiler warnings about undefined free variables, by
     adding dummy `defvar' definitions for these variables, like this:

          (defvar foo)

     Such a definition has no effect except to tell the compiler not to
     warn about uses of the variable `foo' in this file.

   * If you use many functions and variables from a certain file, you
     can add a `require' for that package to avoid compilation warnings
     for them.  For instance,

          (eval-when-compile
            (require 'foo))

   * If you bind a variable in one function, and use it or set it in
     another function, the compiler warns about the latter function
     unless the variable has a definition.  But adding a definition
     would be unclean if the variable has a short name, since Lisp
     packages should not define short variable names.  The right thing
     to do is to rename this variable to start with the name prefix
     used for the other functions and variables in your package.

   * The last resort for avoiding a warning, when you want to do
     something that usually is a mistake but it's not a mistake in this
     one case, is to put a call to `with-no-warnings' around it.


File: elisp,  Node: Documentation Tips,  Next: Comment Tips,  Prev: Warning Tips,  Up: Tips

D.6 Tips for Documentation Strings
==================================

Here are some tips and conventions for the writing of documentation
strings.  You can check many of these conventions by running the command
`M-x checkdoc-minor-mode'.

   * Every command, function, or variable intended for users to know
     about should have a documentation string.

   * An internal variable or subroutine of a Lisp program might as well
     have a documentation string.  In earlier Emacs versions, you could
     save space by using a comment instead of a documentation string,
     but that is no longer the case--documentation strings now take up
     very little space in a running Emacs.

   * Format the documentation string so that it fits in an Emacs window
     on an 80-column screen.  It is a good idea for most lines to be no
     wider than 60 characters.  The first line should not be wider than
     67 characters or it will look bad in the output of `apropos'.

     You can fill the text if that looks good.  However, rather than
     blindly filling the entire documentation string, you can often
     make it much more readable by choosing certain line breaks with
     care.  Use blank lines between topics if the documentation string
     is long.

   * The first line of the documentation string should consist of one
     or two complete sentences that stand on their own as a summary.
     `M-x apropos' displays just the first line, and if that line's
     contents don't stand on their own, the result looks bad.  In
     particular, start the first line with a capital letter and end
     with a period.

     For a function, the first line should briefly answer the question,
     "What does this function do?"  For a variable, the first line
     should briefly answer the question, "What does this value mean?"

     Don't limit the documentation string to one line; use as many
     lines as you need to explain the details of how to use the
     function or variable.  Please use complete sentences for the rest
     of the text too.

   * When the user tries to use a disabled command, Emacs displays just
     the first paragraph of its documentation string--everything
     through the first blank line.  If you wish, you can choose which
     information to include before the first blank line so as to make
     this display useful.

   * The first line should mention all the important arguments of the
     function, and should mention them in the order that they are
     written in a function call.  If the function has many arguments,
     then it is not feasible to mention them all in the first line; in
     that case, the first line should mention the first few arguments,
     including the most important arguments.

   * When a function's documentation string mentions the value of an
     argument of the function, use the argument name in capital letters
     as if it were a name for that value.  Thus, the documentation
     string of the function `eval' refers to its second argument as
     `FORM', because the actual argument name is `form':

          Evaluate FORM and return its value.

     Also write metasyntactic variables in capital letters, such as
     when you show the decomposition of a list or vector into subunits,
     some of which may vary.  `KEY' and `VALUE' in the following example
     illustrate this practice:

          The argument TABLE should be an alist whose elements
          have the form (KEY . VALUE).  Here, KEY is ...

   * Never change the case of a Lisp symbol when you mention it in a doc
     string.  If the symbol's name is `foo', write "foo," not "Foo"
     (which is a different symbol).

     This might appear to contradict the policy of writing function
     argument values, but there is no real contradiction; the argument
     _value_ is not the same thing as the _symbol_ which the function
     uses to hold the value.

     If this puts a lower-case letter at the beginning of a sentence
     and that annoys you, rewrite the sentence so that the symbol is
     not at the start of it.

   * Do not start or end a documentation string with whitespace.

   * *Do not* indent subsequent lines of a documentation string so that
     the text is lined up in the source code with the text of the first
     line.  This looks nice in the source code, but looks bizarre when
     users view the documentation.  Remember that the indentation
     before the starting double-quote is not part of the string!

   * When a documentation string refers to a Lisp symbol, write it as it
     would be printed (which usually means in lower case), with
     single-quotes around it.  For example: `lambda'.  There are two
     exceptions: write t and nil without single-quotes.  (In this
     manual, we use a different convention, with single-quotes for all
     symbols.)

     Help mode automatically creates a hyperlink when a documentation
     string uses a symbol name inside single quotes, if the symbol has
     either a function or a variable definition.  You do not need to do
     anything special to make use of this feature.  However, when a
     symbol has both a function definition and a variable definition,
     and you want to refer to just one of them, you can specify which
     one by writing one of the words `variable', `option', `function',
     or `command', immediately before the symbol name.  (Case makes no
     difference in recognizing these indicator words.)  For example, if
     you write

          This function sets the variable `buffer-file-name'.

     then the hyperlink will refer only to the variable documentation of
     `buffer-file-name', and not to its function documentation.

     If a symbol has a function definition and/or a variable
     definition, but those are irrelevant to the use of the symbol that
     you are documenting, you can write the words `symbol' or `program'
     before the symbol name to prevent making any hyperlink.  For
     example,

          If the argument KIND-OF-RESULT is the symbol `list',
          this function returns a list of all the objects
          that satisfy the criterion.

     does not make a hyperlink to the documentation, irrelevant here,
     of the function `list'.

     Normally, no hyperlink is made for a variable without variable
     documentation.  You can force a hyperlink for such variables by
     preceding them with one of the words `variable' or `option'.

     Hyperlinks for faces are only made if the face name is preceded or
     followed by the word `face'.  In that case, only the face
     documentation will be shown, even if the symbol is also defined as
     a variable or as a function.

     To make a hyperlink to Info documentation, write the name of the
     Info node (or anchor) in single quotes, preceded by `info node',
     `Info node', `info anchor' or `Info anchor'.  The Info file name
     defaults to `emacs'.  For example,

          See Info node `Font Lock' and Info node `(elisp)Font Lock Basics'.

     Finally, to create a hyperlink to URLs, write the URL in single
     quotes, preceded by `URL'. For example,

          The home page for the GNU project has more information (see URL
          `http://www.gnu.org/').

   * Don't write key sequences directly in documentation strings.
     Instead, use the `\\[...]' construct to stand for them.  For
     example, instead of writing `C-f', write the construct
     `\\[forward-char]'.  When Emacs displays the documentation string,
     it substitutes whatever key is currently bound to `forward-char'.
     (This is normally `C-f', but it may be some other character if the
     user has moved key bindings.)  *Note Keys in Documentation::.

   * In documentation strings for a major mode, you will want to refer
     to the key bindings of that mode's local map, rather than global
     ones.  Therefore, use the construct `\\<...>' once in the
     documentation string to specify which key map to use.  Do this
     before the first use of `\\[...]'.  The text inside the `\\<...>'
     should be the name of the variable containing the local keymap for
     the major mode.

     It is not practical to use `\\[...]' very many times, because
     display of the documentation string will become slow.  So use this
     to describe the most important commands in your major mode, and
     then use `\\{...}' to display the rest of the mode's keymap.

   * For consistency, phrase the verb in the first sentence of a
     function's documentation string as an imperative--for instance,
     use "Return the cons of A and B." in preference to "Returns the
     cons of A and B."  Usually it looks good to do likewise for the
     rest of the first paragraph.  Subsequent paragraphs usually look
     better if each sentence is indicative and has a proper subject.

   * The documentation string for a function that is a yes-or-no
     predicate should start with words such as "Return t if," to
     indicate explicitly what constitutes "truth."  The word "return"
     avoids starting the sentence with lower-case "t," which could be
     somewhat distracting.

   * If a line in a documentation string begins with an
     open-parenthesis, write a backslash before the open-parenthesis,
     like this:

          The argument FOO can be either a number
          \(a buffer position) or a string (a file name).

     This prevents the open-parenthesis from being treated as the start
     of a defun (*note Defuns: (emacs)Defuns.).

   * Write documentation strings in the active voice, not the passive,
     and in the present tense, not the future.  For instance, use
     "Return a list containing A and B." instead of "A list containing
     A and B will be returned."

   * Avoid using the word "cause" (or its equivalents) unnecessarily.
     Instead of, "Cause Emacs to display text in boldface," write just
     "Display text in boldface."

   * Avoid using "iff" (a mathematics term meaning "if and only if"),
     since many people are unfamiliar with it and mistake it for a
     typo.  In most cases, the meaning is clear with just "if".
     Otherwise, try to find an alternate phrasing that conveys the
     meaning.

   * When a command is meaningful only in a certain mode or situation,
     do mention that in the documentation string.  For example, the
     documentation of `dired-find-file' is:

          In Dired, visit the file or directory named on this line.

   * When you define a variable that users ought to set interactively,
     you normally should use `defcustom'.  However, if for some reason
     you use `defvar' instead, start the doc string with a `*'.  *Note
     Defining Variables::.

   * The documentation string for a variable that is a yes-or-no flag
     should start with words such as "Non-nil means," to make it clear
     that all non-`nil' values are equivalent and indicate explicitly
     what `nil' and non-`nil' mean.


File: elisp,  Node: Comment Tips,  Next: Library Headers,  Prev: Documentation Tips,  Up: Tips

D.7 Tips on Writing Comments
============================

We recommend these conventions for where to put comments and how to
indent them:

`;'
     Comments that start with a single semicolon, `;', should all be
     aligned to the same column on the right of the source code.  Such
     comments usually explain how the code on the same line does its
     job.  In Lisp mode and related modes, the `M-;'
     (`indent-for-comment') command automatically inserts such a `;' in
     the right place, or aligns such a comment if it is already present.

     This and following examples are taken from the Emacs sources.

          (setq base-version-list                 ; there was a base
                (assoc (substring fn 0 start-vn)  ; version to which
                       file-version-assoc-list))  ; this looks like
                                                  ; a subversion

`;;'
     Comments that start with two semicolons, `;;', should be aligned to
     the same level of indentation as the code.  Such comments usually
     describe the purpose of the following lines or the state of the
     program at that point.  For example:

          (prog1 (setq auto-fill-function
                       ...
                       ...
            ;; update mode line
            (force-mode-line-update)))

     We also normally use two semicolons for comments outside functions.

          ;; This Lisp code is run in Emacs
          ;; when it is to operate as a server
          ;; for other processes.

     Every function that has no documentation string (presumably one
     that is used only internally within the package it belongs to),
     should instead have a two-semicolon comment right before the
     function, explaining what the function does and how to call it
     properly.  Explain precisely what each argument means and how the
     function interprets its possible values.

`;;;'
     Comments that start with three semicolons, `;;;', should start at
     the left margin.  These are used, occasionally, for comments within
     functions that should start at the margin.  We also use them
     sometimes for comments that are between functions--whether to use
     two or three semicolons depends on whether the comment should be
     considered a "heading" by Outline minor mode.  By default,
     comments starting with at least three semicolons (followed by a
     single space and a non-whitespace character) are considered
     headings, comments starting with two or less are not.

     Another use for triple-semicolon comments is for commenting out
     lines within a function.  We use three semicolons for this
     precisely so that they remain at the left margin.  By default,
     Outline minor mode does not consider a comment to be a heading
     (even if it starts with at least three semicolons) if the
     semicolons are followed by at least two spaces.  Thus, if you add
     an introductory comment to the commented out code, make sure to
     indent it by at least two spaces after the three semicolons.

          (defun foo (a)
          ;;;  This is no longer necessary.
          ;;;  (force-mode-line-update)
            (message "Finished with %s" a))

     When commenting out entire functions, use two semicolons.

`;;;;'
     Comments that start with four semicolons, `;;;;', should be aligned
     to the left margin and are used for headings of major sections of a
     program.  For example:

          ;;;; The kill ring

The indentation commands of the Lisp modes in Emacs, such as `M-;'
(`indent-for-comment') and <TAB> (`lisp-indent-line'), automatically
indent comments according to these conventions, depending on the number
of semicolons.  *Note Manipulating Comments: (emacs)Comments.


File: elisp,  Node: Library Headers,  Prev: Comment Tips,  Up: Tips

D.8 Conventional Headers for Emacs Libraries
============================================

Emacs has conventions for using special comments in Lisp libraries to
divide them into sections and give information such as who wrote them.
This section explains these conventions.

   We'll start with an example, a package that is included in the Emacs
distribution.

   Parts of this example reflect its status as part of Emacs; for
example, the copyright notice lists the Free Software Foundation as the
copyright holder, and the copying permission says the file is part of
Emacs.  When you write a package and post it, the copyright holder would
be you (unless your employer claims to own it instead), and you should
get the suggested copying permission from the end of the GNU General
Public License itself.  Don't say your file is part of Emacs if we
haven't installed it in Emacs yet!

   With that warning out of the way, on to the example:

     ;;; lisp-mnt.el --- minor mode for Emacs Lisp maintainers

     ;; Copyright (C) 1992 Free Software Foundation, Inc.

     ;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
     ;; Maintainer: Eric S. Raymond <esr@snark.thyrsus.com>
     ;; Created: 14 Jul 1992
     ;; Version: 1.2
     ;; Keywords: docs

     ;; This file is part of GNU Emacs.
     ...
     ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     ;; Boston, MA 02110-1301, USA.

   The very first line should have this format:

     ;;; FILENAME --- DESCRIPTION

The description should be complete in one line.  If the file needs a
`-*-' specification, put it after DESCRIPTION.

   After the copyright notice come several "header comment" lines, each
beginning with `;; HEADER-NAME:'.  Here is a table of the conventional
possibilities for HEADER-NAME:

`Author'
     This line states the name and net address of at least the principal
     author of the library.

     If there are multiple authors, you can list them on continuation
     lines led by `;;' and a tab character, like this:

          ;; Author: Ashwin Ram <Ram-Ashwin@cs.yale.edu>
          ;;      Dave Sill <de5@ornl.gov>
          ;;      Dave Brennan <brennan@hal.com>
          ;;      Eric Raymond <esr@snark.thyrsus.com>

`Maintainer'
     This line should contain a single name/address as in the Author
     line, or an address only, or the string `FSF'.  If there is no
     maintainer line, the person(s) in the Author field are presumed to
     be the maintainers.  The example above is mildly bogus because the
     maintainer line is redundant.

     The idea behind the `Author' and `Maintainer' lines is to make
     possible a Lisp function to "send mail to the maintainer" without
     having to mine the name out by hand.

     Be sure to surround the network address with `<...>' if you
     include the person's full name as well as the network address.

`Created'
     This optional line gives the original creation date of the file.
     For historical interest only.

`Version'
     If you wish to record version numbers for the individual Lisp
     program, put them in this line.

`Adapted-By'
     In this header line, place the name of the person who adapted the
     library for installation (to make it fit the style conventions, for
     example).

`Keywords'
     This line lists keywords for the `finder-by-keyword' help command.
     Please use that command to see a list of the meaningful keywords.

     This field is important; it's how people will find your package
     when they're looking for things by topic area.  To separate the
     keywords, you can use spaces, commas, or both.

   Just about every Lisp library ought to have the `Author' and
`Keywords' header comment lines.  Use the others if they are
appropriate.  You can also put in header lines with other header
names--they have no standard meanings, so they can't do any harm.

   We use additional stylized comments to subdivide the contents of the
library file.  These should be separated by blank lines from anything
else.  Here is a table of them:

`;;; Commentary:'
     This begins introductory comments that explain how the library
     works.  It should come right after the copying permissions,
     terminated by a `Change Log', `History' or `Code' comment line.
     This text is used by the Finder package, so it should make sense
     in that context.

`;;; Documentation:'
     This was used in some files in place of `;;; Commentary:', but it
     is deprecated.

`;;; Change Log:'
     This begins change log information stored in the library file (if
     you store the change history there).  For Lisp files distributed
     with Emacs, the change history is kept in the file `ChangeLog' and
     not in the source file at all; these files generally do not have a
     `;;; Change Log:' line.  `History' is an alternative to `Change
     Log'.

`;;; Code:'
     This begins the actual code of the program.

`;;; FILENAME ends here'
     This is the "footer line"; it appears at the very end of the file.
     Its purpose is to enable people to detect truncated versions of
     the file from the lack of a footer line.


File: elisp,  Node: GNU Emacs Internals,  Next: Standard Errors,  Prev: Tips,  Up: Top

Appendix E GNU Emacs Internals
******************************

This chapter describes how the runnable Emacs executable is dumped with
the preloaded Lisp libraries in it, how storage is allocated, and some
internal aspects of GNU Emacs that may be of interest to C programmers.

* Menu:

* Building Emacs::      How the dumped Emacs is made.
* Pure Storage::        A kludge to make preloaded Lisp functions sharable.
* Garbage Collection::  Reclaiming space for Lisp objects no longer used.
* Memory Usage::        Info about total size of Lisp objects made so far.
* Writing Emacs Primitives::   Writing C code for Emacs.
* Object Internals::    Data formats of buffers, windows, processes.


File: elisp,  Node: Building Emacs,  Next: Pure Storage,  Up: GNU Emacs Internals

E.1 Building Emacs
==================

This section explains the steps involved in building the Emacs
executable.  You don't have to know this material to build and install
Emacs, since the makefiles do all these things automatically.  This
information is pertinent to Emacs maintenance.

   Compilation of the C source files in the `src' directory produces an
executable file called `temacs', also called a "bare impure Emacs".  It
contains the Emacs Lisp interpreter and I/O routines, but not the
editing commands.

   The command `temacs -l loadup' uses `temacs' to create the real
runnable Emacs executable.  These arguments direct `temacs' to evaluate
the Lisp files specified in the file `loadup.el'.  These files set up
the normal Emacs editing environment, resulting in an Emacs that is
still impure but no longer bare.

   It takes a substantial time to load the standard Lisp files.
Luckily, you don't have to do this each time you run Emacs; `temacs' can
dump out an executable program called `emacs' that has these files
preloaded.  `emacs' starts more quickly because it does not need to
load the files.  This is the Emacs executable that is normally
installed.

   To create `emacs', use the command `temacs -batch -l loadup dump'.
The purpose of `-batch' here is to prevent `temacs' from trying to
initialize any of its data on the terminal; this ensures that the
tables of terminal information are empty in the dumped Emacs.  The
argument `dump' tells `loadup.el' to dump a new executable named
`emacs'.

   Some operating systems don't support dumping.  On those systems, you
must start Emacs with the `temacs -l loadup' command each time you use
it.  This takes a substantial time, but since you need to start Emacs
once a day at most--or once a week if you never log out--the extra time
is not too severe a problem.

   You can specify additional files to preload by writing a library
named `site-load.el' that loads them.  You may need to add a definition

     #define SITELOAD_PURESIZE_EXTRA N

to make N added bytes of pure space to hold the additional files.  (Try
adding increments of 20000 until it is big enough.)  However, the
advantage of preloading additional files decreases as machines get
faster.  On modern machines, it is usually not advisable.

   After `loadup.el' reads `site-load.el', it finds the documentation
strings for primitive and preloaded functions (and variables) in the
file `etc/DOC' where they are stored, by calling `Snarf-documentation'
(*note Accessing Documentation: Definition of Snarf-documentation.).

   You can specify other Lisp expressions to execute just before dumping
by putting them in a library named `site-init.el'.  This file is
executed after the documentation strings are found.

   If you want to preload function or variable definitions, there are
three ways you can do this and make their documentation strings
accessible when you subsequently run Emacs:

   * Arrange to scan these files when producing the `etc/DOC' file, and
     load them with `site-load.el'.

   * Load the files with `site-init.el', then copy the files into the
     installation directory for Lisp files when you install Emacs.

   * Specify a non-`nil' value for `byte-compile-dynamic-docstrings' as
     a local variable in each of these files, and load them with either
     `site-load.el' or `site-init.el'.  (This method has the drawback
     that the documentation strings take up space in Emacs all the
     time.)

   It is not advisable to put anything in `site-load.el' or
`site-init.el' that would alter any of the features that users expect
in an ordinary unmodified Emacs.  If you feel you must override normal
features for your site, do it with `default.el', so that users can
override your changes if they wish.  *Note Startup Summary::.

   In a package that can be preloaded, it is sometimes useful to
specify a computation to be done when Emacs subsequently starts up.
For this, use `eval-at-startup':

 -- Macro: eval-at-startup body...
     This evaluates the BODY forms, either immediately if running in an
     Emacs that has already started up, or later when Emacs does start
     up.  Since the value of the BODY forms is not necessarily
     available when the `eval-at-startup' form is run, that form always
     returns `nil'.

 -- Function: dump-emacs to-file from-file
     This function dumps the current state of Emacs into an executable
     file TO-FILE.  It takes symbols from FROM-FILE (this is normally
     the executable file `temacs').

     If you want to use this function in an Emacs that was already
     dumped, you must run Emacs with `-batch'.


File: elisp,  Node: Pure Storage,  Next: Garbage Collection,  Prev: Building Emacs,  Up: GNU Emacs Internals

E.2 Pure Storage
================

Emacs Lisp uses two kinds of storage for user-created Lisp objects:
"normal storage" and "pure storage".  Normal storage is where all the
new data created during an Emacs session are kept; see the following
section for information on normal storage.  Pure storage is used for
certain data in the preloaded standard Lisp files--data that should
never change during actual use of Emacs.

   Pure storage is allocated only while `temacs' is loading the
standard preloaded Lisp libraries.  In the file `emacs', it is marked
as read-only (on operating systems that permit this), so that the
memory space can be shared by all the Emacs jobs running on the machine
at once.  Pure storage is not expandable; a fixed amount is allocated
when Emacs is compiled, and if that is not sufficient for the preloaded
libraries, `temacs' allocates dynamic memory for the part that didn't
fit.  If that happens, you should increase the compilation parameter
`PURESIZE' in the file `src/puresize.h' and rebuild Emacs, even though
the resulting image will work: garbage collection is disabled in this
situation, causing a memory leak.  Such an overflow normally won't
happen unless you try to preload additional libraries or add features
to the standard ones.  Emacs will display a warning about the overflow
when it starts.

 -- Function: purecopy object
     This function makes a copy in pure storage of OBJECT, and returns
     it.  It copies a string by simply making a new string with the same
     characters, but without text properties, in pure storage.  It
     recursively copies the contents of vectors and cons cells.  It does
     not make copies of other objects such as symbols, but just returns
     them unchanged.  It signals an error if asked to copy markers.

     This function is a no-op except while Emacs is being built and
     dumped; it is usually called only in the file
     `emacs/lisp/loaddefs.el', but a few packages call it just in case
     you decide to preload them.

 -- Variable: pure-bytes-used
     The value of this variable is the number of bytes of pure storage
     allocated so far.  Typically, in a dumped Emacs, this number is
     very close to the total amount of pure storage available--if it
     were not, we would preallocate less.

 -- Variable: purify-flag
     This variable determines whether `defun' should make a copy of the
     function definition in pure storage.  If it is non-`nil', then the
     function definition is copied into pure storage.

     This flag is `t' while loading all of the basic functions for
     building Emacs initially (allowing those functions to be sharable
     and non-collectible).  Dumping Emacs as an executable always writes
     `nil' in this variable, regardless of the value it actually has
     before and after dumping.

     You should not change this flag in a running Emacs.


File: elisp,  Node: Garbage Collection,  Next: Memory Usage,  Prev: Pure Storage,  Up: GNU Emacs Internals

E.3 Garbage Collection
======================

When a program creates a list or the user defines a new function (such
as by loading a library), that data is placed in normal storage.  If
normal storage runs low, then Emacs asks the operating system to
allocate more memory in blocks of 1k bytes.  Each block is used for one
type of Lisp object, so symbols, cons cells, markers, etc., are
segregated in distinct blocks in memory.  (Vectors, long strings,
buffers and certain other editing types, which are fairly large, are
allocated in individual blocks, one per object, while small strings are
packed into blocks of 8k bytes.)

   It is quite common to use some storage for a while, then release it
by (for example) killing a buffer or deleting the last pointer to an
object.  Emacs provides a "garbage collector" to reclaim this abandoned
storage.  (This name is traditional, but "garbage recycler" might be a
more intuitive metaphor for this facility.)

   The garbage collector operates by finding and marking all Lisp
objects that are still accessible to Lisp programs.  To begin with, it
assumes all the symbols, their values and associated function
definitions, and any data presently on the stack, are accessible.  Any
objects that can be reached indirectly through other accessible objects
are also accessible.

   When marking is finished, all objects still unmarked are garbage.  No
matter what the Lisp program or the user does, it is impossible to refer
to them, since there is no longer a way to reach them.  Their space
might as well be reused, since no one will miss them.  The second
("sweep") phase of the garbage collector arranges to reuse them.

   The sweep phase puts unused cons cells onto a "free list" for future
allocation; likewise for symbols and markers.  It compacts the
accessible strings so they occupy fewer 8k blocks; then it frees the
other 8k blocks.  Vectors, buffers, windows, and other large objects are
individually allocated and freed using `malloc' and `free'.

     Common Lisp note: Unlike other Lisps, GNU Emacs Lisp does not call
     the garbage collector when the free list is empty.  Instead, it
     simply requests the operating system to allocate more storage, and
     processing continues until `gc-cons-threshold' bytes have been
     used.

     This means that you can make sure that the garbage collector will
     not run during a certain portion of a Lisp program by calling the
     garbage collector explicitly just before it (provided that portion
     of the program does not use so much space as to force a second
     garbage collection).

 -- Command: garbage-collect
     This command runs a garbage collection, and returns information on
     the amount of space in use.  (Garbage collection can also occur
     spontaneously if you use more than `gc-cons-threshold' bytes of
     Lisp data since the previous garbage collection.)

     `garbage-collect' returns a list containing the following
     information:

          ((USED-CONSES . FREE-CONSES)
           (USED-SYMS . FREE-SYMS)
           (USED-MISCS . FREE-MISCS)
           USED-STRING-CHARS
           USED-VECTOR-SLOTS
           (USED-FLOATS . FREE-FLOATS)
           (USED-INTERVALS . FREE-INTERVALS)
           (USED-STRINGS . FREE-STRINGS))

     Here is an example:

          (garbage-collect)
               => ((106886 . 13184) (9769 . 0)
                          (7731 . 4651) 347543 121628
                          (31 . 94) (1273 . 168)
                          (25474 . 3569))

     Here is a table explaining each element:

    USED-CONSES
          The number of cons cells in use.

    FREE-CONSES
          The number of cons cells for which space has been obtained
          from the operating system, but that are not currently being
          used.

    USED-SYMS
          The number of symbols in use.

    FREE-SYMS
          The number of symbols for which space has been obtained from
          the operating system, but that are not currently being used.

    USED-MISCS
          The number of miscellaneous objects in use.  These include
          markers and overlays, plus certain objects not visible to
          users.

    FREE-MISCS
          The number of miscellaneous objects for which space has been
          obtained from the operating system, but that are not
          currently being used.

    USED-STRING-CHARS
          The total size of all strings, in characters.

    USED-VECTOR-SLOTS
          The total number of elements of existing vectors.

    USED-FLOATS
          The number of floats in use.

    FREE-FLOATS
          The number of floats for which space has been obtained from
          the operating system, but that are not currently being used.

    USED-INTERVALS
          The number of intervals in use.  Intervals are an internal
          data structure used for representing text properties.

    FREE-INTERVALS
          The number of intervals for which space has been obtained
          from the operating system, but that are not currently being
          used.

    USED-STRINGS
          The number of strings in use.

    FREE-STRINGS
          The number of string headers for which the space was obtained
          from the operating system, but which are currently not in
          use.  (A string object consists of a header and the storage
          for the string text itself; the latter is only allocated when
          the string is created.)

     If there was overflow in pure space (see the previous section),
     `garbage-collect' returns `nil', because a real garbage collection
     can not be done in this situation.

 -- User Option: garbage-collection-messages
     If this variable is non-`nil', Emacs displays a message at the
     beginning and end of garbage collection.  The default value is
     `nil', meaning there are no such messages.

 -- Variable: post-gc-hook
     This is a normal hook that is run at the end of garbage collection.
     Garbage collection is inhibited while the hook functions run, so be
     careful writing them.

 -- User Option: gc-cons-threshold
     The value of this variable is the number of bytes of storage that
     must be allocated for Lisp objects after one garbage collection in
     order to trigger another garbage collection.  A cons cell counts
     as eight bytes, a string as one byte per character plus a few
     bytes of overhead, and so on; space allocated to the contents of
     buffers does not count.  Note that the subsequent garbage
     collection does not happen immediately when the threshold is
     exhausted, but only the next time the Lisp evaluator is called.

     The initial threshold value is 400,000.  If you specify a larger
     value, garbage collection will happen less often.  This reduces the
     amount of time spent garbage collecting, but increases total
     memory use.  You may want to do this when running a program that
     creates lots of Lisp data.

     You can make collections more frequent by specifying a smaller
     value, down to 10,000.  A value less than 10,000 will remain in
     effect only until the subsequent garbage collection, at which time
     `garbage-collect' will set the threshold back to 10,000.

 -- User Option: gc-cons-percentage
     The value of this variable specifies the amount of consing before a
     garbage collection occurs, as a fraction of the current heap size.
     This criterion and `gc-cons-threshold' apply in parallel, and
     garbage collection occurs only when both criteria are satisfied.

     As the heap size increases, the time to perform a garbage
     collection increases.  Thus, it can be desirable to do them less
     frequently in proportion.

   The value returned by `garbage-collect' describes the amount of
memory used by Lisp data, broken down by data type.  By contrast, the
function `memory-limit' provides information on the total amount of
memory Emacs is currently using.

 -- Function: memory-limit
     This function returns the address of the last byte Emacs has
     allocated, divided by 1024.  We divide the value by 1024 to make
     sure it fits in a Lisp integer.

     You can use this to get a general idea of how your actions affect
     the memory usage.

 -- Variable: memory-full
     This variable is `t' if Emacs is close to out of memory for Lisp
     objects, and `nil' otherwise.

 -- Function: memory-use-counts
     This returns a list of numbers that count the number of objects
     created in this Emacs session.  Each of these counters increments
     for a certain kind of object.  See the documentation string for
     details.

 -- Variable: gcs-done
     This variable contains the total number of garbage collections
     done so far in this Emacs session.

 -- Variable: gc-elapsed
     This variable contains the total number of seconds of elapsed time
     during garbage collection so far in this Emacs session, as a
     floating point number.


File: elisp,  Node: Memory Usage,  Next: Writing Emacs Primitives,  Prev: Garbage Collection,  Up: GNU Emacs Internals

E.4 Memory Usage
================

These functions and variables give information about the total amount
of memory allocation that Emacs has done, broken down by data type.
Note the difference between these and the values returned by
`(garbage-collect)'; those count objects that currently exist, but
these count the number or size of all allocations, including those for
objects that have since been freed.

 -- Variable: cons-cells-consed
     The total number of cons cells that have been allocated so far in
     this Emacs session.

 -- Variable: floats-consed
     The total number of floats that have been allocated so far in this
     Emacs session.

 -- Variable: vector-cells-consed
     The total number of vector cells that have been allocated so far
     in this Emacs session.

 -- Variable: symbols-consed
     The total number of symbols that have been allocated so far in
     this Emacs session.

 -- Variable: string-chars-consed
     The total number of string characters that have been allocated so
     far in this Emacs session.

 -- Variable: misc-objects-consed
     The total number of miscellaneous objects that have been allocated
     so far in this Emacs session.  These include markers and overlays,
     plus certain objects not visible to users.

 -- Variable: intervals-consed
     The total number of intervals that have been allocated so far in
     this Emacs session.

 -- Variable: strings-consed
     The total number of strings that have been allocated so far in this
     Emacs session.


File: elisp,  Node: Writing Emacs Primitives,  Next: Object Internals,  Prev: Memory Usage,  Up: GNU Emacs Internals

E.5 Writing Emacs Primitives
============================

Lisp primitives are Lisp functions implemented in C.  The details of
interfacing the C function so that Lisp can call it are handled by a few
C macros.  The only way to really understand how to write new C code is
to read the source, but we can explain some things here.

   An example of a special form is the definition of `or', from
`eval.c'.  (An ordinary function would have the same general
appearance.)

     DEFUN ("or", For, Sor, 0, UNEVALLED, 0,
       doc: /* Eval args until one of them yields non-nil, then return that
     value. The remaining args are not evalled at all.
     If all args return nil, return nil.
     usage: (or CONDITIONS ...)  */)
       (args)
          Lisp_Object args;
     {
       register Lisp_Object val = Qnil;
       struct gcpro gcpro1;

       GCPRO1 (args);

       while (CONSP (args))
         {
           val = Feval (XCAR (args));
           if (!NILP (val))
             break;
           args = XCDR (args);
         }

       UNGCPRO;
       return val;
     }

   Let's start with a precise explanation of the arguments to the
`DEFUN' macro.  Here is a template for them:

     DEFUN (LNAME, FNAME, SNAME, MIN, MAX, INTERACTIVE, DOC)

LNAME
     This is the name of the Lisp symbol to define as the function
     name; in the example above, it is `or'.

FNAME
     This is the C function name for this function.  This is the name
     that is used in C code for calling the function.  The name is, by
     convention, `F' prepended to the Lisp name, with all dashes (`-')
     in the Lisp name changed to underscores.  Thus, to call this
     function from C code, call `For'.  Remember that the arguments must
     be of type `Lisp_Object'; various macros and functions for creating
     values of type `Lisp_Object' are declared in the file `lisp.h'.

SNAME
     This is a C variable name to use for a structure that holds the
     data for the subr object that represents the function in Lisp.
     This structure conveys the Lisp symbol name to the initialization
     routine that will create the symbol and store the subr object as
     its definition.  By convention, this name is always FNAME with `F'
     replaced with `S'.

MIN
     This is the minimum number of arguments that the function
     requires.  The function `or' allows a minimum of zero arguments.

MAX
     This is the maximum number of arguments that the function accepts,
     if there is a fixed maximum.  Alternatively, it can be `UNEVALLED',
     indicating a special form that receives unevaluated arguments, or
     `MANY', indicating an unlimited number of evaluated arguments (the
     equivalent of `&rest').  Both `UNEVALLED' and `MANY' are macros.
     If MAX is a number, it may not be less than MIN and it may not be
     greater than eight.

INTERACTIVE
     This is an interactive specification, a string such as might be
     used as the argument of `interactive' in a Lisp function.  In the
     case of `or', it is 0 (a null pointer), indicating that `or'
     cannot be called interactively.  A value of `""' indicates a
     function that should receive no arguments when called
     interactively.

DOC
     This is the documentation string.  It uses C comment syntax rather
     than C string syntax because comment syntax requires nothing
     special to include multiple lines.  The `doc:' identifies the
     comment that follows as the documentation string.  The `/*' and
     `*/' delimiters that begin and end the comment are not part of the
     documentation string.

     If the last line of the documentation string begins with the
     keyword `usage:', the rest of the line is treated as the argument
     list for documentation purposes.  This way, you can use different
     argument names in the documentation string from the ones used in
     the C code.  `usage:' is required if the function has an unlimited
     number of arguments.

     All the usual rules for documentation strings in Lisp code (*note
     Documentation Tips::) apply to C code documentation strings too.

   After the call to the `DEFUN' macro, you must write the argument
name list that every C function must have, followed by ordinary C
declarations for the arguments.  For a function with a fixed maximum
number of arguments, declare a C argument for each Lisp argument, and
give them all type `Lisp_Object'.  When a Lisp function has no upper
limit on the number of arguments, its implementation in C actually
receives exactly two arguments: the first is the number of Lisp
arguments, and the second is the address of a block containing their
values.  They have types `int' and `Lisp_Object *'.

   Within the function `For' itself, note the use of the macros
`GCPRO1' and `UNGCPRO'.  `GCPRO1' is used to "protect" a variable from
garbage collection--to inform the garbage collector that it must look
in that variable and regard its contents as an accessible object.  GC
protection is necessary whenever you call `Feval' or anything that can
directly or indirectly call `Feval'.  At such a time, any Lisp object
that this function may refer to again must be protected somehow.

   It suffices to ensure that at least one pointer to each object is
GC-protected; that way, the object cannot be recycled, so all pointers
to it remain valid.  Thus, a particular local variable can do without
protection if it is certain that the object it points to will be
preserved by some other pointer (such as another local variable which
has a `GCPRO')(1).  Otherwise, the local variable needs a `GCPRO'.

   The macro `GCPRO1' protects just one local variable.  If you want to
protect two variables, use `GCPRO2' instead; repeating `GCPRO1' will
not work.  Macros `GCPRO3', `GCPRO4', `GCPRO5', and `GCPRO6' also
exist.  All these macros implicitly use local variables such as
`gcpro1'; you must declare these explicitly, with type `struct gcpro'.
Thus, if you use `GCPRO2', you must declare `gcpro1' and `gcpro2'.
Alas, we can't explain all the tricky details here.

   `UNGCPRO' cancels the protection of the variables that are protected
in the current function.  It is necessary to do this explicitly.

   Built-in functions that take a variable number of arguments actually
accept two arguments at the C level: the number of Lisp arguments, and
a `Lisp_Object *' pointer to a C vector containing those Lisp
arguments.  This C vector may be part of a Lisp vector, but it need not
be.  The responsibility for using `GCPRO' to protect the Lisp arguments
from GC if necessary rests with the caller in this case, since the
caller allocated or found the storage for them.

   You must not use C initializers for static or global variables unless
the variables are never written once Emacs is dumped.  These variables
with initializers are allocated in an area of memory that becomes
read-only (on certain operating systems) as a result of dumping Emacs.
*Note Pure Storage::.

   Do not use static variables within functions--place all static
variables at top level in the file.  This is necessary because Emacs on
some operating systems defines the keyword `static' as a null macro.
(This definition is used because those systems put all variables
declared static in a place that becomes read-only after dumping, whether
they have initializers or not.)

   Defining the C function is not enough to make a Lisp primitive
available; you must also create the Lisp symbol for the primitive and
store a suitable subr object in its function cell.  The code looks like
this:

     defsubr (&SUBR-STRUCTURE-NAME);

Here SUBR-STRUCTURE-NAME is the name you used as the third argument to
`DEFUN'.

   If you add a new primitive to a file that already has Lisp primitives
defined in it, find the function (near the end of the file) named
`syms_of_SOMETHING', and add the call to `defsubr' there.  If the file
doesn't have this function, or if you create a new file, add to it a
`syms_of_FILENAME' (e.g., `syms_of_myfile').  Then find the spot in
`emacs.c' where all of these functions are called, and add a call to
`syms_of_FILENAME' there.

   The function `syms_of_FILENAME' is also the place to define any C
variables that are to be visible as Lisp variables.  `DEFVAR_LISP'
makes a C variable of type `Lisp_Object' visible in Lisp.  `DEFVAR_INT'
makes a C variable of type `int' visible in Lisp with a value that is
always an integer.  `DEFVAR_BOOL' makes a C variable of type `int'
visible in Lisp with a value that is either `t' or `nil'.  Note that
variables defined with `DEFVAR_BOOL' are automatically added to the list
`byte-boolean-vars' used by the byte compiler.

   If you define a file-scope C variable of type `Lisp_Object', you
must protect it from garbage-collection by calling `staticpro' in
`syms_of_FILENAME', like this:

     staticpro (&VARIABLE);

   Here is another example function, with more complicated arguments.
This comes from the code in `window.c', and it demonstrates the use of
macros and functions to manipulate Lisp objects.

     DEFUN ("coordinates-in-window-p", Fcoordinates_in_window_p,
       Scoordinates_in_window_p, 2, 2,
       "xSpecify coordinate pair: \nXExpression which evals to window: ",
       "Return non-nil if COORDINATES is in WINDOW.\n\
     COORDINATES is a cons of the form (X . Y), X and Y being distances\n\
     ...
     If they are on the border between WINDOW and its right sibling,\n\
        `vertical-line' is returned.")
       (coordinates, window)
          register Lisp_Object coordinates, window;
     {
       int x, y;

       CHECK_LIVE_WINDOW (window, 0);
       CHECK_CONS (coordinates, 1);
       x = XINT (Fcar (coordinates));
       y = XINT (Fcdr (coordinates));

       switch (coordinates_in_window (XWINDOW (window), &x, &y))
         {
         case 0:			/* NOT in window at all. */
           return Qnil;

         case 1:			/* In text part of window. */
           return Fcons (make_number (x), make_number (y));

         case 2:			/* In mode line of window. */
           return Qmode_line;

         case 3:			/* On right border of window.  */
           return Qvertical_line;

         default:
           abort ();
         }
     }

   Note that C code cannot call functions by name unless they are
defined in C.  The way to call a function written in Lisp is to use
`Ffuncall', which embodies the Lisp function `funcall'.  Since the Lisp
function `funcall' accepts an unlimited number of arguments, in C it
takes two: the number of Lisp-level arguments, and a one-dimensional
array containing their values.  The first Lisp-level argument is the
Lisp function to call, and the rest are the arguments to pass to it.
Since `Ffuncall' can call the evaluator, you must protect pointers from
garbage collection around the call to `Ffuncall'.

   The C functions `call0', `call1', `call2', and so on, provide handy
ways to call a Lisp function conveniently with a fixed number of
arguments.  They work by calling `Ffuncall'.

   `eval.c' is a very good file to look through for examples; `lisp.h'
contains the definitions for some important macros and functions.

   If you define a function which is side-effect free, update the code
in `byte-opt.el' which binds `side-effect-free-fns' and
`side-effect-and-error-free-fns' so that the compiler optimizer knows
about it.

   ---------- Footnotes ----------

   (1) Formerly, strings were a special exception; in older Emacs
versions, every local variable that might point to a string needed a
`GCPRO'.


File: elisp,  Node: Object Internals,  Prev: Writing Emacs Primitives,  Up: GNU Emacs Internals

E.6 Object Internals
====================

GNU Emacs Lisp manipulates many different types of data.  The actual
data are stored in a heap and the only access that programs have to it
is through pointers.  Pointers are thirty-two bits wide in most
implementations.  Depending on the operating system and type of machine
for which you compile Emacs, twenty-nine bits are used to address the
object, and the remaining three bits are used for the tag that
identifies the object's type.

   Because Lisp objects are represented as tagged pointers, it is always
possible to determine the Lisp data type of any object.  The C data type
`Lisp_Object' can hold any Lisp object of any data type.  Ordinary
variables have type `Lisp_Object', which means they can hold any type
of Lisp value; you can determine the actual data type only at run time.
The same is true for function arguments; if you want a function to
accept only a certain type of argument, you must check the type
explicitly using a suitable predicate (*note Type Predicates::).  

* Menu:

* Buffer Internals::    Components of a buffer structure.
* Window Internals::    Components of a window structure.
* Process Internals::   Components of a process structure.


File: elisp,  Node: Buffer Internals,  Next: Window Internals,  Up: Object Internals

E.6.1 Buffer Internals
----------------------

Buffers contain fields not directly accessible by the Lisp programmer.
We describe them here, naming them by the names used in the C code.
Many are accessible indirectly in Lisp programs via Lisp primitives.

   Two structures are used to represent buffers in C.  The
`buffer_text' structure contains fields describing the text of a
buffer; the `buffer' structure holds other fields.  In the case of
indirect buffers, two or more `buffer' structures reference the same
`buffer_text' structure.

   Here is a list of the `struct buffer_text' fields:

`beg'
     This field contains the actual address of the buffer contents.

`gpt'
     This holds the character position of the gap in the buffer.  *Note
     Buffer Gap::.

`z'
     This field contains the character position of the end of the buffer
     text.

`gpt_byte'
     Contains the byte position of the gap.

`z_byte'
     Holds the byte position of the end of the buffer text.

`gap_size'
     Contains the size of buffer's gap.  *Note Buffer Gap::.

`modiff'
     This field counts buffer-modification events for this buffer.  It
     is incremented for each such event, and never otherwise changed.

`save_modiff'
     Contains the previous value of `modiff', as of the last time a
     buffer was visited or saved in a file.

`overlay_modiff'
     Counts modifications to overlays analogous to `modiff'.

`beg_unchanged'
     Holds the number of characters at the start of the text that are
     known to be unchanged since the last redisplay that finished.

`end_unchanged'
     Holds the number of characters at the end of the text that are
     known to be unchanged since the last redisplay that finished.

`unchanged_modified'
     Contains the value of `modiff' at the time of the last redisplay
     that finished.  If this value matches `modiff', `beg_unchanged'
     and `end_unchanged' contain no useful information.

`overlay_unchanged_modified'
     Contains the value of `overlay_modiff' at the time of the last
     redisplay that finished.  If this value matches `overlay_modiff',
     `beg_unchanged' and `end_unchanged' contain no useful information.

`markers'
     The markers that refer to this buffer.  This is actually a single
     marker, and successive elements in its marker `chain' are the other
     markers referring to this buffer text.

`intervals'
     Contains the interval tree which records the text properties of
     this buffer.

   The fields of `struct buffer' are:

`next'
     Points to the next buffer, in the chain of all buffers including
     killed buffers.  This chain is used only for garbage collection,
     in order to collect killed buffers properly.  Note that vectors,
     and most kinds of objects allocated as vectors, are all on one
     chain, but buffers are on a separate chain of their own.

`own_text'
     This is a `struct buffer_text' structure.  In an ordinary buffer,
     it holds the buffer contents.  In indirect buffers, this field is
     not used.

`text'
     This points to the `buffer_text' structure that is used for this
     buffer.  In an ordinary buffer, this is the `own_text' field above.
     In an indirect buffer, this is the `own_text' field of the base
     buffer.

`pt'
     Contains the character position of point in a buffer.

`pt_byte'
     Contains the byte position of point in a buffer.

`begv'
     This field contains the character position of the beginning of the
     accessible range of text in the buffer.

`begv_byte'
     This field contains the byte position of the beginning of the
     accessible range of text in the buffer.

`zv'
     This field contains the character position of the end of the
     accessible range of text in the buffer.

`zv_byte'
     This field contains the byte position of the end of the accessible
     range of text in the buffer.

`base_buffer'
     In an indirect buffer, this points to the base buffer.  In an
     ordinary buffer, it is null.

`local_var_flags'
     This field contains flags indicating that certain variables are
     local in this buffer.  Such variables are declared in the C code
     using `DEFVAR_PER_BUFFER', and their buffer-local bindings are
     stored in fields in the buffer structure itself.  (Some of these
     fields are described in this table.)

`modtime'
     This field contains the modification time of the visited file.  It
     is set when the file is written or read.  Before writing the
     buffer into a file, this field is compared to the modification
     time of the file to see if the file has changed on disk.  *Note
     Buffer Modification::.

`auto_save_modified'
     This field contains the time when the buffer was last auto-saved.

`auto_save_failure_time'
     The time at which we detected a failure to auto-save, or -1 if we
     didn't have a failure.

`last_window_start'
     This field contains the `window-start' position in the buffer as of
     the last time the buffer was displayed in a window.

`clip_changed'
     This flag is set when narrowing changes in a buffer.

`prevent_redisplay_optimizations_p'
     this flag indicates that redisplay optimizations should not be used
     to display this buffer.

`undo_list'
     This field points to the buffer's undo list.  *Note Undo::.

`name'
     The buffer name is a string that names the buffer.  It is
     guaranteed to be unique.  *Note Buffer Names::.

`filename'
     The name of the file visited in this buffer, or `nil'.

`directory'
     The directory for expanding relative file names.

`save_length'
     Length of the file this buffer is visiting, when last read or
     saved.  This and other fields concerned with saving are not kept
     in the `buffer_text' structure because indirect buffers are never
     saved.

`auto_save_file_name'
     File name used for auto-saving this buffer.  This is not in the
     `buffer_text' because it's not used in indirect buffers at all.

`read_only'
     Non-`nil' means this buffer is read-only.

`mark'
     This field contains the mark for the buffer.  The mark is a marker,
     hence it is also included on the list `markers'.  *Note The Mark::.

`local_var_alist'
     This field contains the association list describing the
     buffer-local variable bindings of this buffer, not including the
     built-in buffer-local bindings that have special slots in the
     buffer object.  (Those slots are omitted from this table.)  *Note
     Buffer-Local Variables::.

`major_mode'
     Symbol naming the major mode of this buffer, e.g., `lisp-mode'.

`mode_name'
     Pretty name of major mode, e.g., `"Lisp"'.

`mode_line_format'
     Mode line element that controls the format of the mode line.  If
     this is `nil', no mode line will be displayed.

`header_line_format'
     This field is analogous to `mode_line_format' for the mode line
     displayed at the top of windows.

`keymap'
     This field holds the buffer's local keymap.  *Note Keymaps::.

`abbrev_table'
     This buffer's local abbrevs.

`syntax_table'
     This field contains the syntax table for the buffer.  *Note Syntax
     Tables::.

`category_table'
     This field contains the category table for the buffer.

`case_fold_search'
     The value of `case-fold-search' in this buffer.

`tab_width'
     The value of `tab-width' in this buffer.

`fill_column'
     The value of `fill-column' in this buffer.

`left_margin'
     The value of `left-margin' in this buffer.

`auto_fill_function'
     The value of `auto-fill-function' in this buffer.

`downcase_table'
     This field contains the conversion table for converting text to
     lower case.  *Note Case Tables::.

`upcase_table'
     This field contains the conversion table for converting text to
     upper case.  *Note Case Tables::.

`case_canon_table'
     This field contains the conversion table for canonicalizing text
     for case-folding search.  *Note Case Tables::.

`case_eqv_table'
     This field contains the equivalence table for case-folding search.
     *Note Case Tables::.

`truncate_lines'
     The value of `truncate-lines' in this buffer.

`ctl_arrow'
     The value of `ctl-arrow' in this buffer.

`selective_display'
     The value of `selective-display' in this buffer.

`selective_display_ellipsis'
     The value of `selective-display-ellipsis' in this buffer.

`minor_modes'
     An alist of the minor modes of this buffer.

`overwrite_mode'
     The value of `overwrite_mode' in this buffer.

`abbrev_mode'
     The value of `abbrev-mode' in this buffer.

`display_table'
     This field contains the buffer's display table, or `nil' if it
     doesn't have one.  *Note Display Tables::.

`save_modified'
     This field contains the time when the buffer was last saved, as an
     integer.  *Note Buffer Modification::.

`mark_active'
     This field is non-`nil' if the buffer's mark is active.

`overlays_before'
     This field holds a list of the overlays in this buffer that end at
     or before the current overlay center position.  They are sorted in
     order of decreasing end position.

`overlays_after'
     This field holds a list of the overlays in this buffer that end
     after the current overlay center position.  They are sorted in
     order of increasing beginning position.

`overlay_center'
     This field holds the current overlay center position.  *Note
     Overlays::.

`enable_multibyte_characters'
     This field holds the buffer's local value of
     `enable-multibyte-characters'--either `t' or `nil'.

`buffer_file_coding_system'
     The value of `buffer-file-coding-system' in this buffer.

`file_format'
     The value of `buffer-file-format' in this buffer.

`auto_save_file_format'
     The value of `buffer-auto-save-file-format' in this buffer.

`pt_marker'
     In an indirect buffer, or a buffer that is the base of an indirect
     buffer, this holds a marker that records point for this buffer
     when the buffer is not current.

`begv_marker'
     In an indirect buffer, or a buffer that is the base of an indirect
     buffer, this holds a marker that records `begv' for this buffer
     when the buffer is not current.

`zv_marker'
     In an indirect buffer, or a buffer that is the base of an indirect
     buffer, this holds a marker that records `zv' for this buffer when
     the buffer is not current.

`file_truename'
     The truename of the visited file, or `nil'.

`invisibility_spec'
     The value of `buffer-invisibility-spec' in this buffer.

`last_selected_window'
     This is the last window that was selected with this buffer in it,
     or `nil' if that window no longer displays this buffer.

`display_count'
     This field is incremented each time the buffer is displayed in a
     window.

`left_margin_width'
     The value of `left-margin-width' in this buffer.

`right_margin_width'
     The value of `right-margin-width' in this buffer.

`indicate_empty_lines'
     Non-`nil' means indicate empty lines (lines with no text) with a
     small bitmap in the fringe, when using a window system that can do
     it.

`display_time'
     This holds a time stamp that is updated each time this buffer is
     displayed in a window.

`scroll_up_aggressively'
     The value of `scroll-up-aggressively' in this buffer.

`scroll_down_aggressively'
     The value of `scroll-down-aggressively' in this buffer.


File: elisp,  Node: Window Internals,  Next: Process Internals,  Prev: Buffer Internals,  Up: Object Internals

E.6.2 Window Internals
----------------------

Windows have the following accessible fields:

`frame'
     The frame that this window is on.

`mini_p'
     Non-`nil' if this window is a minibuffer window.

`parent'
     Internally, Emacs arranges windows in a tree; each group of
     siblings has a parent window whose area includes all the siblings.
     This field points to a window's parent.

     Parent windows do not display buffers, and play little role in
     display except to shape their child windows.  Emacs Lisp programs
     usually have no access to the parent windows; they operate on the
     windows at the leaves of the tree, which actually display buffers.

     The following four fields also describe the window tree structure.

`hchild'
     In a window subdivided horizontally by child windows, the leftmost
     child.  Otherwise, `nil'.

`vchild'
     In a window subdivided vertically by child windows, the topmost
     child.  Otherwise, `nil'.

`next'
     The next sibling of this window.  It is `nil' in a window that is
     the rightmost or bottommost of a group of siblings.

`prev'
     The previous sibling of this window.  It is `nil' in a window that
     is the leftmost or topmost of a group of siblings.

`left'
     This is the left-hand edge of the window, measured in columns.
     (The leftmost column on the screen is column 0.)

`top'
     This is the top edge of the window, measured in lines.  (The top
     line on the screen is line 0.)

`height'
     The height of the window, measured in lines.

`width'
     The width of the window, measured in columns.  This width includes
     the scroll bar and fringes, and/or the separator line on the right
     of the window (if any).

`buffer'
     The buffer that the window is displaying.  This may change often
     during the life of the window.

`start'
     The position in the buffer that is the first character to be
     displayed in the window.

`pointm'
     This is the value of point in the current buffer when this window
     is selected; when it is not selected, it retains its previous
     value.

`force_start'
     If this flag is non-`nil', it says that the window has been
     scrolled explicitly by the Lisp program.  This affects what the
     next redisplay does if point is off the screen: instead of
     scrolling the window to show the text around point, it moves point
     to a location that is on the screen.

`frozen_window_start_p'
     This field is set temporarily to 1 to indicate to redisplay that
     `start' of this window should not be changed, even if point gets
     invisible.

`start_at_line_beg'
     Non-`nil' means current value of `start' was the beginning of a
     line when it was chosen.

`too_small_ok'
     Non-`nil' means don't delete this window for becoming "too small."

`height_fixed_p'
     This field is temporarily set to 1 to fix the height of the
     selected window when the echo area is resized.

`use_time'
     This is the last time that the window was selected.  The function
     `get-lru-window' uses this field.

`sequence_number'
     A unique number assigned to this window when it was created.

`last_modified'
     The `modiff' field of the window's buffer, as of the last time a
     redisplay completed in this window.

`last_overlay_modified'
     The `overlay_modiff' field of the window's buffer, as of the last
     time a redisplay completed in this window.

`last_point'
     The buffer's value of point, as of the last time a redisplay
     completed in this window.

`last_had_star'
     A non-`nil' value means the window's buffer was "modified" when the
     window was last updated.

`vertical_scroll_bar'
     This window's vertical scroll bar.

`left_margin_width'
     The width of the left margin in this window, or `nil' not to
     specify it (in which case the buffer's value of `left-margin-width'
     is used.

`right_margin_width'
     Likewise for the right margin.

`window_end_pos'
     This is computed as `z' minus the buffer position of the last glyph
     in the current matrix of the window.  The value is only valid if
     `window_end_valid' is not `nil'.

`window_end_bytepos'
     The byte position corresponding to `window_end_pos'.

`window_end_vpos'
     The window-relative vertical position of the line containing
     `window_end_pos'.

`window_end_valid'
     This field is set to a non-`nil' value if `window_end_pos' is truly
     valid.  This is `nil' if nontrivial redisplay is preempted since
     in that case the display that `window_end_pos' was computed for
     did not get onto the screen.

`redisplay_end_trigger'
     If redisplay in this window goes beyond this buffer position, it
     runs the `redisplay-end-trigger-hook'.

`cursor'
     A structure describing where the cursor is in this window.

`last_cursor'
     The value of `cursor' as of the last redisplay that finished.

`phys_cursor'
     A structure describing where the cursor of this window physically
     is.

`phys_cursor_type'
     The type of cursor that was last displayed on this window.

`phys_cursor_on_p'
     This field is non-zero if the cursor is physically on.

`cursor_off_p'
     Non-zero means the cursor in this window is logically on.

`last_cursor_off_p'
     This field contains the value of `cursor_off_p' as of the time of
     the last redisplay.

`must_be_updated_p'
     This is set to 1 during redisplay when this window must be updated.

`hscroll'
     This is the number of columns that the display in the window is
     scrolled horizontally to the left.  Normally, this is 0.

`vscroll'
     Vertical scroll amount, in pixels.  Normally, this is 0.

`dedicated'
     Non-`nil' if this window is dedicated to its buffer.

`display_table'
     The window's display table, or `nil' if none is specified for it.

`update_mode_line'
     Non-`nil' means this window's mode line needs to be updated.

`base_line_number'
     The line number of a certain position in the buffer, or `nil'.
     This is used for displaying the line number of point in the mode
     line.

`base_line_pos'
     The position in the buffer for which the line number is known, or
     `nil' meaning none is known.

`region_showing'
     If the region (or part of it) is highlighted in this window, this
     field holds the mark position that made one end of that region.
     Otherwise, this field is `nil'.

`column_number_displayed'
     The column number currently displayed in this window's mode line,
     or `nil' if column numbers are not being displayed.

`current_matrix'
     A glyph matrix describing the current display of this window.

`desired_matrix'
     A glyph matrix describing the desired display of this window.


File: elisp,  Node: Process Internals,  Prev: Window Internals,  Up: Object Internals

E.6.3 Process Internals
-----------------------

The fields of a process are:

`name'
     A string, the name of the process.

`command'
     A list containing the command arguments that were used to start
     this process.

`filter'
     A function used to accept output from the process instead of a
     buffer, or `nil'.

`sentinel'
     A function called whenever the process receives a signal, or `nil'.

`buffer'
     The associated buffer of the process.

`pid'
     An integer, the operating system's process ID.

`childp'
     A flag, non-`nil' if this is really a child process.  It is `nil'
     for a network connection.

`mark'
     A marker indicating the position of the end of the last output
     from this process inserted into the buffer.  This is often but not
     always the end of the buffer.

`kill_without_query'
     If this is non-`nil', killing Emacs while this process is still
     running does not ask for confirmation about killing the process.

`raw_status_low'
`raw_status_high'
     These two fields record 16 bits each of the process status
     returned by the `wait' system call.

`status'
     The process status, as `process-status' should return it.

`tick'
`update_tick'
     If these two fields are not equal, a change in the status of the
     process needs to be reported, either by running the sentinel or by
     inserting a message in the process buffer.

`pty_flag'
     Non-`nil' if communication with the subprocess uses a PTY; `nil'
     if it uses a pipe.

`infd'
     The file descriptor for input from the process.

`outfd'
     The file descriptor for output to the process.

`subtty'
     The file descriptor for the terminal that the subprocess is using.
     (On some systems, there is no need to record this, so the value is
     `nil'.)

`tty_name'
     The name of the terminal that the subprocess is using, or `nil' if
     it is using pipes.

`decode_coding_system'
     Coding-system for decoding the input from this process.

`decoding_buf'
     A working buffer for decoding.

`decoding_carryover'
     Size of carryover in decoding.

`encode_coding_system'
     Coding-system for encoding the output to this process.

`encoding_buf'
     A working buffer for encoding.

`encoding_carryover'
     Size of carryover in encoding.

`inherit_coding_system_flag'
     Flag to set `coding-system' of the process buffer from the coding
     system used to decode process output.


File: elisp,  Node: Standard Errors,  Next: Standard Buffer-Local Variables,  Prev: GNU Emacs Internals,  Up: Top

Appendix F Standard Errors
**************************

Here is the complete list of the error symbols in standard Emacs,
grouped by concept.  The list includes each symbol's message (on the
`error-message' property of the symbol) and a cross reference to a
description of how the error can occur.

   Each error symbol has an `error-conditions' property that is a list
of symbols.  Normally this list includes the error symbol itself and
the symbol `error'.  Occasionally it includes additional symbols, which
are intermediate classifications, narrower than `error' but broader
than a single error symbol.  For example, all the errors in accessing
files have the condition `file-error'.  If we do not say here that a
certain error symbol has additional error conditions, that means it has
none.

   As a special exception, the error symbol `quit' does not have the
condition `error', because quitting is not considered an error.

   *Note Errors::, for an explanation of how errors are generated and
handled.

`SYMBOL'
     STRING; REFERENCE.

`error'
     `"error"'
     *Note Errors::.

`quit'
     `"Quit"'
     *Note Quitting::.

`args-out-of-range'
     `"Args out of range"'
     This happens when trying to access an element beyond the range of a
     sequence or buffer.
     *Note Sequences Arrays Vectors::, *Note Text::.

`arith-error'
     `"Arithmetic error"'
     *Note Arithmetic Operations::.

`beginning-of-buffer'
     `"Beginning of buffer"'
     *Note Character Motion::.

`buffer-read-only'
     `"Buffer is read-only"'
     *Note Read Only Buffers::.

`coding-system-error'
     `"Invalid coding system"'
     *Note Lisp and Coding Systems::.

`cyclic-function-indirection'
     `"Symbol's chain of function indirections\
     contains a loop"'
     *Note Function Indirection::.

`cyclic-variable-indirection'
     `"Symbol's chain of variable indirections\
     contains a loop"'
     *Note Variable Aliases::.

`end-of-buffer'
     `"End of buffer"'
     *Note Character Motion::.

`end-of-file'
     `"End of file during parsing"'
     Note that this is not a subcategory of `file-error', because it
     pertains to the Lisp reader, not to file I/O.
     *Note Input Functions::.

`file-already-exists'
     This is a subcategory of `file-error'.
     *Note Writing to Files::.

`file-date-error'
     This is a subcategory of `file-error'.  It occurs when `copy-file'
     tries and fails to set the last-modification time of the output
     file.
     *Note Changing Files::.

`file-error'
     We do not list the error-strings of this error and its
     subcategories, because the error message is normally constructed
     from the data items alone when the error condition `file-error' is
     present.  Thus, the error-strings are not very relevant.  However,
     these error symbols do have `error-message' properties, and if no
     data is provided, the `error-message' property _is_ used.
     *Note Files::.

`file-locked'
     This is a subcategory of `file-error'.
     *Note File Locks::.

`file-supersession'
     This is a subcategory of `file-error'.
     *Note Modification Time::.

`ftp-error'
     This is a subcategory of `file-error', which results from problems
     in accessing a remote file using ftp.
     *Note Remote Files: (emacs)Remote Files.

`invalid-function'
     `"Invalid function"'
     *Note Function Indirection::.

`invalid-read-syntax'
     `"Invalid read syntax"'
     *Note Printed Representation::.

`invalid-regexp'
     `"Invalid regexp"'
     *Note Regular Expressions::.

`mark-inactive'
     `"The mark is not active now"'
     *Note The Mark::.

`no-catch'
     `"No catch for tag"'
     *Note Catch and Throw::.

`scan-error'
     `"Scan error"'
     This happens when certain syntax-parsing functions find invalid
     syntax or mismatched parentheses.
     *Note List Motion::, and *note Parsing Expressions::.

`search-failed'
     `"Search failed"'
     *Note Searching and Matching::.

`setting-constant'
     `"Attempt to set a constant symbol"'
     The values of the symbols `nil' and `t', and any symbols that
     start with `:', may not be changed.
     *Note Variables that Never Change: Constant Variables.

`text-read-only'
     `"Text is read-only"'
     This is a subcategory of `buffer-read-only'.
     *Note Special Properties::.

`undefined-color'
     `"Undefined color"'
     *Note Color Names::.

`void-function'
     `"Symbol's function definition is void"'
     *Note Function Cells::.

`void-variable'
     `"Symbol's value as variable is void"'
     *Note Accessing Variables::.

`wrong-number-of-arguments'
     `"Wrong number of arguments"'
     *Note Classifying Lists::.

`wrong-type-argument'
     `"Wrong type argument"'
     *Note Type Predicates::.

   These kinds of error, which are classified as special cases of
`arith-error', can occur on certain systems for invalid use of
mathematical functions.

`domain-error'
     `"Arithmetic domain error"'
     *Note Math Functions::.

`overflow-error'
     `"Arithmetic overflow error"'
     This is a subcategory of `domain-error'.
     *Note Math Functions::.

`range-error'
     `"Arithmetic range error"'
     *Note Math Functions::.

`singularity-error'
     `"Arithmetic singularity error"'
     This is a subcategory of `domain-error'.
     *Note Math Functions::.

`underflow-error'
     `"Arithmetic underflow error"'
     This is a subcategory of `domain-error'.
     *Note Math Functions::.


File: elisp,  Node: Standard Buffer-Local Variables,  Next: Standard Keymaps,  Prev: Standard Errors,  Up: Top

Appendix G Buffer-Local Variables
*********************************

The table below lists the general-purpose Emacs variables that
automatically become buffer-local in each buffer.  Most become
buffer-local only when set; a few of them are always local in every
buffer.  Many Lisp packages define such variables for their internal
use, but we don't try to list them all here.

   Every buffer-specific minor mode defines a buffer-local variable
named `MODENAME-mode'.  *Note Minor Mode Conventions::.  Minor mode
variables will not be listed here.

`auto-fill-function'
     *Note Auto Filling::.

`buffer-auto-save-file-format'
     *Note Format Conversion::.

`buffer-auto-save-file-name'
     *Note Auto-Saving::.

`buffer-backed-up'
     *Note Making Backups::.

`buffer-display-count'
     *Note Buffers and Windows::.

`buffer-display-table'
     *Note Active Display Table::.

`buffer-display-time'
     *Note Buffers and Windows::.

`buffer-file-coding-system'
     *Note Encoding and I/O::.

`buffer-file-format'
     *Note Format Conversion::.

`buffer-file-name'
     *Note Buffer File Name::.

`buffer-file-number'
     *Note Buffer File Name::.

`buffer-file-truename'
     *Note Buffer File Name::.

`buffer-file-type'
     *Note MS-DOS File Types::.

`buffer-invisibility-spec'
     *Note Invisible Text::.

`buffer-offer-save'
     *Note Killing Buffers::.

`buffer-save-without-query'
     *Note Killing Buffers::.

`buffer-read-only'
     *Note Read Only Buffers::.

`buffer-saved-size'
     *Note Auto-Saving::.

`buffer-undo-list'
     *Note Undo::.

`cache-long-line-scans'
     *Note Truncation::.

`case-fold-search'
     *Note Searching and Case::.

`ctl-arrow'
     *Note Usual Display::.

`cursor-type'
     *Note Cursor Parameters::.

`cursor-in-non-selected-windows'
     *Note Basic Windows::.

`comment-column'
     *Note Comments: (emacs)Comments.

`default-directory'
     *Note File Name Expansion::.

`defun-prompt-regexp'
     *Note List Motion::.

`desktop-save-buffer'
     *Note Desktop Save Mode::.

`enable-multibyte-characters'
     *note Text Representations::.

`fill-column'
     *Note Margins::.

`fill-prefix'
     *Note Margins::.

`font-lock-defaults'
     *Note Font Lock Basics::.

`fringe-cursor-alist'
     *Note Fringe Cursors::.

`fringe-indicator-alist'
     *Note Fringe Indicators::.

`fringes-outside-margins'
     *Note Fringes::.

`goal-column'
     *Note Moving Point: (emacs)Moving Point.

`header-line-format'
     *Note Header Lines::.

`indicate-buffer-boundaries'
     *Note Usual Display::.

`indicate-empty-lines'
     *Note Usual Display::.

`left-fringe-width'
     *Note Fringe Size/Pos::.

`left-margin'
     *Note Margins::.

`left-margin-width'
     *Note Display Margins::.

`line-spacing'
     *Note Line Height::.

`local-abbrev-table'
     *Note Standard Abbrev Tables::.

`major-mode'
     *Note Mode Help::.

`mark-active'
     *Note The Mark::.

`mark-ring'
     *Note The Mark::.

`mode-line-buffer-identification'
     *Note Mode Line Variables::.

`mode-line-format'
     *Note Mode Line Data::.

`mode-line-modified'
     *Note Mode Line Variables::.

`mode-line-process'
     *Note Mode Line Variables::.

`mode-name'
     *Note Mode Line Variables::.

`point-before-scroll'
     Used for communication between mouse commands and scroll-bar
     commands.

`right-fringe-width'
     *Note Fringe Size/Pos::.

`right-margin-width'
     *Note Display Margins::.

`save-buffer-coding-system'
     *Note Encoding and I/O::.

`scroll-bar-width'
     *Note Scroll Bars::.

`scroll-down-aggressively'
     *Note Textual Scrolling::.

`scroll-up-aggressively'
     *Note Textual Scrolling::.

`selective-display'
     *Note Selective Display::.

`selective-display-ellipses'
     *Note Selective Display::.

`tab-width'
     *Note Usual Display::.

`truncate-lines'
     *Note Truncation::.

`vertical-scroll-bar'
     *Note Scroll Bars::.

`window-size-fixed'
     *Note Resizing Windows::.

`write-contents-functions'
     *Note Saving Buffers::.


File: elisp,  Node: Standard Keymaps,  Next: Standard Hooks,  Prev: Standard Buffer-Local Variables,  Up: Top

Appendix H Standard Keymaps
***************************

The following symbols are used as the names for various keymaps.  Some
of these exist when Emacs is first started, others are loaded only when
their respective mode is used.  This is not an exhaustive list.

   Several keymaps are used in the minibuffer.  *Note Completion
Commands::.

   Almost all of these maps are used as local maps.  Indeed, of the
modes that presently exist, only Vip mode and Terminal mode ever change
the global keymap.

`apropos-mode-map'
     A sparse keymap for `apropos' buffers.

`Buffer-menu-mode-map'
     A full keymap used by Buffer Menu mode.

`c-mode-map'
     A sparse keymap used by C mode.

`command-history-map'
     A full keymap used by Command History mode.

`ctl-x-4-map'
     A sparse keymap for subcommands of the prefix `C-x 4'.

`ctl-x-5-map'
     A sparse keymap for subcommands of the prefix `C-x 5'.

`ctl-x-map'
     A full keymap for `C-x' commands.

`custom-mode-map'
     A full keymap for Custom mode.

`debugger-mode-map'
     A full keymap used by Debugger mode.

`dired-mode-map'
     A full keymap for `dired-mode' buffers.

`edit-abbrevs-map'
     A sparse keymap used in `edit-abbrevs'.

`edit-tab-stops-map'
     A sparse keymap used in `edit-tab-stops'.

`electric-buffer-menu-mode-map'
     A full keymap used by Electric Buffer Menu mode.

`electric-history-map'
     A full keymap used by Electric Command History mode.

`emacs-lisp-mode-map'
     A sparse keymap used by Emacs Lisp mode.

`esc-map'
     A full keymap for `ESC' (or `Meta') commands.

`facemenu-menu'
     The sparse keymap that displays the Text Properties menu.

`facemenu-background-menu'
     The sparse keymap that displays the Background Color submenu of
     the Text Properties menu.

`facemenu-face-menu'
     The sparse keymap that displays the Face submenu of the Text
     Properties menu.

`facemenu-foreground-menu'
     The sparse keymap that displays the Foreground Color submenu of
     the Text Properties menu.

`facemenu-indentation-menu'
     The sparse keymap that displays the Indentation submenu of the Text
     Properties menu.

`facemenu-justification-menu'
     The sparse keymap that displays the Justification submenu of the
     Text Properties menu.

`facemenu-special-menu'
     The sparse keymap that displays the Special Props submenu of the
     Text Properties menu.

`function-key-map'
     The keymap for translating keypad and function keys.
     If there are none, then it contains an empty sparse keymap.  *Note
     Translation Keymaps::.

`fundamental-mode-map'
     The sparse keymap for Fundamental mode.
     It is empty and should not be changed.

`global-map'
     The full keymap containing default global key bindings.
     Modes should not modify the Global map.

`grep-mode-map'
     The keymap for `grep-mode' buffers.

`help-map'
     The sparse keymap for the keys that follow the help character
     `C-h'.

`help-mode-map'
     The sparse keymap for Help mode.

`Helper-help-map'
     A full keymap used by the help utility package.
     It has the same keymap in its value cell and in its function cell.

`Info-edit-map'
     A sparse keymap used by the `e' command of Info.

`Info-mode-map'
     A sparse keymap containing Info commands.

`isearch-mode-map'
     A keymap that defines the characters you can type within
     incremental search.

`key-translation-map'
     A keymap for translating keys.  This one overrides ordinary key
     bindings, unlike `function-key-map'.  *Note Translation Keymaps::.

`kmacro-map'
     A sparse keymap for keys that follows the `C-x C-k' prefix search.

`lisp-interaction-mode-map'
     A sparse keymap used by Lisp Interaction mode.

`lisp-mode-map'
     A sparse keymap used by Lisp mode.

`menu-bar-edit-menu'
     The keymap which displays the Edit menu in the menu bar.

`menu-bar-files-menu'
     The keymap which displays the Files menu in the menu bar.

`menu-bar-help-menu'
     The keymap which displays the Help menu in the menu bar.

`menu-bar-mule-menu'
     The keymap which displays the Mule menu in the menu bar.

`menu-bar-search-menu'
     The keymap which displays the Search menu in the menu bar.

`menu-bar-tools-menu'
     The keymap which displays the Tools menu in the menu bar.

`mode-specific-map'
     The keymap for characters following `C-c'.  Note, this is in the
     global map.  This map is not actually mode specific: its name was
     chosen to be informative for the user in `C-h b'
     (`display-bindings'), where it describes the main use of the `C-c'
     prefix key.

`occur-mode-map'
     A sparse keymap used by Occur mode.

`query-replace-map'
     A sparse keymap used for responses in `query-replace' and related
     commands; also for `y-or-n-p' and `map-y-or-n-p'.  The functions
     that use this map do not support prefix keys; they look up one
     event at a time.

`text-mode-map'
     A sparse keymap used by Text mode.

`tool-bar-map'
     The keymap defining the contents of the tool bar.

`view-mode-map'
     A full keymap used by View mode.


File: elisp,  Node: Standard Hooks,  Next: Index,  Prev: Standard Keymaps,  Up: Top

Appendix I Standard Hooks
*************************

The following is a list of hook variables that let you provide
functions to be called from within Emacs on suitable occasions.

   Most of these variables have names ending with `-hook'.  They are
"normal hooks", run by means of `run-hooks'.  The value of such a hook
is a list of functions; the functions are called with no arguments and
their values are completely ignored.  The recommended way to put a new
function on such a hook is to call `add-hook'.  *Note Hooks::, for more
information about using hooks.

   Every major mode defines a mode hook named `MODENAME-mode-hook'.
The major mode command runs this normal hook with `run-mode-hooks' as
the very last thing it does.  *Note Mode Hooks::.  Most minor modes
have mode hooks too.  Mode hooks are omitted in the list below.

   The variables whose names end in `-hooks' or `-functions' are
usually "abnormal hooks"; their values are lists of functions, but
these functions are called in a special way (they are passed arguments,
or their values are used). The variables whose names end in `-function'
have single functions as their values.

   A special feature allows you to specify expressions to evaluate if
and when a file is loaded (*note Hooks for Loading::).  That feature is
not exactly a hook, but does a similar job.

`activate-mark-hook'
     *Note The Mark::.

`after-change-functions'
     *Note Change Hooks::.

`after-change-major-mode-hook'
     *Note Mode Hooks::.

`after-init-hook'
     *Note Init File::.

`after-insert-file-functions'
     *Note Saving Properties::.

`after-make-frame-functions'
     *Note Creating Frames::.

`after-revert-hook'
     *Note Reverting::.

`after-save-hook'
     *Note Saving Buffers::.

`auto-fill-function'
     *Note Auto Filling::.

`auto-save-hook'
     *Note Auto-Saving::.

`before-change-functions'
     *Note Change Hooks::.

`before-init-hook'
     *Note Init File::.

`before-make-frame-hook'
     *Note Creating Frames::.

`before-revert-hook'
     *Note Reverting::.

`before-save-hook'
     *Note Saving Buffers::.

`blink-paren-function'
     *Note Blinking::.

`buffer-access-fontify-functions'
     *Note Lazy Properties::.

`calendar-load-hook'
     *Note Calendar Customizing: (emacs)Calendar Customizing.

`change-major-mode-hook'
     *Note Creating Buffer-Local::.

`command-line-functions'
     *Note Command-Line Arguments::.

`comment-indent-function'
     *Note Options Controlling Comments: (emacs)Options for Comments.

`compilation-finish-functions'
     Functions to call when a compilation process finishes.

`custom-define-hook'
     Hook called after defining each customize option.

`deactivate-mark-hook'
     *Note The Mark::.

`desktop-after-read-hook'
     Normal hook run after a successful `desktop-read'.  May be used to
     show a buffer list.  *Note Saving Emacs Sessions: (emacs)Saving
     Emacs Sessions.

`desktop-no-desktop-file-hook'
     Normal hook run when `desktop-read' can't find a desktop file.
     May be used to show a dired buffer.  *Note Saving Emacs Sessions:
     (emacs)Saving Emacs Sessions.

`desktop-save-hook'
     Normal hook run before the desktop is saved in a desktop file.
     This is useful for truncating history lists, for example.  *Note
     Saving Emacs Sessions: (emacs)Saving Emacs Sessions.

`diary-display-hook'
     *Note Fancy Diary Display: (emacs)Fancy Diary Display.

`diary-hook'
     List of functions called after the display of the diary.  Can be
     used for appointment notification.

`disabled-command-function'
     *Note Disabling Commands::.

`echo-area-clear-hook'
     *Note Echo Area Customization::.

`emacs-startup-hook'
     *Note Init File::.

`find-file-hook'
     *Note Visiting Functions::.

`find-file-not-found-functions'
     *Note Visiting Functions::.

`first-change-hook'
     *Note Change Hooks::.

`font-lock-beginning-of-syntax-function'
     *Note Syntactic Font Lock::.

`font-lock-fontify-buffer-function'
     *Note Other Font Lock Variables::.

`font-lock-fontify-region-function'
     *Note Other Font Lock Variables::.

`font-lock-mark-block-function'
     *Note Other Font Lock Variables::.

`font-lock-syntactic-face-function'
     *Note Syntactic Font Lock::.

`font-lock-unfontify-buffer-function'
     *Note Other Font Lock Variables::.

`font-lock-unfontify-region-function'
     *Note Other Font Lock Variables::.

`initial-calendar-window-hook'
     *Note Calendar Customizing: (emacs)Calendar Customizing.

`kbd-macro-termination-hook'
     *Note Keyboard Macros::.

`kill-buffer-hook'
     *Note Killing Buffers::.

`kill-buffer-query-functions'
     *Note Killing Buffers::.

`kill-emacs-hook'
     *Note Killing Emacs::.

`kill-emacs-query-functions'
     *Note Killing Emacs::.

`lisp-indent-function'

`list-diary-entries-hook'
     *Note Fancy Diary Display: (emacs)Fancy Diary Display.

`mail-setup-hook'
     *Note Mail Mode Miscellany: (emacs)Mail Mode Misc.

`mark-diary-entries-hook'
     *Note Fancy Diary Display: (emacs)Fancy Diary Display.

`menu-bar-update-hook'
     *Note Menu Bar::.

`minibuffer-setup-hook'
     *Note Minibuffer Misc::.

`minibuffer-exit-hook'
     *Note Minibuffer Misc::.

`mouse-position-function'
     *Note Mouse Position::.

`nongregorian-diary-listing-hook'
     *Note Hebrew/Islamic Entries: (emacs)Hebrew/Islamic Entries.

`nongregorian-diary-marking-hook'
     *Note Hebrew/Islamic Entries: (emacs)Hebrew/Islamic Entries.

`occur-hook'

`post-command-hook'
     *Note Command Overview::.

`pre-abbrev-expand-hook'
     *Note Abbrev Expansion::.

`pre-command-hook'
     *Note Command Overview::.

`print-diary-entries-hook'
     *Note Diary Customizing: (emacs)Diary Customizing.

`redisplay-end-trigger-functions'
     *Note Window Hooks::.

`scheme-indent-function'

`suspend-hook'
     *Note Suspending Emacs::.

`suspend-resume-hook'
     *Note Suspending Emacs::.

`temp-buffer-setup-hook'
     *Note Temporary Displays::.

`temp-buffer-show-function'
     *Note Temporary Displays::.

`temp-buffer-show-hook'
     *Note Temporary Displays::.

`term-setup-hook'
     *Note Terminal-Specific::.

`today-visible-calendar-hook'
     *Note Calendar Customizing: (emacs)Calendar Customizing.

`today-invisible-calendar-hook'
     *Note Calendar Customizing: (emacs)Calendar Customizing.

`window-configuration-change-hook'
     *Note Window Hooks::.

`window-scroll-functions'
     *Note Window Hooks::.

`window-setup-hook'
     *Note Window Systems::.

`window-size-change-functions'
     *Note Window Hooks::.

`write-contents-functions'
     *Note Saving Buffers::.

`write-file-functions'
     *Note Saving Buffers::.

`write-region-annotate-functions'
     *Note Saving Properties::.

