home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / elisp / elisp-22 < prev    next >
Encoding:
GNU Info File  |  1993-05-31  |  48.7 KB  |  1,221 lines

  1. This is Info file elisp, produced by Makeinfo-1.55 from the input file
  2. elisp.texi.
  3.  
  4.    This is edition 2.0 of the GNU Emacs Lisp Reference Manual, for
  5. Emacs Version 19.
  6.  
  7.    Published by the Free Software Foundation, 675 Massachusetts Avenue,
  8. Cambridge, MA 02139 USA
  9.  
  10.    Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
  11.  
  12.    Permission is granted to make and distribute verbatim copies of this
  13. manual provided the copyright notice and this permission notice are
  14. preserved on all copies.
  15.  
  16.    Permission is granted to copy and distribute modified versions of
  17. this manual under the conditions for verbatim copying, provided that
  18. the entire resulting derived work is distributed under the terms of a
  19. permission notice identical to this one.
  20.  
  21.    Permission is granted to copy and distribute translations of this
  22. manual into another language, under the above conditions for modified
  23. versions, except that this permission notice may be stated in a
  24. translation approved by the Foundation.
  25.  
  26. 
  27. File: elisp,  Node: Skipping Characters,  Prev: List Motion,  Up: Motion
  28.  
  29. Skipping Characters
  30. -------------------
  31.  
  32.    The following two functions move point over a specified set of
  33. characters.  For example, they are often used to skip whitespace.  For
  34. related functions, see *Note Motion and Syntax::.
  35.  
  36.  - Function: skip-chars-forward CHARACTER-SET &optional LIMIT
  37.      This function moves point in the current buffer forward, skipping
  38.      over a given set of characters.  Emacs first examines the
  39.      character following point; if it matches CHARACTER-SET, then point
  40.      is advanced and the next character is examined.  This continues
  41.      until a character is found that does not match.  The function
  42.      returns `nil'.
  43.  
  44.      The argument CHARACTER-SET is like the inside of a `[...]' in a
  45.      regular expression except that `]' is never special and `\' quotes
  46.      `^', `-' or `\'.  Thus, `"a-zA-Z"' skips over all letters,
  47.      stopping before the first nonletter, and `"^a-zA-Z'" skips
  48.      nonletters stopping before the first letter.  *Note Regular
  49.      Expressions::.
  50.  
  51.      If LIMIT is supplied (it must be a number or a marker), it
  52.      specifies the maximum position in the buffer that point can be
  53.      skipped to.  Point will stop at or before LIMIT.
  54.  
  55.      In the following example, point is initially located directly
  56.      before the `T'.  After the form is evaluated, point is located at
  57.      the end of that line (between the `t' of `hat' and the newline).
  58.      The function skips all letters and spaces, but not newlines.
  59.  
  60.           ---------- Buffer: foo ----------
  61.           I read "-!-The cat in the hat
  62.           comes back" twice.
  63.           ---------- Buffer: foo ----------
  64.           
  65.           (skip-chars-forward "a-zA-Z ")
  66.                => nil
  67.           
  68.           ---------- Buffer: foo ----------
  69.           I read "The cat in the hat-!-
  70.           comes back" twice.
  71.           ---------- Buffer: foo ----------
  72.  
  73.  - Function: skip-chars-backward CHARACTER-SET &optional LIMIT
  74.      This function moves point backward, skipping characters that match
  75.      CHARACTER-SET.  It just like `skip-chars-forward' except for the
  76.      direction of motion.
  77.  
  78. 
  79. File: elisp,  Node: Excursions,  Next: Narrowing,  Prev: Motion,  Up: Positions
  80.  
  81. Excursions
  82. ==========
  83.  
  84.    It is often useful to move point "temporarily" within a localized
  85. portion of the program, or to switch buffers temporarily.  This is
  86. called an "excursion", and it is done with the `save-excursion' special
  87. form.  This construct saves the current buffer and its values of point
  88. and the mark so they can be restored after the completion of the
  89. excursion.
  90.  
  91.    The forms for saving and restoring the configuration of windows are
  92. described elsewhere (see *Note Window Configurations::, and *note Frame
  93. Configurations::.).
  94.  
  95.  - Special Form: save-excursion FORMS...
  96.      The `save-excursion' special form saves the identity of the current
  97.      buffer and the values of point and the mark in it, evaluates FORMS,
  98.      and finally restores the buffer and its saved values of point and
  99.      the mark.  All three saved values are restored even in case of an
  100.      abnormal exit via throw or error (*note Nonlocal Exits::.).
  101.  
  102.      The `save-excursion' special form is the standard way to switch
  103.      buffers or move point within one part of a program and avoid
  104.      affecting the rest of the program.  It is used more than 500 times
  105.      in the Lisp sources of Emacs.
  106.  
  107.      The values of point and the mark for other buffers are not saved by
  108.      `save-excursion', so any changes made to point and the mark in the
  109.      other buffers will remain in effect after `save-excursion' exits.
  110.  
  111.      Likewise, `save-excursion' does not restore window-buffer
  112.      correspondences altered by functions such as `switch-to-buffer'.
  113.      One way to restore these correspondences, and the selected window,
  114.      is to use `save-window-excursion' inside `save-excursion' (*note
  115.      Window Configurations::.).
  116.  
  117.      The value returned by `save-excursion' is the result of the last of
  118.      FORMS, or `nil' if no FORMS are given.
  119.  
  120.           (save-excursion
  121.             FORMS)
  122.           ==
  123.           (let ((old-buf (current-buffer))
  124.                 (old-pnt (point-marker))
  125.                 (old-mark (copy-marker (mark-marker))))
  126.             (unwind-protect
  127.                 (progn FORMS)
  128.               (set-buffer old-buf)
  129.               (goto-char old-pnt)
  130.               (set-marker (mark-marker) old-mark)))
  131.  
  132. 
  133. File: elisp,  Node: Narrowing,  Prev: Excursions,  Up: Positions
  134.  
  135. Narrowing
  136. =========
  137.  
  138.    "Narrowing" means limiting the text addressable by Emacs editing
  139. commands to a limited range of characters in a buffer.  The text that
  140. remains addressable is called the "accessible portion" of the buffer.
  141.  
  142.    Narrowing is specified with two buffer positions which become the
  143. beginning and end of the accessible portion.  For most editing commands
  144. these positions replace the values of the beginning and end of the
  145. buffer.  While narrowing is in effect, no text outside the accessible
  146. portion is displayed, and point cannot move outside the accessible
  147. portion.
  148.  
  149.    Values such as positions or line numbers which usually count from the
  150. beginning of the buffer continue to do so, but the functions which use
  151. them will refuse to operate on text that is inaccessible.
  152.  
  153.    The commands for saving buffers are unaffected by narrowing; the
  154. entire buffer is saved regardless of the any narrowing.
  155.  
  156.  - Command: narrow-to-region START END
  157.      This function sets the accessible portion of the current buffer to
  158.      start at START and end at END.  Both arguments should be character
  159.      positions.
  160.  
  161.      In an interactive call, START and END are set to the bounds of the
  162.      current region (point and the mark, with the smallest first).
  163.  
  164.  - Command: narrow-to-page MOVE-COUNT
  165.      This function sets the accessible portion of the current buffer to
  166.      include just the current page.  An optional first argument
  167.      MOVE-COUNT non-`nil' means to move forward or backward by
  168.      MOVE-COUNT pages and then narrow.
  169.  
  170.      In an interactive call, MOVE-COUNT is set to the numeric prefix
  171.      argument.
  172.  
  173.  - Command: widen
  174.      This function cancels any narrowing in the current buffer, so that
  175.      the entire contents are accessible.  This is called "widening".
  176.      It is equivalent to the following expression:
  177.  
  178.           (narrow-to-region 1 (1+ (buffer-size)))
  179.  
  180.  - Special Form: save-restriction BODY...
  181.      This special form saves the current bounds of the accessible
  182.      portion, evaluates the BODY forms, and finally restores the saved
  183.      bounds, thus restoring the same state of narrowing (or absence
  184.      thereof) formerly in effect.  The state of narrowing is restored
  185.      even in the event of an abnormal exit via throw or error (*note
  186.      Nonlocal Exits::.).  Therefore, this construct is a clean way to
  187.      narrow a buffer temporarily.
  188.  
  189.      The value returned by `save-restriction' is that returned by the
  190.      last form in BODY, or `nil' if no body forms were given.
  191.  
  192.      *Caution:* it is easy to make a mistake when using the
  193.      `save-restriction' function.  Read the entire description here
  194.      before you try it.
  195.  
  196.      If BODY changes the current buffer, `save-restriction' still
  197.      restores the restrictions on the original buffer (the buffer they
  198.      came from), but it does not restore the identity of the current
  199.      buffer.
  200.  
  201.      Point and the mark are *not* restored by this special form; use
  202.      `save-excursion' for that.  If you use both `save-restriction' and
  203.      `save-excursion' together, `save-excursion' should come first (on
  204.      the outside).  Otherwise, the old point value would be restored
  205.      with temporary narrowing still in effect.  If the old point value
  206.      were outside the limits of the temporary narrowing, this would
  207.      fail to restore it accurately.
  208.  
  209.      The `save-restriction' special form records the values of the
  210.      beginning and end of the accessible portion as distances from the
  211.      beginning and end of the buffer.  In other words, it records the
  212.      amount of inaccessible text before and after the accessible
  213.      portion.
  214.  
  215.      This technique yields correct results if BODY does further
  216.      narrowing.  However, `save-restriction' can become confused if they
  217.      widen and then make changes outside the area of the saved
  218.      narrowing.  When this is what you want to do, `save-restriction'
  219.      is not the right tool for the job.  Here is what you must use
  220.      instead:
  221.  
  222.           (let ((beg (point-min-marker))
  223.                 (end (point-max-marker)))
  224.             (unwind-protect
  225.                 (progn BODY)
  226.               (save-excursion
  227.                 (set-buffer (marker-buffer beg))
  228.                 (narrow-to-region beg end))))
  229.  
  230.      Here is a simple example of correct use of `save-restriction':
  231.  
  232.           ---------- Buffer: foo ----------
  233.           This is the contents of foo
  234.           This is the contents of foo
  235.           This is the contents of foo-!-
  236.           ---------- Buffer: foo ----------
  237.           
  238.           (save-excursion
  239.             (save-restriction
  240.               (goto-char 1)
  241.               (forward-line 2)
  242.               (narrow-to-region 1 (point))
  243.               (goto-char (point-min))
  244.               (replace-string "foo" "bar")))
  245.           
  246.           ---------- Buffer: foo ----------
  247.           This is the contents of bar
  248.           This is the contents of bar
  249.           This is the contents of foo-!-
  250.           ---------- Buffer: foo ----------
  251.  
  252. 
  253. File: elisp,  Node: Markers,  Next: Text,  Prev: Positions,  Up: Top
  254.  
  255. Markers
  256. *******
  257.  
  258.    A "marker" is a Lisp object used to specify a position in a buffer
  259. relative to the surrounding text.  A marker changes its offset from the
  260. beginning of the buffer automatically whenever text is inserted or
  261. deleted, so that it stays with the two characters on either side of it.
  262.  
  263. * Menu:
  264.  
  265. * Overview of Markers::      The components of a marker, and how it relocates.
  266. * Predicates on Markers::    Testing whether an object is a marker.
  267. * Creating Markers::         Making empty markers or markers at certain places.
  268. * Information from Markers:: Finding the marker's buffer or character position.
  269. * Changing Markers::         Moving the marker to a new buffer or position.
  270. * The Mark::                 How "the mark" is implemented with a marker.
  271. * The Region::               How to access "the region".
  272.  
  273. 
  274. File: elisp,  Node: Overview of Markers,  Next: Predicates on Markers,  Prev: Markers,  Up: Markers
  275.  
  276. Overview of Markers
  277. ===================
  278.  
  279.    A marker specifies a buffer and a position in that buffer.  The
  280. marker can be used to represent a position in the functions that
  281. require one, just as an integer could be used.  *Note Positions::, for
  282. a complete description of positions.
  283.  
  284.    A marker has two attributes: the marker position, and the marker
  285. buffer.  The marker position is an integer which is equivalent (at the
  286. moment) to the marker as a position in that buffer; however, as text is
  287. inserted or deleted in the buffer, the marker is relocated, so that its
  288. integer equivalent changes.  The idea is that a marker positioned
  289. between two characters in a buffer will remain between those two
  290. characters despite any changes made to the contents of the buffer; thus,
  291. a marker's offset from the beginning of a buffer may change often during
  292. the life of the marker.
  293.  
  294.    If the text around a marker is deleted, the marker is repositioned
  295. between the characters immediately before and after the deleted text.
  296. If text is inserted at the position of a marker, the marker remains in
  297. front of the new text unless it is inserted with `insert-before-markers'
  298. (*note Insertion::.).  When text is inserted or deleted somewhere
  299. before the marker position (not next to the marker), the marker moves
  300. back and forth with the two neighboring characters.
  301.  
  302.    When a buffer is modified, all of its markers must be checked so that
  303. they can be relocated if necessary.  This slows processing in a buffer
  304. with a large number of markers.  For this reason, it is a good idea to
  305. make a marker point nowhere if you are sure you don't need it any more.
  306. Unreferenced markers will eventually be garbage collected, but until
  307. then will continue to be updated if they do point somewhere.
  308.  
  309.    Because it is quite common to perform arithmetic operations on a
  310. marker position, most of the arithmetic operations (including `+' and
  311. `-') accept markers as arguments.  In such cases, the current position
  312. of the marker is used.
  313.  
  314.    Here are examples of creating markers, setting markers, and moving
  315. point to markers:
  316.  
  317.      ;; Make a new marker that initially does not point anywhere:
  318.      (setq m1 (make-marker))
  319.           => #<marker in no buffer>
  320.      
  321.      ;; Set `m1' to point between the 100th and 101st characters
  322.      ;;   in the current buffer:
  323.      (set-marker m1 100)
  324.           => #<marker at 100 in markers.texi>
  325.      
  326.      ;; Now insert one character at the beginning of the buffer:
  327.      (goto-char (point-min))
  328.           => 1
  329.      (insert "Q")
  330.           => nil
  331.      
  332.      ;; `m1' is updated appropriately.
  333.      m1
  334.           => #<marker at 101 in markers.texi>
  335.      
  336.      ;; Two markers that point to the same position
  337.      ;;   are not `eq', but they are `equal'.
  338.      (setq m2 (copy-marker m1))
  339.           => #<marker at 101 in markers.texi>
  340.      (eq m1 m2)
  341.           => nil
  342.      (equal m1 m2)
  343.           => t
  344.      
  345.      ;; When you are finished using a marker, make it point nowhere.
  346.      (set-marker m1 nil)
  347.           => #<marker in no buffer>
  348.  
  349. 
  350. File: elisp,  Node: Predicates on Markers,  Next: Creating Markers,  Prev: Overview of Markers,  Up: Markers
  351.  
  352. Predicates on Markers
  353. =====================
  354.  
  355.    You can test an object to see whether it is a marker, or whether it
  356. is either an integer or a marker.  The latter test is useful when you
  357. are using the arithmetic functions that work with both markers and
  358. integers.
  359.  
  360.  - Function: markerp OBJECT
  361.      This function returns `t' if OBJECT is a marker, `nil' otherwise.
  362.      In particular, integers are not markers, even though many
  363.      functions will accept either a marker or an integer.
  364.  
  365.  - Function: integer-or-marker-p OBJECT
  366.      This function returns `t' if OBJECT is an integer or a marker,
  367.      `nil' otherwise.
  368.  
  369.  - Function: number-or-marker-p OBJECT
  370.      This function returns `t' if OBJECT is a number (of any type) or a
  371.      marker, `nil' otherwise.
  372.  
  373. 
  374. File: elisp,  Node: Creating Markers,  Next: Information from Markers,  Prev: Predicates on Markers,  Up: Markers
  375.  
  376. Functions That Create Markers
  377. =============================
  378.  
  379.    When you create a new marker, you can make it point nowhere, or point
  380. to the present position of point, or to the beginning or end of the
  381. accessible portion of the buffer, or to the same place as another given
  382. marker.
  383.  
  384.  - Function: make-marker
  385.      This functions returns a newly allocated marker that does not point
  386.      anywhere.
  387.  
  388.           (make-marker)
  389.                => #<marker in no buffer>
  390.  
  391.  - Function: point-marker
  392.      This function returns a new marker that points to the present
  393.      position of point in the current buffer.  *Note Point::.  For an
  394.      example, see `copy-marker', below.
  395.  
  396.  - Function: point-min-marker
  397.      This function returns a new marker that points to the beginning of
  398.      the accessible portion of the buffer.  This will be the beginning
  399.      of the buffer unless narrowing is in effect.  *Note Narrowing::.
  400.  
  401.  - Function: point-max-marker
  402.      This function returns a new marker that points to the end of the
  403.      accessible portion of the buffer.  This will be the end of the
  404.      buffer unless narrowing is in effect.  *Note Narrowing::.
  405.  
  406.      Here are examples of this function and `point-min-marker', shown in
  407.      a buffer containing a version of the source file for the text of
  408.      this chapter.
  409.  
  410.           (point-min-marker)
  411.                => #<marker at 1 in markers.texi>
  412.           (point-max-marker)
  413.                => #<marker at 15573 in markers.texi>
  414.           
  415.           (narrow-to-region 100 200)
  416.                => nil
  417.           (point-min-marker)
  418.                => #<marker at 100 in markers.texi>
  419.           (point-max-marker)
  420.                => #<marker at 200 in markers.texi>
  421.  
  422.  - Function: copy-marker MARKER-OR-INTEGER
  423.      If passed a marker as its argument, `copy-marker' returns a new
  424.      marker that points to the same place and the same buffer as does
  425.      MARKER-OR-INTEGER.  If passed an integer as its argument,
  426.      `copy-marker' returns a new marker that points to position
  427.      MARKER-OR-INTEGER in the current buffer.
  428.  
  429.      If passed an argument that is an integer whose value is less than
  430.      1, `copy-marker' returns a new marker that points to the beginning
  431.      of the current buffer.  If passed an argument that is an integer
  432.      whose value is greater than the length of the buffer, then
  433.      `copy-marker' returns a new marker that points to the end of the
  434.      buffer.
  435.  
  436.      An error is signaled if MARKER is neither a marker nor an integer.
  437.  
  438.           (setq p (point-marker))
  439.                => #<marker at 2139 in markers.texi>
  440.           
  441.           (setq q (copy-marker p))
  442.                => #<marker at 2139 in markers.texi>
  443.           
  444.           (eq p q)
  445.                => nil
  446.           
  447.           (equal p q)
  448.                => t
  449.           
  450.           (copy-marker 0)
  451.                => #<marker at 1 in markers.texi>
  452.           
  453.           (copy-marker 20000)
  454.                => #<marker at 7572 in markers.texi>
  455.  
  456. 
  457. File: elisp,  Node: Information from Markers,  Next: Changing Markers,  Prev: Creating Markers,  Up: Markers
  458.  
  459. Information from Markers
  460. ========================
  461.  
  462.    This section describes the functions for accessing the components of
  463. a marker object.
  464.  
  465.  - Function: marker-position MARKER
  466.      This function returns the position that MARKER points to, or `nil'
  467.      if it points nowhere.
  468.  
  469.  - Function: marker-buffer MARKER
  470.      This function returns the buffer that MARKER points into, or `nil'
  471.      if it points nowhere.
  472.  
  473.           (setq m (make-marker))
  474.                => #<marker in no buffer>
  475.           (marker-position m)
  476.                => nil
  477.           (marker-buffer m)
  478.                => nil
  479.           
  480.           (set-marker m 3770 (current-buffer))
  481.                => #<marker at 3770 in markers.texi>
  482.           (marker-buffer m)
  483.                => #<buffer markers.texi>
  484.           (marker-position m)
  485.                => 3770
  486.  
  487.    Two distinct markers will be found `equal' (even though not `eq') to
  488. each other if they have the same position and buffer, or if they both
  489. point nowhere.
  490.  
  491. 
  492. File: elisp,  Node: Changing Markers,  Next: The Mark,  Prev: Information from Markers,  Up: Markers
  493.  
  494. Changing Markers
  495. ================
  496.  
  497.    This section describes how to change the position of an existing
  498. marker.  When you do this, be sure you know whether the marker is used
  499. outside of your program, and, if so, what effects will result from
  500. moving it--otherwise, confusing things may happen in other parts of
  501. Emacs.
  502.  
  503.  - Function: set-marker MARKER POSITION &optional BUFFER
  504.      This function moves MARKER to POSITION in BUFFER.  If BUFFER is
  505.      not provided, it defaults to the current buffer.
  506.  
  507.      If POSITION is less than 1, `set-marker' moves marker to the
  508.      beginning of the buffer.  If the value of POSITION is greater than
  509.      the size of the buffer, `set-marker' moves marker to the end of
  510.      the buffer.  If POSITION is `nil' or a marker that points nowhere,
  511.      then MARKER is set to point nowhere.
  512.  
  513.      The value returned is MARKER.
  514.  
  515.           (setq m (point-marker))
  516.                => #<marker at 4714 in markers.texi>
  517.           (set-marker m 55)
  518.                => #<marker at 55 in markers.texi>
  519.           (setq b (get-buffer "foo"))
  520.                => #<buffer foo>
  521.           (set-marker m 0 b)
  522.                => #<marker at 1 in foo>
  523.  
  524.  - Function: move-marker MARKER POSITION &optional BUFFER
  525.      This is another name for `set-marker'.
  526.  
  527. 
  528. File: elisp,  Node: The Mark,  Next: The Region,  Prev: Changing Markers,  Up: Markers
  529.  
  530. The Mark
  531. ========
  532.  
  533.    A special marker in each buffer is designated "the mark".  It
  534. records a position for the user for the sake of commands such as `C-w'
  535. and `C-x TAB'.  Lisp programs should set the mark only to values that
  536. have a potential use to the user, and never for their own internal
  537. purposes.  For example, the `replace-regexp' command sets the mark to
  538. the value of point before doing any replacements, because this enables
  539. the user to move back there conveniently after the replace is finished.
  540.  
  541.    Many commands are designed so that when called interactively they
  542. operate on the text between point and the mark.  If you are writing such
  543. a command, don't examine the mark directly; instead, use `interactive'
  544. with the `r' specification.  This will provide the values of point and
  545. the mark as arguments to the command in an interactive call, but will
  546. permit other Lisp programs to specify arguments explicitly.  *Note
  547. Interactive Codes::.
  548.  
  549.    Each buffer has its own value of the mark that is independent of the
  550. value of the mark in other buffers.  When a buffer is created, the mark
  551. exists but does not point anywhere.  We consider this state as "the
  552. absence of a mark in that buffer".
  553.  
  554.    Once the mark "exists" in a buffer, it normally never ceases to
  555. exist.  However, it may become "inactive", if Transient Mark mode is
  556. enabled.  The variable `mark-active', which is always local in all
  557. buffers, indicates whether the mark is active: non-`nil' means yes.  A
  558. command can request deactivation of the mark upon return to the editor
  559. command loop by setting `deactivate-mark' to a non-`nil' value (but
  560. this deactivation only follows if Transient Mark mode is enabled).
  561.  
  562.    The main motivation for using Transient Mark mode is that this mode
  563. also enables highlighting of the region when the mark is active.  *Note
  564. Emacs Display::.
  565.  
  566.    In addition to the mark, each buffer has a "mark ring" which is a
  567. list of markers that are the previous values of the mark.  When editing
  568. commands change the mark, they should normally save the old value of the
  569. mark on the mark ring.  The mark ring may contain no more than the
  570. maximum number of entries specified by the variable `mark-ring-max';
  571. excess entries are discarded on a first-in-first-out basis.
  572.  
  573.  - Function: mark &optional FORCE
  574.      This function returns the position of the current buffer's mark as
  575.      an integer.
  576.  
  577.      Normally, if the mark is inactive `mark' signals an error.
  578.      However, if FORCE is non-`nil', then it returns the mark position
  579.      anyway--or `nil', if the mark is not yet set for this buffer.
  580.  
  581.  - Function: mark-marker
  582.      This function returns the current buffer's mark.  This is the very
  583.      marker which records the mark location inside Emacs, not a copy.
  584.      Therefore, changing this marker's position will directly affect
  585.      the position of the mark.  Don't do it unless that is the effect
  586.      you want.
  587.  
  588.           (setq m (mark-marker))
  589.                => #<marker at 3420 in markers.texi>
  590.           (set-marker m 100)
  591.                => #<marker at 100 in markers.texi>
  592.           (mark-marker)
  593.                => #<marker at 100 in markers.texi>
  594.  
  595.      Like any marker, this marker can be set to point at any buffer you
  596.      like.  We don't recommend that you make it point at any buffer
  597.      other than the one of which it is the mark.  If you do, it will
  598.      yield perfectly consistent, if rather odd, results.
  599.  
  600.  - Function: set-mark POSITION
  601.      This function sets the mark to POSITION, and activates the mark.
  602.      The old value of the mark is *not* pushed onto the mark ring.
  603.  
  604.      *Please note:* use this function only if you want the user to see
  605.      that the mark has moved, and you want the previous mark position to
  606.      be lost.  Normally, when a new mark is set, the old one should go
  607.      on the `mark-ring'.  For this reason, most applications should use
  608.      `push-mark' and `pop-mark', not `set-mark'.
  609.  
  610.      Novice Emacs Lisp programmers often try to use the mark for the
  611.      wrong purposes.  The mark saves a location for the user's
  612.      convenience.  An editing command should not alter the mark unless
  613.      altering the mark is part of the user-level functionality of the
  614.      command.  (And, in that case, this effect should be documented.)
  615.      To remember a location for internal use in the Lisp program, store
  616.      it in a Lisp variable.  For example:
  617.  
  618.           (let ((beg (point)))
  619.             (forward-line 1)
  620.             (delete-region beg (point))).
  621.  
  622.  - Variable: mark-ring
  623.      The value of this buffer-local variable is the list of saved former
  624.      marks of the current buffer, most recent first.
  625.  
  626.           mark-ring
  627.           => (#<marker at 11050 in markers.texi>
  628.               #<marker at 10832 in markers.texi>
  629.               ...)
  630.  
  631.  - User Option: mark-ring-max
  632.      The value of this variable is the maximum size of `mark-ring'.  If
  633.      more marks than this are pushed onto the `mark-ring', it discards
  634.      marks on a first-in, first-out basis.
  635.  
  636.  - Function: push-mark &optional POSITION NOMSG ACTIVATE
  637.      This function sets the current buffer's mark to POSITION, and
  638.      pushes a copy of the previous mark onto `mark-ring'.  If POSITION
  639.      is `nil', then the value of point is used.  `push-mark' returns
  640.      `nil'.
  641.  
  642.      The function `push-mark' normally *does not* activate the mark.
  643.      To do that, specify `t' for the argument ACTIVATE.
  644.  
  645.      A `Mark set' message is displayed unless NOMSG is non-`nil'.
  646.  
  647.  - Function: pop-mark
  648.      This function pops off the top element of `mark-ring' and makes
  649.      that mark become the buffer's actual mark.  This does not change
  650.      the buffer's point, and does nothing if `mark-ring' is empty.  It
  651.      deactivates the mark.
  652.  
  653.      The return value is not useful.
  654.  
  655.  - User Option: transient-mark-mode
  656.      This variable enables Transient Mark mode, in which every
  657.      buffer-modifying primitive sets `deactivate-mark'.  The consequence
  658.      of this is that commands that modify the buffer normally cause the
  659.      mark to become inactive.
  660.  
  661.  - Variable: deactivate-mark
  662.      If an editor command sets this variable non-`nil', then the editor
  663.      command loop deactivates the mark after the command returns.
  664.  
  665.  - Variable: mark-active
  666.      The mark is active when this variable is non-`nil'.  This variable
  667.      is always local in each buffer.
  668.  
  669.  - Variable: activate-mark-hook
  670.  - Variable: deactivate-mark-hook
  671.      These normal hooks are run, respectively, when the mark becomes
  672.      active and when it becomes inactive.  The hook
  673.      `activate-mark-hook' is also run at the end of a command if the
  674.      mark is active and the region may have changed.
  675.  
  676. 
  677. File: elisp,  Node: The Region,  Prev: The Mark,  Up: Markers
  678.  
  679. The Region
  680. ==========
  681.  
  682.    The text between point and the mark is known as "the region".
  683. Various functions operate on text delimited by point and the mark, but
  684. only those functions specifically related to the region itself are
  685. described here.
  686.  
  687.  - Function: region-beginning
  688.      This function returns the position of the beginning of the region
  689.      (as an integer).  This is the position of either point or the mark,
  690.      whichever is smaller.
  691.  
  692.      If the mark does not point anywhere, an error is signaled.
  693.  
  694.  - Function: region-end
  695.      This function returns the position of the end of the region (as an
  696.      integer).  This is the position of either point or the mark,
  697.      whichever is larger.
  698.  
  699.      If the mark does not point anywhere, an error is signaled.
  700.  
  701.    Few programs need to use the `region-beginning' and `region-end'
  702. functions.  A command designed to operate on a region should instead
  703. use `interactive' with the `r' specification, so that the same function
  704. can be called with explicit bounds arguments from programs.  (*Note
  705. Interactive Codes::.)
  706.  
  707. 
  708. File: elisp,  Node: Text,  Next: Searching and Matching,  Prev: Markers,  Up: Top
  709.  
  710. Text
  711. ****
  712.  
  713.    This chapter describes the functions that deal with the text in a
  714. buffer.  Most examine, insert or delete text in the current buffer,
  715. often in the vicinity of point.  Many are interactive.  All the
  716. functions that change the text provide for undoing the changes (*note
  717. Undo::.).
  718.  
  719.    Many text-related functions operate on a region of text defined by
  720. two buffer positions passed in arguments named START and END.  These
  721. arguments should be either markers (*note Markers::.) or or numeric
  722. character positions (*note Positions::.).  The order of these arguments
  723. does not matter; it is all right for START to be the end of the region
  724. and END the beginning.  For example, `(delete-region 1 10)' and
  725. `(delete-region 10 1)' perform identically.  An `args-out-of-range'
  726. error is signaled if either START or END is outside the accessible
  727. portion of the buffer.  In an interactive call, point and the mark are
  728. used for these arguments.
  729.  
  730.    Throughout this chapter, "text" refers to the characters in the
  731. buffer.
  732.  
  733. * Menu:
  734.  
  735. * Near Point::       Examining text in the vicinity of point.
  736. * Buffer Contents::  Examining text in a general fashion.
  737. * Comparing Text::   Comparing substrings of buffers.
  738. * Insertion::        Adding new text to a buffer.
  739. * Commands for Insertion::  User-level commands to insert text.
  740. * Deletion::         Removing text from a buffer.
  741. * User-Level Deletion::     User-level commands to delete text.
  742. * The Kill Ring::    Where removed text sometimes is saved for later use.
  743. * Undo::             Undoing changes to the text of a buffer.
  744. * Maintaining Undo:: How to enable and disable undo information.
  745.             How to control how much information is kept.
  746. * Auto Filling::     How auto-fill mode is implemented to break lines.
  747. * Filling::          Functions for explicit filling.
  748. * Sorting::          Functions for sorting parts of the buffer.
  749. * Indentation::      Functions to insert or adjust indentation.
  750. * Columns::          Computing horizontal positions, and using them.
  751. * Case Changes::     Case conversion of parts of the buffer.
  752. * Text Properties::  Assigning Lisp property lists to text characters.
  753. * Substitution::     Replacing a given character wherever it appears.
  754. * Underlining::      Inserting or deleting underlining-by-overstrike.
  755. * Registers::        How registers are implemented.  Accessing the text or
  756.                        position stored in a register.
  757. * Change Hooks::     Supplying functions to be run when text is changed.
  758.  
  759. 
  760. File: elisp,  Node: Near Point,  Next: Buffer Contents,  Up: Text
  761.  
  762. Examining Text Near Point
  763. =========================
  764.  
  765.    Many functions are provided to look at the characters around point.
  766. Several simple functions are described here.  See also `looking-at' in
  767. *Note Regexp Search::.
  768.  
  769.  - Function: char-after POSITION
  770.      This function returns the character in the current buffer at (i.e.,
  771.      immediately after) position POSITION.  If POSITION is out of range
  772.      for this purpose, either before the beginning of the buffer, or at
  773.      or beyond the end, then the value is `nil'.
  774.  
  775.      Remember that point is always between characters, and the terminal
  776.      cursor normally appears over the character following point.
  777.      Therefore, the character returned by `char-after' is the character
  778.      the cursor is over.
  779.  
  780.      In the following example, assume that the first character in the
  781.      buffer is `@':
  782.  
  783.           (char-to-string (char-after 1))
  784.                => "@"
  785.  
  786.  - Function: following-char
  787.      This function returns the character following point in the current
  788.      buffer.  This is similar to `(char-after (point))'.  However, if
  789.      point is at the end of the buffer, then the result of
  790.      `following-char' is 0.
  791.  
  792.      In this example, point is between the `a' and the `c'.
  793.  
  794.           ---------- Buffer: foo ----------
  795.           Gentlemen may cry ``Pea-!-ce! Peace!,''
  796.           but there is no peace.
  797.           ---------- Buffer: foo ----------
  798.           
  799.           (char-to-string (preceding-char))
  800.                => "a"
  801.           (char-to-string (following-char))
  802.                => "c"
  803.  
  804.  - Function: preceding-char
  805.      This function returns the character preceding point in the current
  806.      buffer.  See above, under `following-char', for an example.  If
  807.      point is at the beginning of the buffer, then the result of
  808.      `preceding-char' is 0.
  809.  
  810.  - Function: bobp
  811.      This function returns `t' if point is at the beginning of the
  812.      buffer.  If narrowing is in effect, this means the beginning of the
  813.      accessible portion of the text.  See also `point-min' in *Note
  814.      Point::.
  815.  
  816.  - Function: eobp
  817.      This function returns `t' if point is at the end of the buffer.
  818.      If narrowing is in effect, this means the end of accessible
  819.      portion of the text.  See also `point-max' in *Note Point::.
  820.  
  821.  - Function: bolp
  822.      This function returns `t' if point is at the beginning of a line.
  823.      *Note Text Lines::.
  824.  
  825.  - Function: eolp
  826.      This function returns `t' if point is at the end of a line.  The
  827.      end of the buffer is always considered the end of a line.
  828.  
  829. 
  830. File: elisp,  Node: Buffer Contents,  Next: Comparing Text,  Prev: Near Point,  Up: Text
  831.  
  832. Examining Buffer Contents
  833. =========================
  834.  
  835.    This section describes two functions that allow a Lisp program to
  836. convert any portion of the text in the buffer into a string.
  837.  
  838.  - Function: buffer-substring START END
  839.      This function returns a string containing a copy of the text of the
  840.      region defined by positions START and END in the current buffer.
  841.      If the arguments are not positions in the accessible portion of
  842.      the buffer, Emacs signals an `args-out-of-range' error.
  843.  
  844.      It is not necessary for START to be less than END; the arguments
  845.      can be given in either order.  But most often the smaller argument
  846.      is written first.
  847.  
  848.           ---------- Buffer: foo ----------
  849.           This is the contents of buffer foo
  850.           
  851.           ---------- Buffer: foo ----------
  852.           
  853.           (buffer-substring 1 10)
  854.           => "This is t"
  855.           (buffer-substring (point-max) 10)
  856.           => "he contents of buffer foo
  857.           "
  858.  
  859.  - Function: buffer-string
  860.      This function returns the contents of the accessible portion of the
  861.      current buffer as a string.  This is the portion between
  862.      `(point-min)' and `(point-max)' (*note Narrowing::.).
  863.  
  864.           ---------- Buffer: foo ----------
  865.           This is the contents of buffer foo
  866.           
  867.           ---------- Buffer: foo ----------
  868.           
  869.           (buffer-string)
  870.                => "This is the contents of buffer foo
  871.           "
  872.  
  873. 
  874. File: elisp,  Node: Comparing Text,  Next: Insertion,  Prev: Buffer Contents,  Up: Text
  875.  
  876. Comparing Text
  877. ==============
  878.  
  879.    This function lets you compare portions of the text in a buffer,
  880. without copying them into strings first.
  881.  
  882.  - Function: compare-buffer-substrings BUFFER1 START1 END1 BUFFER2
  883.           START2 END2
  884.      This function lets you compare two substrings of the same buffer
  885.      or two different buffers.  The first three arguments specify one
  886.      substring, giving a buffer and two positions within the buffer.
  887.      The last three arguments specify the other substring in the same
  888.      way.  You can use `nil' for BUFFER1, BUFFER2 or both to stand for
  889.      the current buffer.
  890.  
  891.      The value is negative if the first substring is less, positive if
  892.      the first is greater, and zero if they are equal.  The absolute
  893.      value of the result is one plus the index of the first differing
  894.      characters within the substrings.
  895.  
  896.      This function ignores case when comparing characters if
  897.      `case-fold-search' is non-`nil'.
  898.  
  899.      Suppose the current buffer contains the text `foobarbar
  900.      haha!rara!'; then in this example the two substrings are `rbar '
  901.      and `rara!'.  The value is 2 because the first substring is greater
  902.      at the second character.
  903.  
  904.           (compare-buffer-substring nil 6 11 nil 16 21)
  905.                => 2
  906.  
  907.      This function does not exist in Emacs version 18 and earlier.
  908.  
  909. 
  910. File: elisp,  Node: Insertion,  Next: Commands for Insertion,  Prev: Comparing Text,  Up: Text
  911.  
  912. Insertion
  913. =========
  914.  
  915.    Insertion takes place at point.  Markers pointing at positions after
  916. the insertion point are relocated with the surrounding text (*note
  917. Markers::.).  When a marker points at the place of insertion, it is
  918. normally not relocated, so that it points to the beginning of the
  919. inserted text; however, when `insert-before-markers' is used, all such
  920. markers are relocated to point after the inserted text.
  921.  
  922.    Point may end up either before or after inserted text, depending on
  923. the function used.  If point is left after the inserted text, we speak
  924. of insertion "before point".
  925.  
  926.    Each of these functions signals an error if the current buffer is
  927. read-only.
  928.  
  929.  - Function: insert &rest ARGS
  930.      This function inserts the strings and/or characters ARGS into the
  931.      current buffer, at point, moving point forward.  An error is
  932.      signaled unless all ARGS are either strings or characters.  The
  933.      value is `nil'.
  934.  
  935.  - Function: insert-before-markers &rest ARGS
  936.      This function inserts the strings and/or characters ARGS into the
  937.      current buffer, at point, moving point forward.  An error is
  938.      signaled unless all ARGS are either strings or characters.  The
  939.      value is `nil'.
  940.  
  941.      This function is unlike the other insertion functions in that a
  942.      marker whose position initially equals point is relocated to come
  943.      after the newly inserted text.
  944.  
  945.  - Function: insert-char CHARACTER COUNT
  946.      This function inserts COUNT instances of CHARACTER into the
  947.      current buffer before point.  COUNT must be a number, and
  948.      CHARACTER must be a character.  The value is `nil'.
  949.  
  950.  - Function: insert-buffer-substring FROM-BUFFER-OR-NAME &optional
  951.           START END
  952.      This function inserts a substring of the contents of buffer
  953.      FROM-BUFFER-OR-NAME (which must already exist) into the current
  954.      buffer before point.  The text inserted consists of the characters
  955.      in the region defined by START and END (These arguments default to
  956.      the beginning and end of the accessible portion of that buffer).
  957.      The function returns `nil'.
  958.  
  959.      In this example, the form is executed with buffer `bar' as the
  960.      current buffer.  We assume that buffer `bar' is initially empty.
  961.  
  962.           ---------- Buffer: foo ----------
  963.           We hold these truths to be self-evident, that all
  964.           ---------- Buffer: foo ----------
  965.           
  966.           (insert-buffer-substring "foo" 1 20)
  967.                => nil
  968.           
  969.           ---------- Buffer: bar ----------
  970.           We hold these truth
  971.           ---------- Buffer: bar ----------
  972.  
  973. 
  974. File: elisp,  Node: Commands for Insertion,  Next: Deletion,  Prev: Insertion,  Up: Text
  975.  
  976. User-Level Insertion Commands
  977. =============================
  978.  
  979.    This section describes higher-level commands for inserting text,
  980. commands intended primarily for the user but useful also in Lisp
  981. programs.
  982.  
  983.  - Command: insert-buffer FROM-BUFFER-OR-NAME
  984.      This function inserts the entire contents of FROM-BUFFER-OR-NAME
  985.      (which must exist) into the current buffer after point.  It leaves
  986.      the mark after the inserted text.  The value is `nil'.
  987.  
  988.  - Command: self-insert-command COUNT
  989.      This function inserts the last character typed COUNT times and
  990.      returns `nil'.  Most printing characters are bound to this
  991.      command.  In routine use, `self-insert-command' is the most
  992.      frequently called function in Emacs, but programs rarely use it
  993.      except to install it on a keymap.
  994.  
  995.      In an interactive call, COUNT is the numeric prefix argument.
  996.  
  997.      This function calls `auto-fill-function' if the current column
  998.      number is greater than the value of `fill-column' and the character
  999.      inserted is a space (*note Auto Filling::.).
  1000.  
  1001.      This function performs abbrev expansion if Abbrev mode is enabled
  1002.      and the inserted character does not have word-constituent syntax.
  1003.      (*Note Abbrevs::, and *Note Syntax Class Table::.)
  1004.  
  1005.      This function is also responsible for calling
  1006.      `blink-paren-function' when the inserted character has close
  1007.      parenthesis syntax (*note Blinking::.).
  1008.  
  1009.  - Command: newline &optional NUMBER-OF-NEWLINES
  1010.      This function inserts newlines into the current buffer before
  1011.      point.  If NUMBER-OF-NEWLINES is supplied, that many newline
  1012.      characters are inserted.
  1013.  
  1014.      In Auto Fill mode, `newline' can break the preceding line if
  1015.      NUMBER-OF-NEWLINES is not supplied.  When this happens, it
  1016.      actually inserts two newlines at different places: one at point,
  1017.      and another earlier in the line.  `newline' does not auto-fill if
  1018.      NUMBER-OF-NEWLINES is non-`nil'.
  1019.  
  1020.      The value returned is `nil'.  In an interactive call, COUNT is the
  1021.      numeric prefix argument.
  1022.  
  1023.  - Command: split-line
  1024.      This function splits the current line, moving the portion of the
  1025.      line after point down vertically, so that it is on the next line
  1026.      directly below where it was before.  Whitespace is inserted as
  1027.      needed at the beginning of the lower line, using the `indent-to'
  1028.      function.  `split-line' returns the position of point.
  1029.  
  1030.      Programs hardly ever use this function.
  1031.  
  1032.  - Variable: overwrite-mode
  1033.      This variable controls whether overwrite mode is in effect: a
  1034.      non-`nil' value enables the mode.  It is automatically made
  1035.      buffer-local when set in any fashion.
  1036.  
  1037. 
  1038. File: elisp,  Node: Deletion,  Next: User-Level Deletion,  Prev: Commands for Insertion,  Up: Text
  1039.  
  1040. Deletion of Text
  1041. ================
  1042.  
  1043.    All of the deletion functions operate on the current buffer, and all
  1044. return a value of `nil'.  In addition to these functions, you can also
  1045. delete text using the "kill" functions that save it in the kill ring;
  1046. some of these functions save text in the kill ring in some cases but
  1047. not in the usual case.  *Note The Kill Ring::.
  1048.  
  1049.  - Function: erase-buffer
  1050.      This function deletes the entire text of the current buffer,
  1051.      leaving it empty.  If the buffer is read-only, it signals a
  1052.      `buffer-read-only' error.  Otherwise, it deletes the text without
  1053.      asking for any confirmation.  The value is always `nil'.
  1054.  
  1055.      Normally, deleting a large amount of text from a buffer inhibits
  1056.      further auto-saving of that buffer "because it has shrunk".
  1057.      However, `erase-buffer' does not do this, the idea being that the
  1058.      future text is not really related to the former text, and its size
  1059.      should not be compared with that of the former text.
  1060.  
  1061.  - Command: delete-region START END
  1062.      This function deletes the text in the current buffer in the region
  1063.      defined by START and END.  The value is `nil'.
  1064.  
  1065.  - Command: delete-char COUNT &optional KILLP
  1066.      This function deletes COUNT characters directly after point, or
  1067.      before point if COUNT is negative.  If KILLP is non-`nil', then it
  1068.      saves the deleted characters in the kill ring.
  1069.  
  1070.      In an interactive call, COUNT is the numeric prefix argument, and
  1071.      KILLP is the unprocessed prefix argument.  Therefore, if a prefix
  1072.      argument is supplied, the text is saved in the kill ring.  If no
  1073.      prefix argument is supplied, then one character is deleted, but
  1074.      not saved in the kill ring.
  1075.  
  1076.      The value returned is always `nil'.
  1077.  
  1078.  - Command: delete-backward-char COUNT &optional KILLP
  1079.      This function deletes COUNT characters directly before point, or
  1080.      after point if COUNT is negative.  If KILLP is non-`nil', then it
  1081.      saves the deleted characters in the kill ring.
  1082.  
  1083.      In an interactive call, COUNT is the numeric prefix argument, and
  1084.      KILLP is the unprocessed prefix argument.  Therefore, if a prefix
  1085.      argument is supplied, the text is saved in the kill ring.  If no
  1086.      prefix argument is supplied, then one character is deleted, but
  1087.      not saved in the kill ring.
  1088.  
  1089.      The value returned is always `nil'.
  1090.  
  1091.  - Command: backward-delete-char-untabify COUNT &optional KILLP
  1092.      This function deletes COUNT characters backward, changing tabs
  1093.      into spaces.  When the next character to be deleted is a tab, it is
  1094.      first replaced with the proper number of spaces to preserve
  1095.      alignment and then one of those spaces is deleted instead of the
  1096.      tab.  If KILLP is non-`nil', then the command saves the deleted
  1097.      characters in the kill ring.
  1098.  
  1099.      If COUNT is negative, then tabs are not changed to spaces, and the
  1100.      characters are deleted by calling `delete-backward-char' with
  1101.      COUNT.
  1102.  
  1103.      In an interactive call, COUNT is the numeric prefix argument, and
  1104.      KILLP is the unprocessed prefix argument.  Therefore, if a prefix
  1105.      argument is supplied, the text is saved in the kill ring.  If no
  1106.      prefix argument is supplied, then one character is deleted, but
  1107.      not saved in the kill ring.
  1108.  
  1109.      The value returned is always `nil'.
  1110.  
  1111. 
  1112. File: elisp,  Node: User-Level Deletion,  Next: The Kill Ring,  Prev: Deletion,  Up: Text
  1113.  
  1114. User-Level Deletion Commands
  1115. ============================
  1116.  
  1117.    This section describes higher-level commands for deleting text,
  1118. commands intended primarily for the user but useful also in Lisp
  1119. programs.
  1120.  
  1121.  - Command: delete-horizontal-space
  1122.      This function deletes all spaces and tabs around point.  It returns
  1123.      `nil'.
  1124.  
  1125.      In the following examples, assume that `delete-horizontal-space' is
  1126.      called four times, once on each line, with point between the
  1127.      second and third characters on the line.
  1128.  
  1129.           ---------- Buffer: foo ----------
  1130.           I -!-thought
  1131.           I -!-     thought
  1132.           We-!- thought
  1133.           Yo-!-u thought
  1134.           ---------- Buffer: foo ----------
  1135.           
  1136.           (delete-horizontal-space)   ; Four times.
  1137.                => nil
  1138.           
  1139.           ---------- Buffer: foo ----------
  1140.           Ithought
  1141.           Ithought
  1142.           Wethought
  1143.           You thought
  1144.           ---------- Buffer: foo ----------
  1145.  
  1146.  - Command: delete-indentation &optional JOIN-FOLLOWING-P
  1147.      This function joins the line point is on to the previous line,
  1148.      deleting any whitespace at the join and in some cases replacing it
  1149.      with one space.  If JOIN-FOLLOWING-P is non-`nil',
  1150.      `delete-indentation' joins this line to the following line
  1151.      instead.  The value is `nil'.
  1152.  
  1153.      If there is a fill prefix, and the second of the lines being joined
  1154.      starts with the prefix, then `delete-indentation' deletes the fill
  1155.      prefix before joining the lines.
  1156.  
  1157.      In the example below, point is located on the line starting
  1158.      `events', and it makes no difference if there are trailing spaces
  1159.      in the preceding line.
  1160.  
  1161.           ---------- Buffer: foo ----------
  1162.           When in the course of human
  1163.           -!-    events, it becomes necessary
  1164.           ---------- Buffer: foo ----------
  1165.           
  1166.           (delete-indentation)
  1167.                => nil
  1168.           
  1169.           ---------- Buffer: foo ----------
  1170.           When in the course of human-!- events, it becomes necessary
  1171.           ---------- Buffer: foo ----------
  1172.  
  1173.      After the lines are joined, the function `fixup-whitespace' is
  1174.      responsible for deciding whether to leave a space at the junction.
  1175.  
  1176.  - Function: fixup-whitespace
  1177.      This function replaces white space between the objects on either
  1178.      side of point with either one space or no space as appropriate.
  1179.      It returns `nil'.
  1180.  
  1181.      The appropriate amount of space is none at the beginning or end of
  1182.      the line.  Otherwise, it is one space except when point is before a
  1183.      character with close parenthesis syntax or after a character with
  1184.      open parenthesis or expression-prefix syntax.  *Note Syntax Class
  1185.      Table::.
  1186.  
  1187.      In the example below, when `fixup-whitespace' is called the first
  1188.      time, point is before the word `spaces' in the first line.  It is
  1189.      located directly after the `(' for the second invocation.
  1190.  
  1191.           ---------- Buffer: foo ----------
  1192.           This has too many     -!-spaces
  1193.           This has too many spaces at the start of (-!-   this list)
  1194.           ---------- Buffer: foo ----------
  1195.  
  1196.           (fixup-whitespace)
  1197.                => nil
  1198.           (fixup-whitespace)
  1199.                => nil
  1200.  
  1201.           ---------- Buffer: foo ----------
  1202.           This has too many spaces
  1203.           This has too many spaces at the start of (this list)
  1204.           ---------- Buffer: foo ----------
  1205.  
  1206.  - Command: just-one-space
  1207.      This command replaces any spaces and tabs around point with a
  1208.      single space.  It returns `nil'.
  1209.  
  1210.  - Command: delete-blank-lines
  1211.      This function deletes blank lines surrounding point.  If point is
  1212.      on a blank line with one or more blank lines before or after it,
  1213.      then all but one of them are deleted.  If point is on an isolated
  1214.      blank line, then it is deleted.  If point is on a nonblank line,
  1215.      the command deletes all blank lines following it.
  1216.  
  1217.      A blank line is defined as a line containing only tabs and spaces.
  1218.  
  1219.      `delete-blank-lines' returns `nil'.
  1220.  
  1221.