home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / elisp / elisp-19 < prev    next >
Encoding:
GNU Info File  |  1993-05-31  |  48.9 KB  |  1,158 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: Auto-Saving,  Next: Reverting,  Prev: Backup Files,  Up: Backups and Auto-Saving
  28.  
  29. Auto-Saving
  30. ===========
  31.  
  32.    Emacs periodically saves all files that you are visiting; this is
  33. called "auto-saving".  Auto-saving prevents you from losing more than a
  34. limited amount of work if the system crashes.  By default, auto-saves
  35. happen every 300 keystrokes, or after around 30 seconds of idle time.
  36. *Note Auto-Save: (emacs)Auto-Save, for information on auto-save for
  37. users.  Here we describe the functions used to implement auto-saving
  38. and the variables that control them.
  39.  
  40.  - Variable: buffer-auto-save-file-name
  41.      This buffer-local variable is the name of the file used for
  42.      auto-saving the current buffer.  It is `nil' if the buffer should
  43.      not be auto-saved.
  44.  
  45.           buffer-auto-save-file-name
  46.           => "/xcssun/users/rms/lewis/#files.texi#"
  47.  
  48.  - Command: auto-save-mode ARG
  49.      When used interactively without an argument, this command is a
  50.      toggle switch: it turns on auto-saving of the current buffer if it
  51.      is off, and vice-versa.  With an argument ARG, the command turns
  52.      auto-saving on if the value of ARG is `t', a nonempty list, or a
  53.      positive integer.  Otherwise, it turns auto-saving off.
  54.  
  55.  - Function: auto-save-file-name-p FILENAME
  56.      This function returns a non-`nil' value if FILENAME is a string
  57.      that could be the name of an auto-save file.  It works based on
  58.      knowledge of the naming convention for auto-save files: a name that
  59.      begins and ends with hash marks (`#') is a possible auto-save file
  60.      name.  The argument FILENAME should not contain a directory part.
  61.  
  62.           (make-auto-save-file-name)
  63.                => "/xcssun/users/rms/lewis/#files.texi#"
  64.           (auto-save-file-name-p "#files.texi#")
  65.                => 0
  66.           (auto-save-file-name-p "files.texi")
  67.                => nil
  68.  
  69.      The standard definition of this function is as follows:
  70.  
  71.           (defun auto-save-file-name-p (filename)
  72.             "Return non-nil if FILENAME can be yielded by..."
  73.             (string-match "^#.*#$" filename))
  74.  
  75.      This function exists so that you can customize it if you wish to
  76.      change the naming convention for auto-save files.  If you redefine
  77.      it, be sure to redefine the function `make-auto-save-file-name'
  78.      correspondingly.
  79.  
  80.  - Function: make-auto-save-file-name
  81.      This function returns the file name to use for auto-saving the
  82.      current buffer.  This is just the file name with hash marks (`#')
  83.      appended and prepended to it.  This function does not look at the
  84.      variable `auto-save-visited-file-name'; that should be checked
  85.      before this function is called.
  86.  
  87.           (make-auto-save-file-name)
  88.                => "/xcssun/users/rms/lewis/#backup.texi#"
  89.  
  90.      The standard definition of this function is as follows:
  91.  
  92.           (defun make-auto-save-file-name ()
  93.             "Return file name to use for auto-saves \
  94.           of current buffer..."
  95.             (if buffer-file-name
  96.                 (concat
  97.                  (file-name-directory buffer-file-name)
  98.                  "#"
  99.                  (file-name-nondirectory buffer-file-name)
  100.                  "#")
  101.               (expand-file-name
  102.                (concat "#%" (buffer-name) "#"))))
  103.  
  104.      This exists as a separate function so that you can redefine it to
  105.      customize the naming convention for auto-save files.  Be sure to
  106.      change `auto-save-file-name-p' in a corresponding way.
  107.  
  108.  - Variable: auto-save-visited-file-name
  109.      If this variable is non-`nil', Emacs auto-saves buffers in the
  110.      files they are visiting.  That is, the auto-save is done in the
  111.      same file which you are editing.  Normally, this variable is
  112.      `nil', so auto-save files have distinct names that are created by
  113.      `make-auto-save-file-name'.
  114.  
  115.      When you change the value of this variable, the value does not take
  116.      effect until the next time auto-save mode is reenabled in any given
  117.      buffer.  If auto-save mode is already enabled, auto-saves continue
  118.      to go in the same file name until `auto-save-mode' is called again.
  119.  
  120.  - Function: recent-auto-save-p
  121.      This function returns `t' if the current buffer has been
  122.      auto-saved since the last time it was read in or saved.
  123.  
  124.  - Function: set-buffer-auto-saved
  125.      This function marks the current buffer as auto-saved.  The buffer
  126.      will not be auto-saved again until the buffer text is changed
  127.      again.  The function returns `nil'.
  128.  
  129.  - User Option: auto-save-interval
  130.      The value of this variable is the number of characters that Emacs
  131.      reads from the keyboard between auto-saves.  Each time this many
  132.      more characters are read, auto-saving is done for all buffers in
  133.      which it is enabled.
  134.  
  135.  - User Option: auto-save-timeout
  136.      The value of this variable is the number of seconds of idle time
  137.      that should cause auto-saving.  Each time the user pauses for this
  138.      long, Emacs auto-saves any buffers that need it.  (Actually, the
  139.      specified timeout is multiplied by a factor depending on the size
  140.      of the current buffer.)
  141.  
  142.  - Variable: auto-save-hook
  143.      This normal hook is run whenever an auto-save is about to happen.
  144.  
  145.  - User Option: auto-save-default
  146.      If this variable is non-`nil', buffers that are visiting files
  147.      have auto-saving enabled by default.  Otherwise, they do not.
  148.  
  149.  - Command: do-auto-save &optional NO-MESSAGE
  150.      This function auto-saves all buffers that need to be auto-saved.
  151.      This is all buffers for which auto-saving is enabled and that have
  152.      been changed since the last time they were auto-saved.
  153.  
  154.      Normally, if any buffers are auto-saved, a message
  155.      `Auto-saving...' is displayed in the echo area while auto-saving is
  156.      going on.  However, if NO-MESSAGE is non-`nil', the message is
  157.      inhibited.
  158.  
  159.  - Function: delete-auto-save-file-if-necessary
  160.      This function deletes the current buffer's auto-save file if
  161.      `delete-auto-save-files' is non-`nil'.  It is called every time a
  162.      buffer is saved.
  163.  
  164.  - Variable: delete-auto-save-files
  165.      This variable is used by the function
  166.      `delete-auto-save-file-if-necessary'.  If it is non-`nil', Emacs
  167.      deletes auto-save files when a true save is done (in the visited
  168.      file).  This saves on disk space and unclutters your directory.
  169.  
  170.  - Function: rename-auto-save-file
  171.      This function adjusts the current buffer's auto-save file name if
  172.      the visited file name has changed.  It also renames an existing
  173.      auto-save file.  If the visited file name has not changed, this
  174.      function does nothing.
  175.  
  176. 
  177. File: elisp,  Node: Reverting,  Prev: Auto-Saving,  Up: Backups and Auto-Saving
  178.  
  179. Reverting
  180. =========
  181.  
  182.    If you have made extensive changes to a file and then change your
  183. mind about them, you can get rid of them by reading in the previous
  184. version of the file with the `revert-buffer' command.  *Note Reverting
  185. a Buffer: (emacs)Reverting.
  186.  
  187.  - Command: revert-buffer &optional CHECK-AUTO-SAVE NOCONFIRM
  188.      This command replaces the buffer text with the text of the visited
  189.      file on disk.  This action undoes all changes since the file was
  190.      visited or saved.
  191.  
  192.      If the argument CHECK-AUTO-SAVE is non-`nil', and the latest
  193.      auto-save file is more recent than the visited file,
  194.      `revert-buffer' asks the user whether to use that instead.
  195.      Otherwise, it always uses the text of the visited file itself.
  196.      Interactively, CHECK-AUTO-SAVE is set if there is a numeric prefix
  197.      argument.
  198.  
  199.      When the value of the NOCONFIRM argument is non-`nil',
  200.      `revert-buffer' does not ask for confirmation for the reversion
  201.      action.  This means that the buffer contents are deleted and
  202.      replaced by the text from the file on the disk, with no further
  203.      opportunities for the user to prevent it.
  204.  
  205.      Since reverting works by deleting the entire text of the buffer and
  206.      inserting the file contents, all the buffer's markers are
  207.      relocated to point at the beginning of the buffer.  This is not
  208.      "correct", but then, there is no way to determine what would be
  209.      correct.  It is not possible to determine, from the text before
  210.      and after, which characters after reversion correspond to which
  211.      characters before.
  212.  
  213.      If the value of the `revert-buffer-function' variable is
  214.      non-`nil', it is called as a function with no arguments to do the
  215.      work.
  216.  
  217.  - Variable: revert-buffer-function
  218.      The value of this variable is the function to use to revert this
  219.      buffer; but if the value of this variable is `nil', then the
  220.      `revert-buffer' function carries out its default action.  Modes
  221.      such as Dired mode, in which the text being edited does not
  222.      consist of a file's contents but can be regenerated in some other
  223.      fashion, give this variable a buffer-local value that is a
  224.      function to regenerate the contents.
  225.  
  226.  - Variable: revert-buffer-insert-file-contents-function
  227.      The value of this variable, if non-`nil', is the function to use
  228.      to insert contents when reverting this buffer.  The function
  229.      receives two arguments, first the file name to use, and second,
  230.      `t' if the user has asked to read the auto-save file.
  231.  
  232.  - Command: recover-file FILENAME
  233.      This function visits FILENAME, but gets the contents from its last
  234.      auto-save file.  This is useful after the system has crashed, to
  235.      resume editing the same file without losing all the work done in
  236.      the previous session.
  237.  
  238.      An error is signaled if there is no auto-save file for FILENAME,
  239.      or if FILENAME is newer than its auto-save file.  If FILENAME does
  240.      not exist, but its auto-save file does, then the auto-save file is
  241.      read as usual.  This last situation may occur if you visited a
  242.      nonexistent file and never actually saved it.
  243.  
  244. 
  245. File: elisp,  Node: Buffers,  Next: Windows,  Prev: Backups and Auto-Saving,  Up: Top
  246.  
  247. Buffers
  248. *******
  249.  
  250.    A "buffer" is a Lisp object containing text to be edited.  Buffers
  251. are used to hold the contents of files that are being visited; there may
  252. also be buffers which are not visiting files.  While several buffers may
  253. exist at one time, exactly one buffer is designated the "current
  254. buffer" at any time.  Most editing commands act on the contents of the
  255. current buffer.  Each buffer, including the current buffer, may or may
  256. not be displayed in any windows.
  257.  
  258. * Menu:
  259.  
  260. * Buffer Basics::       What is a buffer?
  261. * Buffer Names::        Accessing and changing buffer names.
  262. * Buffer File Name::    The buffer file name indicates which file is visited.
  263. * Buffer Modification:: A buffer is "modified" if it needs to be saved.
  264. * Modification Time::   Determining whether the visited file was changed
  265.                          "behind Emacs's back".
  266. * Read Only Buffers::   Modifying text is not allowed in a read-only buffer.
  267. * The Buffer List::     How to look at all the existing buffers.
  268. * Creating Buffers::    Functions that create buffers.
  269. * Killing Buffers::     Buffers exist until explicitly killed.
  270. * Current Buffer::      Designating a buffer as current
  271.                           so primitives will access its contents.
  272.  
  273. 
  274. File: elisp,  Node: Buffer Basics,  Next: Buffer Names,  Prev: Buffers,  Up: Buffers
  275.  
  276. Buffer Basics
  277. =============
  278.  
  279.    A "buffer" is a Lisp object containing text to be edited.  Buffers
  280. are used to hold the contents of files that are being visited; there may
  281. also be buffers which are not visiting files.  While several buffers may
  282. exist at one time, exactly one buffer is designated the "current
  283. buffer" at any time.  Most editing commands act on the contents of the
  284. current buffer.  Each buffer, including the current buffer, may or may
  285. not be displayed in any windows.
  286.  
  287.    Buffers in Emacs editing are objects which have distinct names and
  288. hold text that can be edited.  Buffers appear to Lisp programs as a
  289. special data type.  The contents of a buffer may be viewed as an
  290. extendable string; insertions and deletions may occur in any part of the
  291. buffer.  *Note Text::.
  292.  
  293.    A Lisp buffer object contains numerous pieces of information.  Some
  294. of this information is directly accessible to the programmer through
  295. variables, while other information is only accessible through
  296. special-purpose functions.  For example, the width of a tab character is
  297. directly accessible through a variable, while the value of point is
  298. accessible only through a primitive function.
  299.  
  300.    Buffer-specific information that is directly accessible is stored in
  301. "buffer-local" variable bindings, which are variable values that are
  302. effective only in a particular buffer.  This feature allows each buffer
  303. to override the values of certain variables.  Most major modes override
  304. variables such as `fill-column' or `comment-column' in this way.  For
  305. more information about buffer-local variables and functions related to
  306. them, see *Note Buffer-Local Variables::.
  307.  
  308.    For functions and variables related to visiting files in buffers, see
  309. *Note Visiting Files:: and *Note Saving Buffers::.  For functions and
  310. variables related to the display of buffers in windows, see *Note
  311. Buffers and Windows::.
  312.  
  313.  - Function: bufferp OBJECT
  314.      This function returns `t' if OBJECT is a buffer, `nil' otherwise.
  315.  
  316. 
  317. File: elisp,  Node: Buffer Names,  Next: Buffer File Name,  Prev: Buffer Basics,  Up: Buffers
  318.  
  319. Buffer Names
  320. ============
  321.  
  322.    Each buffer has a unique name, which is a string.  Many of the
  323. functions that work on buffers accept either a buffer or a buffer name
  324. as an argument.  Any argument called BUFFER-OR-NAME is of this sort,
  325. and an error is signaled if it is neither a string nor a buffer.  Any
  326. argument called BUFFER is required to be an actual buffer object, not a
  327. name.
  328.  
  329.    Buffers that are ephemeral and generally uninteresting to the user
  330. have names starting with a space, which prevents them from being listed
  331. by the `list-buffers' or `buffer-menu' commands.  (A name starting with
  332. space also initially disables recording undo information; see *Note
  333. Undo::.)
  334.  
  335.  - Function: buffer-name &optional BUFFER
  336.      This function returns the name of BUFFER as a string.  If BUFFER
  337.      is not supplied, it defaults to the current buffer.
  338.  
  339.      If `buffer-name' returns `nil', it means that BUFFER has been
  340.      killed.  *Note Killing Buffers::.
  341.  
  342.           (buffer-name)
  343.                => "buffers.texi"
  344.           
  345.           (setq foo (get-buffer "temp"))
  346.                => #<buffer temp>
  347.           (kill-buffer foo)
  348.                => nil
  349.           (buffer-name foo)
  350.                => nil
  351.           foo
  352.                => #<killed buffer>
  353.  
  354.  - Command: rename-buffer NEWNAME &optional UNIQUE
  355.      This function renames the current buffer to NEWNAME.  An error is
  356.      signaled if NEWNAME is not a string, or if there is already a
  357.      buffer with that name.  The function returns `nil'.
  358.  
  359.      Ordinarily, `rename-buffer' signals an error if NEWNAME is already
  360.      in use.  However, if UNIQUE is non-`nil', it modifies NEWNAME to
  361.      make a name that is not in use.  Interactively, you can make
  362.      UNIQUE non-`nil' with a numeric prefix argument.
  363.  
  364.      One application of this command is to rename the `*shell*' buffer
  365.      to some other name, thus making it possible to create a second
  366.      shell buffer under the name `*shell*'.
  367.  
  368.  - Function: get-buffer BUFFER-OR-NAME
  369.      This function returns the buffer specified by BUFFER-OR-NAME.  If
  370.      BUFFER-OR-NAME is a string and there is no buffer with that name,
  371.      the value is `nil'.  If BUFFER-OR-NAME is a buffer, it is returned
  372.      as given.  (That is not very useful, so the argument is usually a
  373.      name.)  For example:
  374.  
  375.           (setq b (get-buffer "lewis"))
  376.                => #<buffer lewis>
  377.           (get-buffer b)
  378.                => #<buffer lewis>
  379.           (get-buffer "Frazzle-nots")
  380.                => nil
  381.  
  382.      See also the function `get-buffer-create' in *Note Creating
  383.      Buffers::.
  384.  
  385.  - Function: generate-new-buffer-name STARTING-NAME
  386.      This function returns a name that would be unique for a new
  387.      buffer--but does not create the buffer.  It starts with
  388.      STARTING-NAME, and produces a name not currently in use for any
  389.      buffer by appending a number inside of `<...>'.
  390.  
  391.      See the related function `generate-new-buffer' in *Note Creating
  392.      Buffers::.
  393.  
  394. 
  395. File: elisp,  Node: Buffer File Name,  Next: Buffer Modification,  Prev: Buffer Names,  Up: Buffers
  396.  
  397. Buffer File Name
  398. ================
  399.  
  400.    The "buffer file name" is the name of the file that is visited in
  401. that buffer.  When a buffer is not visiting a file, its buffer file name
  402. is `nil'.  Most of the time, the buffer name is the same as the
  403. nondirectory part of the buffer file name, but the buffer file name and
  404. the buffer name are distinct and can be set independently.  *Note
  405. Visiting Files::.
  406.  
  407.  - Function: buffer-file-name &optional BUFFER
  408.      This function returns the absolute file name of the file that
  409.      BUFFER is visiting.  If BUFFER is not visiting any file,
  410.      `buffer-file-name' returns `nil'.  If BUFFER is not supplied, it
  411.      defaults to the current buffer.
  412.  
  413.           (buffer-file-name (other-buffer))
  414.                => "/usr/user/lewis/manual/files.texi"
  415.  
  416.  - Variable: buffer-file-name
  417.      This buffer-local variable contains the name of the file being
  418.      visited in the current buffer, or `nil' if it is not visiting a
  419.      file.  It is a permanent local, unaffected by
  420.      `kill-local-variables'.
  421.  
  422.           buffer-file-name
  423.                => "/usr/user/lewis/manual/buffers.texi"
  424.  
  425.      It is risky to change this variable's value without doing various
  426.      other things.  See the definition of `set-visited-file-name' in
  427.      `files.el'; some of the things done there, such as changing the
  428.      buffer name, are not strictly necessary, but others are essential
  429.      to avoid confusing Emacs.
  430.  
  431.  - Variable: buffer-file-truename
  432.      This buffer-local variable holds the truename of the file visited
  433.      in the current buffer, or `nil' if no file is visited.  It is a
  434.      permanent local, unaffected by `kill-local-variables'.  *Note
  435.      Truenames::.
  436.  
  437.  - Variable: buffer-file-number
  438.      This buffer-local variable holds the file number and directory
  439.      device number of the file visited in the current buffer, or `nil'
  440.      if no file or a nonexistent file is visited.  It is a permanent
  441.      local, unaffected by `kill-local-variables'.  *Note Truenames::.
  442.  
  443.      The value is normally a list of the form `(FILENUM DEVNUM)'.  This
  444.      pair of numbers uniquely identifies the file among all files
  445.      accessible on the system.  See the function `file-attributes', in
  446.      *Note File Attributes::, for more information about them.
  447.  
  448.  - Function: get-file-buffer FILENAME
  449.      This function returns the buffer visiting file FILENAME.  If there
  450.      is no such buffer, it returns `nil'.  The argument FILENAME, which
  451.      must be a string, is expanded (*note File Name Expansion::.), then
  452.      compared against the visited file names of all live buffers.
  453.  
  454.           (get-file-buffer "buffers.texi")
  455.               => #<buffer buffers.texi>
  456.  
  457.      In unusual circumstances, there can be more than one buffer
  458.      visiting the same file name.  In such cases, this function returns
  459.      the first such buffer in the buffer list.
  460.  
  461.  - Command: set-visited-file-name FILENAME
  462.      If FILENAME is a non-empty string, this function changes the name
  463.      of the file visited in current buffer to FILENAME.  (If the buffer
  464.      had no visited file, this gives it one.)  The *next time* the
  465.      buffer is saved it will go in the newly-specified file.  This
  466.      command marks the buffer as modified, since it does not (as far as
  467.      Emacs knows) match the contents of FILENAME, even if it matched the
  468.      former visited file.
  469.  
  470.      If FILENAME is `nil' or the empty string, that stands for "no
  471.      visited file".  In this case, `set-visited-file-name' marks the
  472.      buffer as having no visited file.
  473.  
  474.      When the function `set-visited-file-name' is called interactively,
  475.      it prompts for FILENAME in the minibuffer.
  476.  
  477.      See also `clear-visited-file-modtime' and
  478.      `verify-visited-file-modtime' in *Note Buffer Modification::.
  479.  
  480.  - Variable: list-buffers-directory
  481.      This buffer-local variable records a string to display in a buffer
  482.      listing in place of the visited file name, for buffers that don't
  483.      have a visited file name.  Dired buffers use this variable.
  484.  
  485. 
  486. File: elisp,  Node: Buffer Modification,  Next: Modification Time,  Prev: Buffer File Name,  Up: Buffers
  487.  
  488. Buffer Modification
  489. ===================
  490.  
  491.    Emacs keeps a flag called the "modified flag" for each buffer, to
  492. record whether you have changed the text of the buffer.  This flag is
  493. set to `t' whenever you alter the contents of the buffer, and cleared
  494. to `nil' when you save it.  Thus, the flag shows whether there are
  495. unsaved changes.  The flag value is normally shown in the mode line
  496. (*note Mode Line Variables::.), and controls saving (*note Saving
  497. Buffers::.) and auto-saving (*note Auto-Saving::.).
  498.  
  499.    Some Lisp programs set the flag explicitly.  For example, the
  500. function `set-visited-file-name' sets the flag to `t', because the text
  501. does not match the newly-visited file, even if it is unchanged from the
  502. file formerly visited.
  503.  
  504.    The functions that modify the contents of buffers are described in
  505. *Note Text::.
  506.  
  507.  - Function: buffer-modified-p &optional BUFFER
  508.      This function returns `t' if the buffer BUFFER has been modified
  509.      since it was last read in from a file or saved, or `nil'
  510.      otherwise.  If BUFFER is not supplied, the current buffer is
  511.      tested.
  512.  
  513.  - Function: set-buffer-modified-p FLAG
  514.      This function marks the current buffer as modified if FLAG is
  515.      non-`nil', or as unmodified if the flag is `nil'.
  516.  
  517.      Another effect of calling this function is to cause unconditional
  518.      redisplay of the mode line for the current buffer.  In fact, the
  519.      function `force-mode-line-update' works by doing this:
  520.  
  521.           (set-buffer-modified-p (buffer-modified-p))
  522.  
  523.  - Command: not-modified
  524.      This command marks the current buffer as unmodified, and not
  525.      needing to be saved.  Don't use this function in programs, since
  526.      it prints a message in the echo area; use `set-buffer-modified-p'
  527.      (above) instead.
  528.  
  529.  - Function: buffer-modified-tick &optional BUFFER
  530.      This function returns BUFFER`s modification-count.  This is a
  531.      counter that increments every time the buffer is modified.  If
  532.      BUFFER is `nil' (or omitted), the current buffer is used.
  533.  
  534. 
  535. File: elisp,  Node: Modification Time,  Next: Read Only Buffers,  Prev: Buffer Modification,  Up: Buffers
  536.  
  537. Comparison of Modification Time
  538. ===============================
  539.  
  540.    Suppose that you visit a file and make changes in its buffer, and
  541. meanwhile the file itself is changed on disk.  At this point, saving the
  542. buffer would overwrite the changes in the file.  Occasionally this may
  543. be what you want, but usually it would lose valuable information.  Emacs
  544. therefore checks the file's modification time using the functions
  545. described below before saving the file.
  546.  
  547.  - Function: verify-visited-file-modtime BUFFER
  548.      This function compares Emacs's record of the modification time for
  549.      the file that the buffer is visiting against the actual
  550.      modification time of the file as recorded by the operating system.
  551.      The two should be the same unless some other process has written
  552.      the file since Emacs visited or saved it.
  553.  
  554.      The function returns `t' if the last actual modification time and
  555.      Emacs's recorded modification time are the same, `nil' otherwise.
  556.  
  557.  - Function: clear-visited-file-modtime
  558.      This function clears out the record of the last modification time
  559.      of the file being visited by the current buffer.  As a result, the
  560.      next attempt to save this buffer will not complain of a
  561.      discrepancy in file modification times.
  562.  
  563.      This function is called in `set-visited-file-name' and other
  564.      exceptional places where the usual test to avoid overwriting a
  565.      changed file should not be done.
  566.  
  567.  - Function: set-visited-file-modtime &optional TIME
  568.      This function updates the buffer's record of the last modification
  569.      time of the visited file, to the value specified by TIME if TIME
  570.      is not `nil', and otherwise to the last modification time of the
  571.      visited file.
  572.  
  573.      If TIME is not `nil', it should have the form `(HIGH . LOW)' or
  574.      `(HIGH LOW)', in either case containing two integers, each of
  575.      which holds 16 bits of the time.  (This is the same format that
  576.      `file-attributes' uses to return time values; see *Note File
  577.      Attributes::.)
  578.  
  579.      This function is useful if the buffer was not read from the file
  580.      normally, or if the file itself has been changed for some known
  581.      benign reason.
  582.  
  583.  - Function: visited-file-modtime
  584.      This function returns the buffer's recorded last file modification
  585.      time, as a list of the form `(HIGH . LOW)'.  Note that this is not
  586.      identical to the last modification time of the file that is
  587.      visited (though under normal circumstances the values are equal).
  588.  
  589.  - Function: ask-user-about-supersession-threat FN
  590.      This function is used to ask a user how to proceed after an
  591.      attempt to modify an obsolete buffer.  An "obsolete buffer" is an
  592.      unmodified buffer for which the associated file on disk is newer
  593.      than the last save-time of the buffer.  This means some other
  594.      program has probably altered the file.
  595.  
  596.      This function is called automatically by Emacs on the proper
  597.      occasions.  It exists so you can customize Emacs by redefining it.
  598.      See the file `userlock.el' for the standard definition.
  599.  
  600.      Depending on the user's answer, the function may return normally,
  601.      in which case the modification of the buffer proceeds, or it may
  602.      signal a `file-supersession' error with data `(FN)', in which case
  603.      the proposed buffer modification is not allowed.
  604.  
  605.      See also the file locking mechanism in *Note File Locks::.
  606.  
  607. 
  608. File: elisp,  Node: Read Only Buffers,  Next: The Buffer List,  Prev: Modification Time,  Up: Buffers
  609.  
  610. Read-Only Buffers
  611. =================
  612.  
  613.    A buffer may be designated as "read-only".  This means that the
  614. buffer's contents may not be modified, although you may change your view
  615. of the contents by scrolling, narrowing, or widening, etc.
  616.  
  617.    Read-only buffers are used in two kinds of situations:
  618.  
  619.    * A buffer visiting a file is made read-only if the file is
  620.      write-protected.
  621.  
  622.      Here, the purpose is to show the user that editing the buffer with
  623.      the aim of saving it in the file may be futile or undesirable.
  624.      The user who wants to change the buffer text despite this can do
  625.      so after clearing the read-only flag with the function
  626.      `toggle-read-only'.
  627.  
  628.    * Modes such as Dired and Rmail make buffers read-only when altering
  629.      the contents with the usual editing commands is probably a mistake.
  630.  
  631.      The special commands of the mode in question bind
  632.      `buffer-read-only' to `nil' (with `let') around the places where
  633.      they change the text.
  634.  
  635.  - Variable: buffer-read-only
  636.      This buffer-local variable specifies whether the buffer is
  637.      read-only.  The buffer is read-only if this variable is non-`nil'.
  638.  
  639.  - Command: toggle-read-only
  640.      This command changes whether the current buffer is read-only.  It
  641.      is intended for interactive use; don't use it in programs.  At any
  642.      given point in a program, you should know whether you want the
  643.      read-only flag on or off; so you can set `buffer-read-only'
  644.      explicitly to the proper value, `t' or `nil'.
  645.  
  646.  - Function: barf-if-buffer-read-only
  647.      This function signals a `buffer-read-only' error if the current
  648.      buffer is read-only.  *Note Interactive Call::, for another way to
  649.      signal an error if the current buffer is read-only.
  650.  
  651. 
  652. File: elisp,  Node: The Buffer List,  Next: Creating Buffers,  Prev: Read Only Buffers,  Up: Buffers
  653.  
  654. The Buffer List
  655. ===============
  656.  
  657.    The "buffer list" is a list of all buffers that have not been
  658. killed.  The order of the buffers in the list is based primarily on how
  659. recently each buffer has been displayed in the selected window.  Several
  660. functions, notably `other-buffer', make use of this ordering.
  661.  
  662.  - Function: buffer-list
  663.      This function returns a list of all buffers, including those whose
  664.      names begin with a space.  The elements are actual buffers, not
  665.      their names.
  666.  
  667.           (buffer-list)
  668.                => (#<buffer buffers.texi>
  669.                    #<buffer  *Minibuf-1*> #<buffer buffer.c>
  670.                    #<buffer *Help*> #<buffer TAGS>)
  671.           
  672.           ;; Note that the name of the minibuffer
  673.           ;;   begins with a space!
  674.           
  675.           (mapcar (function buffer-name) (buffer-list))
  676.               => ("buffers.texi" " *Minibuf-1*"
  677.                    "buffer.c" "*Help*" "TAGS")
  678.  
  679.      Buffers appear earlier in the list if they were current more
  680.      recently.
  681.  
  682.      This list is a copy of a list used inside Emacs; modifying it has
  683.      no effect on the buffers.
  684.  
  685.  - Function: other-buffer &optional BUFFER-OR-NAME VISIBLE-OK
  686.      This function returns the first buffer in the buffer list other
  687.      than BUFFER-OR-NAME.  Usually this is the buffer most recently
  688.      shown in the selected window, aside from BUFFER-OR-NAME.  Buffers
  689.      are moved to the front of the list when they are selected and to
  690.      the end when they are buried.  Buffers whose names start with a
  691.      space are not even considered.
  692.  
  693.      If BUFFER-OR-NAME is not supplied (or if it is not a buffer), then
  694.      `other-buffer' returns the first buffer on the buffer list that is
  695.      not visible in any window.
  696.  
  697.      Normally, `other-buffer' avoids returning a buffer visible in any
  698.      window, except as a last resort.  However, if VISIBLE-OK is
  699.      non-`nil', then a buffer displayed in some window is admissible to
  700.      return.
  701.  
  702.      If no suitable buffer exists, the buffer `*scratch*' is returned
  703.      (and created, if necessary).
  704.  
  705.  - Command: list-buffers &optional FILES-ONLY
  706.      This function displays a listing of the names of existing buffers.
  707.      It clears the buffer `*Buffer List*', then inserts the listing
  708.      into that buffer and displays it in a window.  `list-buffers' is
  709.      intended for interactive use, and is described fully in `The GNU
  710.      Emacs Manual'.  It returns `nil'.
  711.  
  712.  - Command: bury-buffer &optional BUFFER-OR-NAME
  713.      This function puts BUFFER-OR-NAME at the end of the buffer list
  714.      without changing the order of any of the other buffers on the list.
  715.      This buffer therefore becomes the least desirable candidate for
  716.      `other-buffer' to return, and appears last in the list displayed by
  717.      `list-buffers'.
  718.  
  719.      If BUFFER-OR-NAME is `nil' or omitted, this means to bury the
  720.      current buffer.  In addition, this switches to some other buffer
  721.      (obtained using `other-buffer') in the selected window.  If the
  722.      buffer is displayed in a window other than the selected one, it
  723.      remains there.
  724.  
  725.      If you wish to remove a buffer from all the windows that display
  726.      it, you can do so with a loop that uses `get-buffer-window'.
  727.      *Note Buffers and Windows::.
  728.  
  729. 
  730. File: elisp,  Node: Creating Buffers,  Next: Killing Buffers,  Prev: The Buffer List,  Up: Buffers
  731.  
  732. Creating Buffers
  733. ================
  734.  
  735.    This section describes the two primitives for creating buffers.
  736. `get-buffer-create' creates a buffer if it finds no existing buffer;
  737. `generate-new-buffer' always creates a new buffer, and gives it a
  738. unique name.
  739.  
  740.    Other functions you can use to create buffers include
  741. `with-output-to-temp-buffer' (*note Temporary Displays::.) and
  742. `create-file-buffer' (*note Visiting Files::.).
  743.  
  744.  - Function: get-buffer-create NAME
  745.      This function returns a buffer named NAME.  If such a buffer
  746.      already exists, it is returned.  If such a buffer does not exist,
  747.      one is created and returned.  The buffer does not become the
  748.      current buffer--this function does not change which buffer is
  749.      current.
  750.  
  751.      An error is signaled if NAME is not a string.
  752.  
  753.           (get-buffer-create "foo")
  754.                => #<buffer foo>
  755.  
  756.      The major mode for the new buffer is set by the value of
  757.      `default-major-mode'.  *Note Auto Major Mode::.
  758.  
  759.  - Function: generate-new-buffer NAME
  760.      This function returns a newly created, empty buffer, but does not
  761.      make it current.  If there is no buffer named NAME, then that is
  762.      the name of the new buffer.  If that name is in use, this function
  763.      adds suffixes of the form `<N>' are added to NAME, where N is an
  764.      integer.  It tries successive integers starting with 2 until it
  765.      finds an available name.
  766.  
  767.      An error is signaled if NAME is not a string.
  768.  
  769.           (generate-new-buffer "bar")
  770.                => #<buffer bar>
  771.           (generate-new-buffer "bar")
  772.                => #<buffer bar<2>>
  773.           (generate-new-buffer "bar")
  774.                => #<buffer bar<3>>
  775.  
  776.      The major mode for the new buffer is set by the value of
  777.      `default-major-mode'.  *Note Auto Major Mode::.
  778.  
  779.      See the related function `generate-new-buffer-name' in *Note
  780.      Buffer Names::.
  781.  
  782. 
  783. File: elisp,  Node: Killing Buffers,  Next: Current Buffer,  Prev: Creating Buffers,  Up: Buffers
  784.  
  785. Killing Buffers
  786. ===============
  787.  
  788.    "Killing a buffer" makes its name unknown to Emacs and makes its
  789. space available for other use.
  790.  
  791.    The buffer object for the buffer which has been killed remains in
  792. existence as long as anything refers to it, but it is specially marked
  793. so that you cannot make it current or display it.  Killed buffers retain
  794. their identity, however; two distinct buffers, when killed, remain
  795. distinct according to `eq'.
  796.  
  797.    If you kill a buffer that is current or displayed in a window, Emacs
  798. automatically selects or displays some other buffer instead.  This means
  799. that killing a buffer can in general change the current buffer.
  800. Therefore, when you kill a buffer, you should also take the precautions
  801. associated with changing the current buffer (unless you happen to know
  802. that the buffer being killed isn't current).  *Note Current Buffer::.
  803.  
  804.    The `buffer-name' of a killed buffer is `nil'.  You can use this
  805. feature to test whether a buffer has been killed:
  806.  
  807.      (defun killed-buffer-p (buffer)
  808.        "Return t if BUFFER is killed."
  809.        (not (buffer-name buffer)))
  810.  
  811.  - Command: kill-buffer BUFFER-OR-NAME
  812.      This function kills the buffer BUFFER-OR-NAME, freeing all its
  813.      memory for use as space for other buffers.  (Emacs version 18 and
  814.      older was unable to return the memory to the operating system.)
  815.      It returns `nil'.
  816.  
  817.      Any processes that have this buffer as the `process-buffer' are
  818.      sent the `SIGHUP' signal, which normally causes them to terminate.
  819.      (The usual meaning of `SIGHUP' is that a dialup line has been
  820.      disconnected.)  *Note Deleting Processes::.
  821.  
  822.      If the buffer is visiting a file when `kill-buffer' is called and
  823.      the buffer has not been saved since it was last modified, the user
  824.      is asked to confirm before the buffer is killed.  This is done
  825.      even if `kill-buffer' is not called interactively.  To prevent the
  826.      request for confirmation, clear the modified flag before calling
  827.      `kill-buffer'.  *Note Buffer Modification::.
  828.  
  829.      Just before actually killing the buffer, after asking all
  830.      questions, `kill-buffer' runs the normal hook `kill-buffer-hook'.
  831.      The buffer to be killed is current when the hook functions run.
  832.      *Note Hooks::.
  833.  
  834.      Killing a buffer that is already dead has no effect.
  835.  
  836.           (kill-buffer "foo.unchanged")
  837.                => nil
  838.           (kill-buffer "foo.changed")
  839.           
  840.           ---------- Buffer: Minibuffer ----------
  841.           Buffer foo.changed modified; kill anyway? (yes or no) `yes'
  842.           ---------- Buffer: Minibuffer ----------
  843.           
  844.                => nil
  845.  
  846. 
  847. File: elisp,  Node: Current Buffer,  Prev: Killing Buffers,  Up: Buffers
  848.  
  849. The Current Buffer
  850. ==================
  851.  
  852.    There are, in general, many buffers in an Emacs session.  At any
  853. time, one of them is designated as the "current buffer".  This is the
  854. buffer in which most editing takes place, because most of the primitives
  855. for examining or changing text in a buffer operate implicitly on the
  856. current buffer (*note Text::.).  Normally the buffer that is displayed
  857. on the screen in the selected window is the current buffer, but this is
  858. not always so: a Lisp program can designate any buffer as current
  859. temporarily in order to operate on its contents, without changing what
  860. is displayed on the screen.
  861.  
  862.    The way to designate a current buffer in a Lisp program is by calling
  863. `set-buffer'.  The specified buffer remains current until a new one is
  864. designated.
  865.  
  866.    When an editing command returns to the editor command loop, the
  867. command loop designates the buffer displayed in the selected window as
  868. current, to prevent confusion: the buffer that the cursor is in, when
  869. Emacs reads a command, is the one to which the command will apply.
  870. (*Note Command Loop::.)  Therefore, `set-buffer' is not usable for
  871. switching visibly to a different buffer so that the user can edit it.
  872. For this, you must use the functions described in *Note Displaying
  873. Buffers::.
  874.  
  875.    However, Lisp functions that change to a different current buffer
  876. should not leave it to the command loop to set it back afterwards.
  877. Editing commands written in Emacs Lisp can be called from other programs
  878. as well as from the command loop.  It is convenient for the caller if
  879. the subroutine does not change which buffer is current (unless, of
  880. course, that is the subroutine's purpose).  Therefore, you should
  881. normally use `set-buffer' within a `save-excursion' that will restore
  882. the current buffer when your program is done (*note Excursions::.).
  883. Here is an example, the code for the command `append-to-buffer' (with
  884. the documentation string abridged):
  885.  
  886.      (defun append-to-buffer (buffer start end)
  887.        "Append to specified buffer the text of the region..."
  888.        (interactive "BAppend to buffer: \nr")
  889.        (let ((oldbuf (current-buffer)))
  890.          (save-excursion
  891.            (set-buffer (get-buffer-create buffer))
  892.            (insert-buffer-substring oldbuf start end))))
  893.  
  894. This function binds a local variable to the current buffer, and then
  895. `save-excursion' records the values of point, the mark, and the
  896. original buffer.  Next, `set-buffer' makes another buffer current.
  897. Finally, `insert-buffer-substring' copies the string from the original
  898. current buffer to the new current buffer.
  899.  
  900.    If the buffer appended to happens to be displayed in some window,
  901. then the next redisplay will show how its text has changed.  Otherwise,
  902. you will not see the change immediately on the screen.  The buffer
  903. becomes current temporarily during the execution of the command, but
  904. this does not cause it to be displayed.
  905.  
  906.    Changing the current buffer between the binding and unbinding of a
  907. buffer-local variable can cause it to be bound in one buffer, and then
  908. unbound in another!  You can avoid this problem by using save-excursion
  909. to make sure that the buffer from which the variable was bound is
  910. current again whenever the variable is unbound.
  911.  
  912.      (let (buffer-read-only)
  913.        (save-excursion
  914.          (set-buffer ...)
  915.          ...))
  916.  
  917.  - Function: current-buffer
  918.      This function returns the current buffer.
  919.  
  920.           (current-buffer)
  921.                => #<buffer buffers.texi>
  922.  
  923.  - Function: set-buffer BUFFER-OR-NAME
  924.      This function makes BUFFER-OR-NAME the current buffer.  However,
  925.      it does not display the buffer in the currently selected window or
  926.      in any other window.  This means that the user cannot necessarily
  927.      see the buffer, but Lisp programs can in any case work on it.
  928.  
  929.      This function returns the buffer identified by BUFFER-OR-NAME.  An
  930.      error is signaled if BUFFER-OR-NAME does not identify an existing
  931.      buffer.
  932.  
  933. 
  934. File: elisp,  Node: Windows,  Next: Frames,  Prev: Buffers,  Up: Top
  935.  
  936. Windows
  937. *******
  938.  
  939.    This chapter describes most of the functions and variables related to
  940. Emacs windows.  See *Note Emacs Display::, for information on how text
  941. is displayed in windows.
  942.  
  943. * Menu:
  944.  
  945. * Basic Windows::          Basic information on using windows.
  946. * Splitting Windows::      Splitting one window into two windows.
  947. * Deleting Windows::       Deleting a window gives its space to other windows.
  948. * Selecting Windows::      The selected window is the one that you edit in.
  949. * Cyclic Window Ordering:: Moving around the existing windows.
  950. * Buffers and Windows::    Each window displays the contents of a buffer.
  951. * Displaying Buffers::     Higher-lever functions for displaying a buffer
  952.                              and choosing a window for it.
  953. * Choosing Window::       How to choose a window for displaying a buffer.
  954. * Window Point::           Each window has its own location of point.
  955. * Window Start::           The display-start position controls which text
  956.                              is on-screen in the window.
  957. * Vertical Scrolling::     Moving text up and down in the window.
  958. * Horizontal Scrolling::   Moving text sideways on the window.
  959. * Size of Window::         Accessing the size of a window.
  960. * Resizing Windows::       Changing the size of a window.
  961. * Coordinates and Windows::Converting coordinates to windows.
  962. * Window Configurations::  Saving and restoring the state of the screen.
  963.  
  964. 
  965. File: elisp,  Node: Basic Windows,  Next: Splitting Windows,  Up: Windows
  966.  
  967. Basic Concepts of Emacs Windows
  968. ===============================
  969.  
  970.    A "window" is the physical area of the screen in which a buffer is
  971. displayed.  The term is also used to refer to a Lisp object which
  972. represents that screen area in Emacs Lisp.  It should be clear from the
  973. context which is meant.
  974.  
  975.    There is always at least one window displayed on the screen, and
  976. there is exactly one window that we call the "selected window".  The
  977. cursor is in the selected window.  The selected window's buffer is
  978. usually the current buffer (except when `set-buffer' has been used.)
  979. *Note Current Buffer::.
  980.  
  981.    For all intents, a window only exists while it is displayed on the
  982. terminal.  Once removed from the display, the window is effectively
  983. deleted and should not be used, *even though there may still be
  984. references to it* from other Lisp objects.  Restoring a saved window
  985. configuration is the only way for a window no longer on the screen to
  986. come back to life.  (*Note Deleting Windows::.)
  987.  
  988.    Each window has the following attributes:
  989.  
  990.    * containing frame
  991.  
  992.    * window height
  993.  
  994.    * window width
  995.  
  996.    * window edges with respect to the screen or frame
  997.  
  998.    * the buffer it displays
  999.  
  1000.    * position within the buffer at the upper left of the window
  1001.  
  1002.    * the amount of horizontal scrolling, in columns
  1003.  
  1004.    * point
  1005.  
  1006.    * the mark
  1007.  
  1008.    * how recently the window was selected
  1009.  
  1010.    Applications use multiple windows for a variety of reasons, but most
  1011. often to give different views of the same information.  In Rmail, for
  1012. example, you can move through a summary buffer in one window while the
  1013. other window shows messages one at a time as they are reached.
  1014.  
  1015.    The term "window" in Emacs means something similar to what it means
  1016. in the context of general puprpose window systems such as X, but not
  1017. identical.  The X Window System subdivides the screen into X windows;
  1018. Emacs uses one or more X windows, called "frames" in Emacs terminology,
  1019. and subdivides each of them into (nonoverlapping) Emacs windows.  When
  1020. you use Emacs on an ordinary display terminal, Emacs subdivides the
  1021. terminal screen into Emacs windows.
  1022.  
  1023.    Most window systems support arbitrarily located overlapping windows.
  1024. In contrast, Emacs windows are "tiled"; they never overlap, and
  1025. together they fill the whole of the screen or frame.  Because of the way
  1026. in which Emacs creates new windows and resizes them, you can't create
  1027. every conceivable tiling on an Emacs screen.  *Note Splitting Windows::.
  1028. Also, see *Note Size of Window::.
  1029.  
  1030.    *Note Emacs Display::, for information on how the contents of the
  1031. window's buffer are displayed in the window.
  1032.  
  1033.  - Function: windowp OBJECT
  1034.      This function returns `t' if OBJECT is a window.
  1035.  
  1036. 
  1037. File: elisp,  Node: Splitting Windows,  Next: Deleting Windows,  Prev: Basic Windows,  Up: Windows
  1038.  
  1039. Splitting Windows
  1040. =================
  1041.  
  1042.    The functions described here are the primitives used to split a
  1043. window into two windows.  Two higher level functions sometimes split a
  1044. window, but not always: `pop-to-buffer' and `display-buffer' (*note
  1045. Displaying Buffers::.).
  1046.  
  1047.    The functions described here do not accept a buffer as an argument.
  1048. They let the two "halves" of the split window display the same buffer
  1049. previously visible in the window that was split.
  1050.  
  1051.  - Function: one-window-p &optional NO-MINI
  1052.      This function returns non-`nil' if there is only one window.  The
  1053.      argument NO-MINI, if non-`nil', means don't count the minibuffer
  1054.      even if it is active; otherwise, the minibuffer window is
  1055.      included, if active, in the total number of windows which is
  1056.      compared against one.
  1057.  
  1058.  - Command: split-window &optional WINDOW SIZE HORIZONTAL
  1059.      This function splits WINDOW into two windows.  The original window
  1060.      WINDOW remains the selected window, but occupies only part of its
  1061.      former screen area.  The rest is occupied by a newly created
  1062.      window which is returned as the value of this function.
  1063.  
  1064.      If HORIZONTAL is non-`nil', then WINDOW splits side by side,
  1065.      keeping the leftmost SIZE columns and giving the rest of the
  1066.      columns to the new window.  Otherwise, it splits into halves one
  1067.      above the other, keeping the upper SIZE lines and giving the rest
  1068.      of the lines to the new window.  The original window is therefore
  1069.      the right-hand or upper of the two, and the new window is the
  1070.      left-hand or lower.
  1071.  
  1072.      If WINDOW is omitted or `nil', then the selected window is split.
  1073.      If SIZE is omitted or `nil', then WINDOW is divided evenly into
  1074.      two parts.  (If there is an odd line, it is allocated to the new
  1075.      window.)  When `split-window' is called interactively, all its
  1076.      arguments are `nil'.
  1077.  
  1078.      The following example starts with one window on a screen that is 50
  1079.      lines high by 80 columns wide; then the window is split.
  1080.  
  1081.           (setq w (selected-window))
  1082.                => #<window 8 on windows.texi>
  1083.           (window-edges)          ; Edges in order:
  1084.                => (0 0 80 50)     ;   left--top--right--bottom
  1085.           
  1086.           ;; Returns window created
  1087.           (setq w2 (split-window w 15))
  1088.                => #<window 28 on windows.texi>
  1089.           (window-edges w2)
  1090.                => (0 15 80 50)    ; Bottom window;
  1091.                                   ;   top is line 15
  1092.           (window-edges w)
  1093.                => (0 0 80 15)     ; Top window
  1094.  
  1095.      The screen looks like this:
  1096.  
  1097.                    __________
  1098.                   |          |  line 0
  1099.                   |    w     |
  1100.                   |__________|
  1101.                   |          |  line 15
  1102.                   |    w2    |
  1103.                   |__________|
  1104.                                 line 50
  1105.            column 0   column 80
  1106.  
  1107.      Next, the top window is split horizontally:
  1108.  
  1109.           (setq w3 (split-window w 35 t))
  1110.                => #<window 32 on windows.texi>
  1111.           (window-edges w3)
  1112.                => (35 0 80 15)  ; Left edge at column 35
  1113.           (window-edges w)
  1114.                => (0 0 35 15)   ; Right edge at column 35
  1115.           (window-edges w2)
  1116.                => (0 15 80 50)  ; Bottom window unchanged
  1117.  
  1118.      Now, the screen looks like this:
  1119.  
  1120.                column 35
  1121.                    __________
  1122.                   |   |      |  line 0
  1123.                   | w |  w3  |
  1124.                   |___|______|
  1125.                   |          |  line 15
  1126.                   |    w2    |
  1127.                   |__________|
  1128.                                 line 50
  1129.            column 0   column 80
  1130.  
  1131.  - Command: split-window-vertically SIZE
  1132.      This function splits the selected window into two windows, one
  1133.      above the other, leaving the selected window with SIZE lines.
  1134.  
  1135.      This function is simply an interface to `split-windows'.  Here is
  1136.      the complete function definition for it:
  1137.  
  1138.           (defun split-window-vertically (&optional arg)
  1139.             "Split selected window into two windows,
  1140.           one above the other..."
  1141.             (interactive "P")
  1142.             (split-window nil (and arg (prefix-numeric-value arg))))
  1143.  
  1144.  - Command: split-window-horizontally SIZE
  1145.      This function splits the selected window into two windows
  1146.      side-by-side, leaving the selected window with SIZE columns.
  1147.  
  1148.      This function is simply an interface to `split-windows'.  Here is
  1149.      the complete definition for `split-window-horizontally' (except for
  1150.      part of the documentation string):
  1151.  
  1152.           (defun split-window-horizontally (&optional arg)
  1153.             "Split selected window into two windows
  1154.           side by side..."
  1155.             (interactive "P")
  1156.             (split-window nil (and arg (prefix-numeric-value arg)) t))
  1157.  
  1158.