home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Professional / OS2PRO194.ISO / os2 / prgramer / unix / info / elisp.i20 < prev    next >
Encoding:
GNU Info File  |  1993-06-14  |  50.1 KB  |  1,200 lines

  1. This is Info file elisp, produced by Makeinfo-1.47 from the input file
  2. elisp.texi.
  3.  
  4.    This file documents GNU Emacs Lisp.
  5.  
  6.    This is edition 1.03 of the GNU Emacs Lisp Reference Manual, for
  7. Emacs Version 18.
  8.  
  9.    Published by the Free Software Foundation, 675 Massachusetts Avenue,
  10. Cambridge, MA 02139 USA
  11.  
  12.    Copyright (C) 1990 Free Software Foundation, Inc.
  13.  
  14.    Permission is granted to make and distribute verbatim copies of this
  15. manual provided the copyright notice and this permission notice are
  16. preserved on all copies.
  17.  
  18.    Permission is granted to copy and distribute modified versions of
  19. this manual under the conditions for verbatim copying, provided that
  20. the entire resulting derived work is distributed under the terms of a
  21. permission notice identical to this one.
  22.  
  23.    Permission is granted to copy and distribute translations of this
  24. manual into another language, under the above conditions for modified
  25. versions, except that this permission notice may be stated in a
  26. translation approved by the Foundation.
  27.  
  28. 
  29. File: elisp,  Node: Syntax Class Table,  Next: Syntax Flags,  Prev: Syntax Descriptors,  Up: Syntax Descriptors
  30.  
  31. Table of Syntax Classes
  32. -----------------------
  33.  
  34.    Here is a summary of the classes, the characters that stand for them,
  35. their meanings, and examples of their use.
  36.  
  37.  -- Syntax class: whitespace character
  38.      "Whitespace characters" (designated with ` ' or `-') separate
  39.      symbols and words from each other.  Typically, whitespace
  40.      characters have no other syntactic use, and multiple whitespace
  41.      characters are syntactically equivalent to one.  Space, tab,
  42.      newline and formfeed are almost always considered whitespace.
  43.  
  44.  -- Syntax class: word constituent
  45.      "Word constituents" (designated with `w') are parts of normal
  46.      English words and are typically used in variable and command names
  47.      in programs.  All upper and lower case letters and the digits are
  48.      typically word constituents.
  49.  
  50.  -- Syntax class: symbol constituent
  51.      "Symbol constituents" (designated with `_') are the extra
  52.      characters that are used in variable and command names along with
  53.      word constituents.  For example, the symbol constituents class is
  54.      used in Lisp mode to indicate that certain characters may be part
  55.      of symbol names even though they are not part of English words. 
  56.      These characters are `$&*+-_<>'.  In standard C, the only
  57.      non-word-constituent character that is valid in symbols is
  58.      underscore (`_').
  59.  
  60.  -- Syntax class: punctuation character
  61.      "Punctuation characters" (`.') are those characters that are used
  62.      as punctuation in English, or are used in some way in a programming
  63.      language to separate symbols from one another.  Most programming
  64.      language modes, including Emacs Lisp mode, have no characters in
  65.      this class since the few characters that are not symbol or word
  66.      constituents all have other uses.
  67.  
  68.  -- Syntax class: open parenthesis character
  69.  -- Syntax class: close parenthesis character
  70.      Open and close "parenthesis characters" are characters used in
  71.      dissimilar pairs to surround sentences or expressions.  Such a
  72.      grouping is begun with an open parenthesis character and
  73.      terminated with a close. Each open parenthesis character matches a
  74.      particular close parenthesis character, and vice versa.  Normally,
  75.      Emacs indicates momentarily the matching open parenthesis when you
  76.      insert a close parenthesis. *Note Blinking::.
  77.  
  78.      The class of open parentheses is designated with `(', and that of
  79.      close parentheses with `)'.
  80.  
  81.      In English text, and in C code, the parenthesis pairs are `()',
  82.      `[]', and `{}'.  In Emacs Lisp, the delimiters for lists and
  83.      vectors (`()' and `[]') are classified as parenthesis characters.
  84.  
  85.  -- Syntax class: string quote
  86.      "String quote characters" (designated with `"') is used to delimit
  87.      string constants in many languages, including Lisp and C.  The
  88.      same string quote character appears at the beginning and the end
  89.      of a string.  Such quoted strings do not nest.
  90.  
  91.      The parsing facilities of Emacs consider a string as a single
  92.      token. The usual syntactic meanings of the characters in the
  93.      string are suppressed.
  94.  
  95.      The Lisp modes have two string quote characters: double-quote (`"')
  96.      and vertical bar (`|').  `|' is not used in Emacs Lisp, but it is
  97.      used in Common Lisp.  C also has two string quote characters:
  98.      double-quote for strings, and single-quote (`'') for character
  99.      constants.
  100.  
  101.      English text has no string quote characters because English is not
  102.      a programming language.  Although quotation marks are used in
  103.      English, we do not want them to turn off the usual syntactic
  104.      properties of other characters in the quotation.
  105.  
  106.  -- Syntax class: escape
  107.      An "escape character" (designated with `\') starts an escape
  108.      sequence such as is used in C string and character constants.  The
  109.      character `\' belongs to this class in both C and Lisp.  (In C, it
  110.      is used thus only inside strings, but it turns out to cause no
  111.      trouble to treat it this way throughout C code.)
  112.  
  113.  -- Syntax class: character quote
  114.      A "character quote character" (designated with `/') quotes the
  115.      following character so that it loses its normal syntactic meaning.
  116.       This differs from an escape character in that only the character
  117.      immediately following is ever affected.
  118.  
  119.      This class is not currently used in any standard Emacs modes.
  120.  
  121.  -- Syntax class: paired delimiter
  122.      "Paired delimiter characters" (designated with `$') are like
  123.      string quote characters except that the syntactic properties of the
  124.      characters between the delimiters are not suppressed.  Only TeX
  125.      mode uses a paired identical delimiter presently--the `$' that
  126.      begins and ends math mode.
  127.  
  128.  -- Syntax class: expression prefix
  129.      An "expression prefix operator" (designated with `'') is used for
  130.      syntactic operators that are part of an expression if they appear
  131.      next to one but are not part of an adjoining symbol.  These
  132.      characters in Lisp include the apostrophe, `'' (used for quoting),
  133.      and the comma, `,' (used in macros).
  134.  
  135.  -- Syntax class: comment starter
  136.  -- Syntax class: comment ender
  137.      The "comment starter" and "comment ender" characters are used in
  138.      different languages to delimit comments.  These classes are
  139.      designated with `<' and `>', respectively.
  140.  
  141.      English text has no comment characters.  In Lisp, the semi-colon
  142.      (`;') starts a comment and a newline or formfeed ends one.
  143.  
  144. 
  145. File: elisp,  Node: Syntax Flags,  Prev: Syntax Class Table,  Up: Syntax Descriptors
  146.  
  147. Syntax Flags
  148. ------------
  149.  
  150.    In addition to the classes, entries for characters in a syntax table
  151. can include flags.  There are four possible flags, represented by the
  152. characters `1', `2', `3', and `4'.  All are used to describe
  153. multi-character comment delimiters.  A flag indicates that the
  154. character for which the entry is being made can *also* be part of a
  155. comment sequence, in addition to the syntactic properties associated
  156. with its character class.  The flags are independent of the class and
  157. each other for the sake of characters such as `*' in C mode, which is a
  158. punctuation character, *and* the second character of a start-of-comment
  159. sequence (`/*'), *and* the first character of an end-of-comment
  160. sequence (`*/').
  161.  
  162.    The flags for a character C are:
  163.  
  164.    * `1' means C is the start of a two-character comment start sequence.
  165.  
  166.    * `2' means C is the second character of such a sequence.
  167.  
  168.    * `3' means C is the start of a two-character comment end sequence.
  169.  
  170.    * `4' means C is the second character of such a sequence.
  171.  
  172. 
  173. File: elisp,  Node: Syntax Table Functions,  Next: Parsing Expressions,  Prev: Syntax Descriptors,  Up: Syntax Tables
  174.  
  175. Syntax Table Functions
  176. ======================
  177.  
  178.    In this section we describe functions for creating, accessing and
  179. altering syntax tables.
  180.  
  181.  -- Function: make-syntax-table &optional TABLE
  182.      This function constructs a copy of TABLE and returns it.  If TABLE
  183.      is not supplied (or is `nil'), it returns a copy of the current
  184.      syntax table.  Otherwise, an error is signaled if TABLE is not a
  185.      syntax table.
  186.  
  187.  -- Function: copy-syntax-table &optional TABLE
  188.      This function is identical to `make-syntax-table'.
  189.  
  190.  -- Command: modify-syntax-entry CHAR SYNTAX-DESCRIPTOR &optional TABLE
  191.      This function sets the syntax entry for CHAR according to
  192.      SYNTAX-DESCRIPTOR.  The syntax is changed only for TABLE, which
  193.      defaults to the current buffer's syntax table, and not in any
  194.      other syntax table.  The argument SYNTAX-DESCRIPTOR specifies the
  195.      desired syntax; this is a string beginning with a class designator
  196.      character, and optionally containing a matching character and
  197.      flags as well.  *Note Syntax Descriptors::.
  198.  
  199.      This function always returns `nil'.  The old syntax information in
  200.      the table for this character is discarded.
  201.  
  202.      An error is signaled if the first character of the syntax
  203.      descriptor is not one of the twelve syntax class designator
  204.      characters.  An error is also signaled if CHAR is not a character.
  205.  
  206.      Examples:
  207.  
  208.           ;; Put the space character in class whitespace.
  209.           (modify-syntax-entry ?\  " ")
  210.                => nil
  211.           
  212.           ;; Make `$' an open parenthesis character,
  213.           ;; with `^' as its matching close.
  214.           (modify-syntax-entry ?$ "(^")
  215.                => nil
  216.           ;; Make `^' a close parenthesis character,
  217.           ;; with `$' as its matching open.
  218.           (modify-syntax-entry ?^ ")$")
  219.                => nil
  220.           
  221.           ;; Make `/' a punctuation character,
  222.           ;; the first character of a start-comment sequence,
  223.           ;; and the second character of an end-comment sequence.
  224.           ;; This is used in C mode.
  225.           (modify-syntax-entry ?/ ".13")
  226.                => nil
  227.  
  228.  -- Function: char-syntax CHARACTER
  229.      This function returns the syntax class of CHARACTER, represented
  230.      by its mnemonic designator character.  This *only* returns the
  231.      class, not any matching parenthesis or flags.
  232.  
  233.      An error is signaled if CHAR is not a character.
  234.  
  235.      The first example shows that the syntax class of space is
  236.      whitespace (represented by a space).  The second example shows
  237.      that the syntax of `/' is punctuation in C-mode.  This does not
  238.      show the fact that it is also a comment sequence character.  The
  239.      third example shows that open parenthesis is in the class of open
  240.      parentheses.  This does not show the fact that it has a matching
  241.      character, `)'.
  242.  
  243.           (char-to-string (char-syntax ?\ ))
  244.                => " "
  245.           
  246.           (char-to-string (char-syntax ?/))
  247.                => "."
  248.           
  249.           (char-to-string (char-syntax ?\())
  250.                => "("
  251.  
  252.  -- Function: set-syntax-table TABLE
  253.      This function makes TABLE the syntax table for the current buffer.
  254.      It returns TABLE.
  255.  
  256.  -- Function: syntax-table
  257.      This function returns the current syntax table, which is the table
  258.      for the current buffer.
  259.  
  260.  -- command: describe-syntax
  261.      This function describes the syntax specifications of the current
  262.      syntax table.  It makes a listing in the `*Help*' buffer, and then
  263.      pops up a window to display it.  It returns `nil'.
  264.  
  265.      A portion of a description is shown here:
  266.  
  267.           (describe-syntax)
  268.                => nil
  269.           
  270.           ---------- Buffer: *Help* ----------
  271.           C-q             \       which means: escape
  272.           C-r .. C-_              which means: whitespace
  273.           !               .       which means: punctuation
  274.           (               ()      which means: open, matches )
  275.           )               )(      which means: close, matches (
  276.           * .. +          _       which means: symbol
  277.           ,               .       which means: punctuation
  278.           -               _       which means: symbol
  279.           .               .       which means: punctuation
  280.           /               . 13    which means: punctuation,
  281.                     is the first character of a comment-start sequence,
  282.                     is the first character of a comment-end sequence
  283.           0 .. 9          w       which means: word
  284.           ---------- Buffer: *Help* ----------
  285.  
  286. 
  287. File: elisp,  Node: Parsing Expressions,  Next: Standard Syntax Tables,  Prev: Syntax Table Functions,  Up: Syntax Tables
  288.  
  289. Parsing and Moving Over Balanced Expressions
  290. ============================================
  291.  
  292.    Here are several functions for parsing and scanning balanced
  293. expressions.  The syntax table controls the interpretation of
  294. characters, so these functions can be used for Lisp expressions when in
  295. Lisp mode and for C expressions when in C mode.  *Note List Motion::,
  296. for convenient higher-level functions for moving over balanced
  297. expressions.
  298.  
  299.  -- Function: parse-partial-sexp START LIMIT &optional TARGET-DEPTH
  300.           STOP-BEFORE STATE
  301.      This function parses an expression in the current buffer starting
  302.      at START, not scanning past LIMIT.  Parsing stops at LIMIT or when
  303.      certain criteria described below are met; point is set to the
  304.      location where parsing stops.  The value returned is a description
  305.      of the status of the parse at the point where it stops.
  306.  
  307.      Normally, START is assumed to be the top level of an expression to
  308.      be parsed, such as the beginning of a function definition.
  309.      Alternatively, you might wish to resume parsing in the middle of an
  310.      expression.  To do this, you must provide a STATE argument that
  311.      describes the initial status of parsing.  If STATE is omitted (or
  312.      `nil'), parsing assumes that START is the beginning of a new parse
  313.      at level 0.
  314.  
  315.      If the third argument TARGET-DEPTH is non-`nil', parsing stops if
  316.      the depth in parentheses becomes equal to TARGET-DEPTH. The depth
  317.      starts at 0, or at whatever is given in STATE.
  318.  
  319.      If the fourth argument STOP-BEFORE is non-`nil', parsing stops
  320.      when it comes to any character that starts a sexp.
  321.  
  322.      The fifth argument STATE is a seven-element list of the same form
  323.      as the value of this function, described below.  The return value
  324.      of one call may be used to initialize the state of the parse on
  325.      another call to `parse-partial-sexp'.
  326.  
  327.      The result is a list of seven elements describing the final state
  328.      of the parse:
  329.  
  330.        1. The depth in parentheses, starting at 0.
  331.  
  332.        2. The character position of the start of the innermost
  333.           containing parenthetical grouping; `nil' if none.
  334.  
  335.        3. The character position of the start of the last complete
  336.           subexpression terminated; `nil' if none.
  337.  
  338.        4. Non-`nil' if inside a string.  (It is the character that will
  339.           terminate the string.)
  340.  
  341.        5. `t' if inside a comment.
  342.  
  343.        6. `t' if point is just after a quote character.
  344.  
  345.        7. The minimum parenthesis depth encountered during this scan.
  346.  
  347.      Elements 1, 4, 5, and 6 are significant in the argument STATE.
  348.  
  349.      This function is used to determine how to indent lines in programs
  350.      written in languages that have nested parentheses.
  351.  
  352.  -- Function: scan-lists FROM COUNT DEPTH
  353.      This function scans forward COUNT balanced parenthetical groupings
  354.      from character number FROM.  It returns the character number of
  355.      the position thus found.
  356.  
  357.      If DEPTH is nonzero, parenthesis depth counting begins from that
  358.      value.  The only candidates for stopping are places where the
  359.      depth in parentheses becomes zero; `scan-lists' counts COUNT such
  360.      places and then stops.  Thus, a positive value for DEPTH means go
  361.      out levels of parenthesis.
  362.  
  363.      Comments are ignored if `parse-sexp-ignore-comments' is non-`nil'.
  364.  
  365.      If the beginning or end of the buffer (or its accessible portion)
  366.      is reached and the depth is not zero, an `end-of-file' error is
  367.      signaled.  If the depth is zero but the count is not used up, `nil'
  368.      is returned.
  369.  
  370.  -- Function: scan-sexps FROM COUNT
  371.      Scan from character number FROM by COUNT balanced expressions.  It
  372.      returns the character number of the position thus found.
  373.  
  374.      Comments are ignored if `parse-sexp-ignore-comments' is non-`nil'.
  375.  
  376.      If the beginning or end of (the accessible part of) the buffer is
  377.      reached in the middle of a parenthetical grouping, an `end-of-file'
  378.      error is signaled.  If the beginning or end is reached between
  379.      groupings but before count is used up, `nil' is returned.
  380.  
  381.  -- Function: backward-prefix-chars
  382.      This function moves point backward over any number of chars with
  383.      expression prefix syntax.
  384.  
  385.  -- Variable: parse-sexp-ignore-comments
  386.      If the value is non-`nil', then comments are treated as whitespace
  387.      by the functions in this section and by `forward-sexp'.
  388.  
  389.      This works only when the comment terminator is something like
  390.      `*/', and appears only to end a comment.  If comments are
  391.      terminated by newlines, you must make this variable `nil', since
  392.      not every newline is the end of a comment.  (In version 19, this
  393.      limitation is removed.)
  394.  
  395. 
  396. File: elisp,  Node: Standard Syntax Tables,  Next: Syntax Table Internals,  Prev: Parsing Expressions,  Up: Syntax Tables
  397.  
  398. Some Standard Syntax Tables
  399. ===========================
  400.  
  401.    Each of the major modes in Emacs has its own syntax table.  Here are
  402. several of them:
  403.  
  404.  -- Function: standard-syntax-table
  405.      This function returns the standard syntax table, which is the
  406.      syntax table used in Fundamental mode.
  407.  
  408.  -- Variable: text-mode-syntax-table
  409.      The value of this variable is the syntax table used in Text mode.
  410.  
  411.  -- Variable: c-mode-syntax-table
  412.      The value of this variable is the syntax table in use in C-mode
  413.      buffers.
  414.  
  415.  -- Variable: emacs-lisp-mode-syntax-table
  416.      The value of this variable is the syntax table used in Emacs Lisp
  417.      mode by editing commands.  (It has no effect on the Lisp `read'
  418.      function.)
  419.  
  420. 
  421. File: elisp,  Node: Syntax Table Internals,  Prev: Standard Syntax Tables,  Up: Syntax Tables
  422.  
  423. Syntax Table Internals
  424. ======================
  425.  
  426.    Each element of a syntax table is an integer that translates into the
  427. full meaning of the entry: class, possible matching character, and
  428. flags.  However, it is not common for a programmer to work with the
  429. entries directly in this form since the Lisp-level syntax table
  430. functions usually work with syntax descriptors (*note Syntax
  431. Descriptors::.).
  432.  
  433.    The low 8 bits of each element of a syntax table indicates the
  434. syntax class.
  435.  
  436. Integer
  437.      Class
  438.  
  439. 0
  440.      whitespace
  441.  
  442. 1
  443.      punctuation
  444.  
  445. 2
  446.      word
  447.  
  448. 3
  449.      symbol
  450.  
  451. 4
  452.      open parenthesis
  453.  
  454. 5
  455.      close parenthesis
  456.  
  457. 6
  458.      expression prefix
  459.  
  460. 7
  461.      string quote
  462.  
  463. 8
  464.      paired delimiter
  465.  
  466. 9
  467.      escape
  468.  
  469. 10
  470.      character quote
  471.  
  472. 11
  473.      comment-start
  474.  
  475. 12
  476.      comment-end
  477.  
  478.    The next 8 bits are the matching opposite parenthesis (if the
  479. character has parenthesis syntax); otherwise, they are not meaningful.
  480. The next 4 bits are the flags.
  481.  
  482. 
  483. File: elisp,  Node: Abbrevs,  Next: Processes,  Prev: Syntax Tables,  Up: Top
  484.  
  485. Abbrevs And Abbrev Expansion
  486. ****************************
  487.  
  488.    An abbreviation or "abbrev" is a string of characters that may be
  489. expanded to a longer string.  The user can insert the abbrev string and
  490. find it replaced automatically with the expansion of the abbrev.  This
  491. saves typing.
  492.  
  493.    The set of abbrevs currently in effect is recorded in an "abbrev
  494. table".  Each buffer has a local abbrev table, but normally all buffers
  495. in the same major mode share one abbrev table.  There is also a global
  496. abbrev table.  Normally both are used.
  497.  
  498.    An abbrev table is represented as an obarray containing a symbol for
  499. each abbreviation.  The symbol's name is the abbreviation.  Its value is
  500. the expansion; its function definition is the hook; its property list
  501. cell contains the use count, the number of times the abbreviation has
  502. been expanded.  Because these symbols are not inturned in the usual
  503. obarray, they will never appear as the result of reading a Lisp
  504. expression; in fact, they will never be used except by the code that
  505. handles abbrevs.  Therefore, it is safe to use them in an extremely
  506. nonstandard way.  *Note Creating Symbols::.
  507.  
  508.    For the user-level commands for abbrevs, see *Note Abbrev Mode:
  509. (emacs)Abbrevs.
  510.  
  511. * Menu:
  512.  
  513. * Abbrev Mode::                 Setting up Emacs for abbreviation.
  514. * Tables: Abbrev Tables.        Creating and working with abbrev tables.
  515. * Defining Abbrevs::            Specifying abbreviations and their expansions.
  516. * Files: Abbrev Files.          Saving abbrevs in files.
  517. * Expansion: Abbrev Expansion.  Controlling expansion; expansion subroutines.
  518. * Standard Abbrev Tables::      Abbrev tables used by various major modes.
  519.  
  520. 
  521. File: elisp,  Node: Abbrev Mode,  Next: Abbrev Tables,  Prev: Abbrevs,  Up: Abbrevs
  522.  
  523. Setting Up Abbrev Mode
  524. ======================
  525.  
  526.    Abbrev mode is a minor mode controlled by the value of the variable
  527. `abbrev-mode'.
  528.  
  529.  -- Variable: abbrev-mode
  530.      A non-`nil' value of this variable turns on the automatic expansion
  531.      of abbrevs when their abbreviations are inserted into a buffer. If
  532.      the value is `nil', abbrevs may be defined, but they are not
  533.      expanded automatically.
  534.  
  535.      This variable automatically becomes local when set in any fashion.
  536.  
  537.  -- Variable: default-abbrev-mode
  538.      This is the value `abbrev-mode' for buffers that do not override
  539.      it. This is the same as `(default-value 'abbrev-mode)'.
  540.  
  541. 
  542. File: elisp,  Node: Abbrev Tables,  Next: Defining Abbrevs,  Prev: Abbrev Mode,  Up: Abbrevs
  543.  
  544. Abbrev Tables
  545. =============
  546.  
  547.    This section describes how to create and manipulate abbrev tables.
  548.  
  549.  -- Function: make-abbrev-table
  550.      This function creates and returns a new, empty abbrev table--an
  551.      obarray containing no symbols.  It is a vector filled with `nil's.
  552.  
  553.  -- Function: clear-abbrev-table TABLE
  554.      This function undefines all the abbrevs in abbrev table TABLE,
  555.      leaving it empty.  The function returns `nil'.
  556.  
  557.  -- Function: define-abbrev-table TABNAME DEFINITIONS
  558.      This function defines TABNAME (a symbol) as an abbrev table name,
  559.      i.e., as a variable whose value is an abbrev table.  It defines
  560.      abbrevs in the table according to DEFINITIONS, a list of elements
  561.      of the form `(ABBREVNAME EXPANSION HOOK USECOUNT)'.  The value is
  562.      always `nil'.
  563.  
  564.  -- Variable: abbrev-table-name-list
  565.      This is a list of symbols whose values are abbrev tables.
  566.      `define-abbrev-table' adds the new abbrev table name to this list.
  567.  
  568.  -- Function: insert-abbrev-table-description NAME HUMAN
  569.      This function inserts before point a description of the abbrev
  570.      table named NAME.  The argument NAME is a symbol whose value is an
  571.      abbrev table.  The value is always `nil'.
  572.  
  573.      If HUMAN is non-`nil', a human-oriented description is inserted. 
  574.      Otherwise the description is a Lisp expression--a call to
  575.      `define-abbrev-table' which would define NAME exactly as it is
  576.      currently defined.
  577.  
  578. 
  579. File: elisp,  Node: Defining Abbrevs,  Next: Abbrev Files,  Prev: Abbrev Tables,  Up: Abbrevs
  580.  
  581. Defining Abbrevs
  582. ================
  583.  
  584.    These functions define an abbrev in a specified abbrev table.
  585. `define-abbrev' is the low-level basic function, while `add-abbrev' is
  586. used by commands that ask for information from the user.
  587.  
  588.  -- Function: add-abbrev TABLE TYPE ARG
  589.      This function adds an abbreviation to abbrev table TABLE.  The
  590.      argument TYPE is a string describing in English the kind of abbrev
  591.      this will be (typically, `"global"' or `"mode-specific"'); this is
  592.      used in prompting the user.  The argument ARG is the number of
  593.      words in the expansion.
  594.  
  595.      The return value is the symbol which internally represents the new
  596.      abbrev, or `nil' if the user declines to redefine an existing
  597.      abbrev.
  598.  
  599.  -- Function: define-abbrev TABLE NAME EXPANSION HOOK
  600.      This function defines an abbrev in TABLE named NAME, to expand to
  601.      EXPANSION, and call HOOK.  The return value is an uninterned
  602.      symbol which represents the abbrev inside Emacs; its name is NAME.
  603.  
  604.      The argument NAME should be a string.  The argument EXPANSION
  605.      should be a string, or `nil', to undefine the abbrev.
  606.  
  607.      The argument HOOK is a function or `nil'.  If HOOK is non-`nil',
  608.      then it is called with no arguments after the abbrev is replaced
  609.      with EXPANSION; point is located at the end of EXPANSION.
  610.  
  611.      The use count of the abbrev is initialized to zero.
  612.  
  613.  -- User Option: only-global-abbrevs
  614.      If this variable is non-`nil', it means that the user plans to use
  615.      global abbrevs only.  This tells the commands that define
  616.      mode-specific abbrevs to define global ones instead.  This
  617.      variable does not alter the functioning of the functions in this
  618.      section; it is examined by their callers.
  619.  
  620. 
  621. File: elisp,  Node: Abbrev Files,  Next: Abbrev Expansion,  Prev: Defining Abbrevs,  Up: Abbrevs
  622.  
  623. Saving Abbrevs in Files
  624. =======================
  625.  
  626.    A file of saved abbrev definitions is actually a file of Lisp code.
  627. The abbrevs are saved in the form of a Lisp program to define the same
  628. abbrev tables with the same contents.  Therefore, you can load the file
  629. with `load' (*note How Programs Do Loading::.).  However, the function
  630. `quietly-read-abbrev-file' is provided as a more convenient interface.
  631.  
  632.    User-level facilities such as `save-some-buffers' can save abbrevs
  633. in a file automatically, under the control of variables described here.
  634.  
  635.  -- User Option: abbrev-file-name
  636.      This is the default file name for reading and saving abbrevs.
  637.  
  638.  -- Function: quietly-read-abbrev-file FILENAME
  639.      This function reads abbrev definitions from a file named FILENAME,
  640.      previously written with `write-abbrev-file'.  If FILENAME is
  641.      `nil', the file specified in `abbrev-file-name' is used.
  642.      `save-abbrevs' is set to `t' so that changes will be saved.
  643.  
  644.      This function does not display any messages.  It returns `nil'.
  645.  
  646.  -- User Option: save-abbrevs
  647.      A non-`nil' value for `save-abbrev' means that Emacs should save
  648.      abbrevs when files are saved.  `abbrev-file-name' specifies the
  649.      file to save the abbrevs in.
  650.  
  651.  -- Variable: abbrevs-changed
  652.      This variable is set non-`nil' by defining or altering any
  653.      abbrevs.  This serves as a flag for various Emacs commands to
  654.      offer to save your abbrevs.
  655.  
  656.  -- Command: write-abbrev-file FILENAME
  657.      Save all abbrev definitions, in all abbrev tables, in the file
  658.      FILENAME as a Lisp program which will define the same abbrevs when
  659.      loaded.  This function returns `nil'.
  660.  
  661. 
  662. File: elisp,  Node: Abbrev Expansion,  Next: Standard Abbrev Tables,  Prev: Abbrev Files,  Up: Abbrevs
  663.  
  664. Looking Up and Expanding Abbreviations
  665. ======================================
  666.  
  667.    Abbrevs are usually expanded by commands for interactive use, or
  668. automatically by `self-insert'.  This section describes the subroutines
  669. used in writing such functions, as well as the variables they use for
  670. communication.
  671.  
  672.  -- Function: abbrev-symbol ABBREV TABLE
  673.      This function returns the symbol representing the abbrev named
  674.      ABBREV.  The value returned is `nil' if that abbrev is not
  675.      defined.  The optional second argument TABLE is the abbrev table
  676.      to look it up in.  By default, this function tries first the
  677.      current buffer's local abbrev table, and second the global abbrev
  678.      table.
  679.  
  680.  -- User Option: abbrev-all-caps
  681.      When this is set non-`nil', an abbrev entered entirely in upper
  682.      case is expanded using all upper case.  Otherwise, an abbrev
  683.      entered entirely in upper case is expanded by capitalizing each
  684.      word of the expansion.
  685.  
  686.  -- Function: abbrev-expansion ABBREV &optional TABLE
  687.      This function returns the string that ABBREV would expand into (as
  688.      defined by the abbrev tables used for the current buffer).  The
  689.      optional argument TABLE specifies the abbrev table to use; if it is
  690.      specified, the abbrev is looked up in that table only.
  691.  
  692.  -- Variable: abbrev-start-location
  693.      This is the buffer position for `expand-abbrev' to use as the start
  694.      of the next abbrev to be expanded.  `nil' means use the word before
  695.      point as the abbrev.  `abbrev-start-location' is set to `nil' each
  696.      time `expand-abbrev' is called.  This variable is set by
  697.      `abbrev-prefix-mark'.
  698.  
  699.  -- Variable: abbrev-start-location-buffer
  700.      The value of this variable is the buffer for which
  701.      `abbrev-start-location' has been set.  Trying to expand an abbrev
  702.      in any other buffer clears `abbrev-start-location'.  This variable
  703.      is set by `abbrev-prefix-mark'.
  704.  
  705.  -- Variable: last-abbrev
  706.      This is the `abbrev-symbol' of the last abbrev expanded.  This
  707.      information is left by `expand-abbrev' for the sake of the
  708.      `unexpand-abbrev' command.
  709.  
  710.  -- Variable: last-abbrev-location
  711.      This is the location of the last abbrev expanded.  This contains
  712.      information left by `expand-abbrev' for the sake of the
  713.      `unexpand-abbrev' command.
  714.  
  715.  -- Variable: last-abbrev-text
  716.      This is the exact expansion  text of the last abbrev expanded, as
  717.      results from case conversion.  Its value is `nil' if the abbrev
  718.      has already been unexpanded.  This contains information left by
  719.      `expand-abbrev' for the sake of the `unexpand-abbrev' command.
  720.  
  721. 
  722. File: elisp,  Node: Standard Abbrev Tables,  Prev: Abbrev Expansion,  Up: Abbrevs
  723.  
  724. Standard Abbrev Tables
  725. ======================
  726.  
  727.    Here we list the variables that hold the abbrev tables for the
  728. preloaded major modes of Emacs.
  729.  
  730.  -- Variable: global-abbrev-table
  731.      This is the abbrev table for mode-independent abbrevs.  The abbrevs
  732.      defined in it apply to all buffers.  Each buffer may also have a
  733.      local abbrev table, whose abbrev definitions take precedence over
  734.      those in the global table.
  735.  
  736.  -- Variable: local-abbrev-table
  737.      The value of this buffer-local variable is the (mode-specific)
  738.      abbreviation table of the current buffer.
  739.  
  740.  -- Variable: fundamental-mode-abbrev-table
  741.      This is the local abbrev table used in Fundamental mode.  It is the
  742.      local abbrev table in all buffers in Fundamental mode.
  743.  
  744.  -- Variable: text-mode-abbrev-table
  745.      This is the local abbrev table used in Text mode.
  746.  
  747.  -- Variable: c-mode-abbrev-table
  748.      This is the local abbrev table used in C mode.
  749.  
  750.  -- Variable: lisp-mode-abbrev-table
  751.      This is the local abbrev table used in Lisp mode and Emacs Lisp
  752.      mode.
  753.  
  754. 
  755. File: elisp,  Node: Processes,  Next: System Interface,  Prev: Abbrevs,  Up: Top
  756.  
  757. Processes
  758. *********
  759.  
  760.    In the terminology of operating systems, a "process" is a space in
  761. which a program can execute.  Emacs runs in a process.  Emacs Lisp
  762. programs can invoke other programs in processes of their own.  These are
  763. called "subprocesses" or "child processes" of the Emacs process, which
  764. is their "parent process".
  765.  
  766.    A subprocess of Emacs may be "synchronous" or "asynchronous".
  767. depending on how it is created.  When you create a synchronous
  768. subprocess, the Lisp program waits for the subprocess to terminate
  769. before continuing execution.  When you create an asynchronous
  770. subprocess, it can run in parallel with the Lisp program.  This kind of
  771. subprocess is represented within Emacs by a Lisp object which is also
  772. called a "process".  Lisp programs can use this object to communicate
  773. with the subprocess or to control it.  For example, you can send
  774. signals, obtain status information, receive output from the process, or
  775. send input to it.
  776.  
  777.  -- Function: processp OBJECT
  778.      This function returns `t' if OBJECT is a process, `nil' otherwise.
  779.  
  780. * Menu:
  781.  
  782. * Subprocess Creation::      Functions that start subprocesses.
  783. * Synchronous Processes::    Details of using synchronous subprocesses.
  784. * Asynchronous Processes::   Starting up an asynchronous subprocess.
  785. * Deleting Processes::       Eliminating an asynchronous subprocess.
  786. * Process Information::      Accessing run-status and other attributes.
  787. * Input to Processes::       Sending input to an asynchronous subprocess.
  788. * Signals to Processes::     Stopping, continuing or interrupting
  789.                                an asynchronous subprocess.
  790. * Output from Processes::    Collecting output from an asynchronous subprocess.
  791. * Sentinels::                Sentinels run when process run-status changes.
  792. * VMS Subprocesses::         VMS has completely different subprocess features.
  793. * TCP::                      Opening network connections.
  794.  
  795. 
  796. File: elisp,  Node: Subprocess Creation,  Next: Synchronous Processes,  Prev: Processes,  Up: Processes
  797.  
  798. Functions that Create Subprocesses
  799. ==================================
  800.  
  801.    There are three functions that create a new Unix subprocess in which
  802. to run a program.  One of them, `start-process', creates an
  803. asynchronous process and returns a process object (*note Asynchronous
  804. Processes::.).  The other two, `call-process' and
  805. `call-process-region', create a synchronous process and do not return a
  806. process object (*note Synchronous Processes::.).
  807.  
  808.    Synchronous and asynchronous processes are explained in following
  809. sections.  Since the three functions are all called in a similar
  810. fashion, their common arguments are described here.
  811.  
  812.    In all cases, the program to be run is specified with the function's
  813. PROGRAM argument.  An error is signaled if the file is not found or
  814. cannot be executed.  The actual file containing the program is found by
  815. following normal Unix rules: if an absolute file name is given, then
  816. the program must be found in the specified file; if a relative file name
  817. is given, then the directories in `exec-path' are searched sequentially
  818. for a suitable file.  The variable `exec-path' is initialized when
  819. Emacs is started, based on the value of the environment variable
  820. `PATH'.  The standard Unix abbreviations, `~', `.', and `..', are
  821. interpreted as usual, but environment variable substitutions (`$HOME',
  822. etc.) are not recognized; use `substitute-in-file-name' to perform them
  823. (*note File Name Expansion::.).
  824.  
  825.    Each of the subprocess-creating functions has a BUFFER-OR-NAME
  826. argument which specifies where the standard output from the program will
  827. go.  If BUFFER-OR-NAME is `nil', then the output will be discarded (by
  828. directing it to `/dev/null') unless a filter function is specified to
  829. handle it.  (*Note Filter Functions::, and *Note Streams::.)  Normally,
  830. you should avoid having multiple processes send output to the same
  831. buffer because the outputs will be intermixed randomly.
  832.  
  833.    All three of the subprocess-creating functions have a `&rest'
  834. argument, ARGS.  The ARGS must all be strings, and they are supplied to
  835. PROGRAM as separate command line arguments.  Wildcard characters and
  836. other shell constructs are not allowed in these strings, since they are
  837. passed directly to the specified program.  *Note:* the argument PROGRAM
  838. contains only the name of the program; it may not contain any
  839. command-line arguments.  Such arguments must be provided via ARGS.
  840.  
  841.    The subprocess gets its current directory from the value of
  842. `default-directory' (*note File Name Expansion::.).
  843.  
  844.    The subprocess inherits its environment from Emacs; but you can
  845. specify overrides for it with `process-environment'.
  846.  
  847.  -- Variable: process-environment
  848.      This variable is a list of strings to append to the environment of
  849.      processes as they are created.  Each string assigns a value to a
  850.      shell environment variable.  (This applies both to asynchronous and
  851.      synchronous processes.)
  852.  
  853.           process-environment
  854.           => ("l=/usr/stanford/lib/gnuemacs/lisp"
  855.               "PATH=.:/user/lewis/bin:/usr/class:/nfsusr/local/bin"
  856.               "USER=lewis"
  857.               "TERM=ibmapa16"
  858.               "SHELL=/bin/csh"
  859.               "HOME=/user/lewis")
  860.  
  861.  -- Variable: exec-directory
  862.      The value of this variable is the name of a directory (a string)
  863.      that contains programs that come with GNU Emacs, that are intended
  864.      for Emacs to invoke.  The program `loadst' is an example of such a
  865.      program; it is used by the `display-time' command to print the
  866.      current time (and certain other information) once per minute.
  867.  
  868.      The default value is the name of a directory whose name ends in
  869.      `etc'.  We call the directory `emacs/etc', since its name usually
  870.      ends that way.  We sometimes refer to "the directory `emacs/etc',"
  871.      when strictly speaking we ought to say, "the directory named by
  872.      the variable `exec-directory'."  Most of the time, there is no
  873.      difference.
  874.  
  875.  -- User Option: exec-path
  876.      The value of this variable is a list of directories to search for
  877.      programs to run in subprocesses.  Each element is either the name
  878.      of a directory (i.e., a string), or `nil', which stands for the
  879.      default directory (which is the value of `default-directory').
  880.  
  881.      The value of `exec-path' is used by `call-process' and
  882.      `start-process' when the PROGRAM argument is not an absolute file
  883.      name.
  884.  
  885. 
  886. File: elisp,  Node: Synchronous Processes,  Next: Asynchronous Processes,  Prev: Subprocess Creation,  Up: Processes
  887.  
  888. Creating a Synchronous Process
  889. ==============================
  890.  
  891.    After a "synchronous process" is created, Emacs waits for the
  892. process to terminate before continuing.  Starting Dired is an example of
  893. this: it runs `ls' in a synchronous process, then modifies the output
  894. slightly.  Because the process is synchronous, the entire directory
  895. listing arrives in the buffer before Emacs tries to do anything with it.
  896.  
  897.    While Emacs waits for the synchronous subprocess to terminate, the
  898. user can quit by typing `C-g', and the process is killed by sending it
  899. a `SIGKILL' signal.  *Note Quitting::.
  900.  
  901.    The synchronous subprocess functions return `nil' in version 18. In
  902. version 19, they will return an indication of how the process
  903. terminated.
  904.  
  905.  -- Function: call-process PROGRAM &optional INFILE BUFFER-OR-NAME
  906.           DISPLAY &rest ARGS
  907.      This function calls PROGRAM in a separate process and waits for it
  908.      to finish.
  909.  
  910.      The standard input for the process comes from file INFILE if
  911.      INFILE is not `nil' and from `/dev/null' otherwise.  The process
  912.      output gets inserted in buffer BUFFER-OR-NAME before point, if
  913.      that argument names a buffer.  If BUFFER-OR-NAME is `t', output is
  914.      sent to the current buffer; if BUFFER-OR-NAME is `nil', output is
  915.      discarded.
  916.  
  917.      If BUFFER-OR-NAME is the integer 0, the output is discarded and
  918.      `call-process' returns immediately.  In this case, the process is
  919.      not truly synchronous, since it can run in parallel with Emacs;
  920.      but you can think of it as synchronous in that Emacs is
  921.      essentially finished with the subprocess as soon as this function
  922.      returns.
  923.  
  924.      If DISPLAY is non-`nil', then `call-process' redisplays the buffer
  925.      as output is inserted.  Otherwise the function does no redisplay,
  926.      and the results become visible on the screen only when Emacs
  927.      redisplays that buffer in the normal course of events.
  928.  
  929.      The remaining arguments, ARGS, are strings that are supplied as
  930.      the command line arguments for the program.
  931.  
  932.      The examples below are both run with the buffer `foo' current.
  933.  
  934.           (call-process "pwd" nil t)
  935.                => nil
  936.           
  937.           ---------- Buffer: foo ----------
  938.           /usr/user/lewis/manual
  939.           ---------- Buffer: foo ----------
  940.           
  941.           (call-process "grep" nil "bar" nil "lewis" "/etc/passwd")
  942.                => nil
  943.           
  944.           ---------- Buffer: bar ----------
  945.           lewis:5LTsHm66CSWKg:398:21:Bil Lewis:/user/lewis:/bin/csh
  946.           
  947.           ---------- Buffer: bar ----------
  948.  
  949.      The `dired-readin' function contains a good example of the use of
  950.      `call-process':
  951.  
  952.           (call-process "ls" nil buffer nil dired-listing-switches dirname)
  953.  
  954.  -- Function: call-process-region START END PROGRAM &optional DELETE
  955.           BUFFER-OR-NAME DISPLAY &rest ARGS
  956.      This function sends the text between START to END as standard
  957.      input to a process running PROGRAM.  It deletes the text sent if
  958.      DELETE is non-`nil', which may be useful when the output is going
  959.      to be inserted back in the current buffer.
  960.  
  961.      If BUFFER-OR-NAME names a buffer, the output is inserted in that
  962.      buffer at point.  If BUFFER-OR-NAME is `t', the output is sent to
  963.      the current buffer.  If BUFFER-OR-NAME is `nil', the output is
  964.      discarded.  If BUFFER-OR-NAME is the integer 0, the output is
  965.      discarded and `call-process' returns immediately, as in
  966.      `call-process'.
  967.  
  968.      If DISPLAY is non-`nil', then `call-process-region' redisplays the
  969.      buffer as output is inserted.  Otherwise the function does no
  970.      redisplay, and the results become visible on the screen only when
  971.      Emacs redisplays that buffer in the normal course of events.
  972.  
  973.      The remaining arguments, ARGS, are strings that are supplied as
  974.      the command line arguments for the program.
  975.  
  976.      In the following example, we use `call-process-region' to run the
  977.      `cat' utility, with standard input being the first five characters
  978.      in buffer `foo' (the word `input').  `cat' copies its standard
  979.      input into its standard output.  Since the argument BUFFER-OR-NAME
  980.      is `t', this output is inserted in the current buffer.
  981.  
  982.           ---------- Buffer: foo ----------
  983.           input-!-
  984.           ---------- Buffer: foo ----------
  985.           
  986.           (call-process-region 1 6 "cat" nil t)
  987.                => nil
  988.           
  989.           ---------- Buffer: foo ----------
  990.           inputinput-!-
  991.           ---------- Buffer: foo ----------
  992.  
  993.      The `shell-command-on-region' command uses `call-process-region'
  994.      like this:
  995.  
  996.           (call-process-region start end
  997.                                shell-file-name    ; Name of program.
  998.                                nil                ; Do not delete region.
  999.                                buffer             ; Send output to `buffer'.
  1000.                                nil                ; No redisplay during output.
  1001.                                "-c" command)      ; Arguments for the shell.
  1002.  
  1003. 
  1004. File: elisp,  Node: Asynchronous Processes,  Next: Deleting Processes,  Prev: Synchronous Processes,  Up: Processes
  1005.  
  1006. Creating an Asynchronous Process
  1007. ================================
  1008.  
  1009.    After an "asynchronous process" is created, Emacs and the Lisp
  1010. program can continue running immediately.  The process may thereafter
  1011. run in parallel with Emacs, and the two may communicate with each other
  1012. using the functions described in following sections.  Here we describe
  1013. how to create an asynchronous process, with `start-process'.
  1014.  
  1015.  -- Function: start-process NAME BUFFER-OR-NAME PROGRAM &rest ARGS
  1016.      This function creates a new asynchronous subprocess and starts the
  1017.      program PROGRAM running in it.  It returns a process object that
  1018.      stands for the new subprocess for Emacs Lisp programs.  The
  1019.      argument NAME specifies the name for the process object; if a
  1020.      process with this name already exists, then NAME is modified (by
  1021.      adding `<1>', etc.) to be unique.  The buffer BUFFER-OR-NAME is the
  1022.      buffer to associate with the process.
  1023.  
  1024.      The remaining arguments, ARGS, are strings that are supplied as
  1025.      the command line arguments for the program.
  1026.  
  1027.      In the example below, the first process is started and runs
  1028.      (rather, sleeps) for 100 seconds.  Meanwhile, the second process
  1029.      is started, given the name `my-process<1>' for the sake of
  1030.      uniqueness.  It inserts the directory listing at the end of the
  1031.      buffer `foo', before the first process finishes.  Then it
  1032.      finishes, and a message to that effect is inserted in the buffer. 
  1033.      Much later, the first process finishes, and another message is
  1034.      inserted in the buffer for it.
  1035.  
  1036.           (start-process "my-process" "foo" "sleep" "100")
  1037.                => #<process my-process>
  1038.           
  1039.           (start-process "my-process" "foo" "ls" "-l" "/user/lewis/bin")
  1040.                => #<process my-process<1>>
  1041.           
  1042.           ---------- Buffer: foo ----------
  1043.           total 2
  1044.           lrwxrwxrwx  1 lewis          14 Jul 22 10:12 gnuemacs --> /emacs
  1045.           -rwxrwxrwx  1 lewis          19 Jul 30 21:02 lemon
  1046.           
  1047.           Process my-process<1> finished
  1048.           
  1049.           Process my-process finished
  1050.           ---------- Buffer: foo ----------
  1051.  
  1052.  -- Variable: process-connection-type
  1053.      This variable controls the type of device used to communicate with
  1054.      asynchronous subprocesses.  If it is `nil', then pipes are used.
  1055.      If it is `t', then PTYs are used (or pipes if PTYs not supported).
  1056.  
  1057.      PTYs are usually preferable for processes visible to the user, as
  1058.      in Shell mode, because they allow job control (`C-c', `C-z', etc.)
  1059.      to work between the process and its children whereas pipes do not.
  1060.      For subprocesses used for internal purposes by programs, it is
  1061.      often better to use a pipe, because they are more efficient.  In
  1062.      addition, the total number of PTYs is limited on many systems and
  1063.      it is good not to waste them.
  1064.  
  1065.      The value `process-connection-type' is used when `start-process'
  1066.      is called, so in order to change it for just one call of
  1067.      `start-process', temporarily rebind it with `let'.
  1068.  
  1069.           (let ((process-connection-type nil))  ; Use a pipe.
  1070.             (start-process ...))
  1071.  
  1072. 
  1073. File: elisp,  Node: Deleting Processes,  Next: Process Information,  Prev: Asynchronous Processes,  Up: Processes
  1074.  
  1075. Deleting Processes
  1076. ==================
  1077.  
  1078.    "Deleting a process" disconnects Emacs immediately from the
  1079. subprocess, and removes it from the list of active processes.  It sends
  1080. a signal to the subprocess to make the subprocess terminate, but this is
  1081. not guaranteed to happen immediately.  (The process object itself
  1082. continues to exist as long as other Lisp objects point to it.)
  1083.  
  1084.    You can delete a process explicitly at any time.  Processes are
  1085. deleted automatically after they terminate, but not necessarily right
  1086. away.  If you delete a terminated process explicitly before it is
  1087. deleted automatically, no harm results.
  1088.  
  1089.  -- Variable: delete-exited-processes
  1090.      This variable controls automatic deletion of processes that have
  1091.      terminated (due to calling `exit' or to a signal).  If it is
  1092.      `nil', then they continue to exist until the user runs
  1093.      `list-processes'.  Otherwise, they are deleted immediately after
  1094.      they exit.
  1095.  
  1096.  -- Function: delete-process NAME
  1097.      This function deletes the process associated with NAME.  The
  1098.      argument NAME may be a process, the name of a process, a buffer,
  1099.      or the name of a buffer.  The subprocess is killed with a `SIGHUP'
  1100.      signal.
  1101.  
  1102.           (delete-process "*shell*")
  1103.                => nil
  1104.  
  1105.  -- Function: process-kill-without-query PROCESS
  1106.      This function declares that Emacs need not query the user if
  1107.      PROCESS is still running when Emacs is exited.  The process will
  1108.      be deleted silently.  The value is `t'.
  1109.  
  1110.           (process-kill-without-query (get-process "shell"))
  1111.                => t
  1112.  
  1113. 
  1114. File: elisp,  Node: Process Information,  Next: Input to Processes,  Prev: Deleting Processes,  Up: Processes
  1115.  
  1116. Process Information
  1117. ===================
  1118.  
  1119.    Several functions return information about processes.
  1120. `list-processes' is provided for interactive use.
  1121.  
  1122.  -- Command: list-processes
  1123.      This command displays a listing of all living processes.  (Any
  1124.      processes listed as `Exited' or `Signaled' are actually eliminated
  1125.      after the listing is made.)  This function returns `nil'.
  1126.  
  1127.  -- Function: process-list
  1128.      This function returns a list of all processes that have not been
  1129.      deleted.
  1130.  
  1131.           (process-list)
  1132.                => (#<process display-time> #<process shell>)
  1133.  
  1134.  -- Function: get-process NAME
  1135.      This function returns the process named NAME, or `nil' if there is
  1136.      none.  An error is signaled if NAME is not a string.
  1137.  
  1138.           (get-process "shell")
  1139.                => #<process shell>
  1140.  
  1141.  -- Function: process-command PROCESS
  1142.      This function returns the command that was executed to start
  1143.      PROCESS.  This is a list of strings, the first string being the
  1144.      program executed and the rest of the strings being the arguments
  1145.      that were given to the program.
  1146.  
  1147.           (process-command (get-process "shell"))
  1148.                => ("/bin/csh" "-i")
  1149.  
  1150.  -- Function: process-exit-status PROCESS
  1151.      This function returns the exit status of PROCESS or the signal
  1152.      number that killed it.  If PROCESS has not yet terminated, the
  1153.      value is 0.
  1154.  
  1155.  -- Function: process-id PROCESS
  1156.      This function returns the PID of PROCESS.  This is an integer
  1157.      which distinguishes the process PROCESS from all other processes
  1158.      running on the same computer at the current time.  The PID of a
  1159.      process is chosen by the operating system kernel when the process
  1160.      is started and remains constant as long as the process exists.
  1161.  
  1162.  -- Function: process-name PROCESS
  1163.      This function returns the name of PROCESS.
  1164.  
  1165.  -- Function: process-status PROCESS-NAME
  1166.      This function returns the status of PROCESS-NAME as a symbol. The
  1167.      argument PROCESS-NAME must be either a process or a string. If it
  1168.      is a string, it need not name an actual process.
  1169.  
  1170.      The possible values for an actual subprocess are:
  1171.  
  1172.     `run'
  1173.           for a process that is running.
  1174.  
  1175.     `stop'
  1176.           for a process that is stopped but continuable.
  1177.  
  1178.     `exit'
  1179.           for a process that has exited.
  1180.  
  1181.     `signal'
  1182.           for a process that has received a fatal signal.
  1183.  
  1184.     `nil'
  1185.           if PROCESS-NAME is not the name of an existing process.
  1186.  
  1187.           (process-status "shell")
  1188.                => run
  1189.           (process-status "never-existed")
  1190.                => nil
  1191.           x
  1192.                => #<process xx<1>>
  1193.           (process-status x)
  1194.                => exit
  1195.  
  1196.      For a network stream, `process-status' returns one of the symbols
  1197.      `open' or `closed'.  The latter means that the other side closed
  1198.      the connection, or Emacs did `delete-process'.
  1199.  
  1200.