diff options
| author | Martin Rudalics | 2008-12-31 17:13:32 +0000 |
|---|---|---|
| committer | Martin Rudalics | 2008-12-31 17:13:32 +0000 |
| commit | 174dc00c7415e479d698f4fa8ef037223d50de08 (patch) | |
| tree | 666cc116926e0e2be7f9f96daaa18a49122896e8 | |
| parent | 4dc1abebf93ec8bc60eacd830eb333355980ab1e (diff) | |
| download | emacs-174dc00c7415e479d698f4fa8ef037223d50de08.tar.gz emacs-174dc00c7415e479d698f4fa8ef037223d50de08.zip | |
(The Buffer List): Clarify what moves a buffer to
the front of the buffer list. Add entries for `last-buffer' and
`unbury-buffer'.
| -rw-r--r-- | doc/lispref/ChangeLog | 6 | ||||
| -rw-r--r-- | doc/lispref/buffers.texi | 118 |
2 files changed, 75 insertions, 49 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index e6d0b306448..b242dc8d0da 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2008-12-31 Martin Rudalics <rudalics@gmx.at> | ||
| 2 | |||
| 3 | * buffers.texi (The Buffer List): Clarify what moves a buffer to | ||
| 4 | the front of the buffer list. Add entries for `last-buffer' and | ||
| 5 | `unbury-buffer'. | ||
| 6 | |||
| 1 | 2008-12-27 Eli Zaretskii <eliz@gnu.org> | 7 | 2008-12-27 Eli Zaretskii <eliz@gnu.org> |
| 2 | 8 | ||
| 3 | * elisp.texi (Top): Add @detailmenu items for "Multiple Terminals" | 9 | * elisp.texi (Top): Add @detailmenu items for "Multiple Terminals" |
diff --git a/doc/lispref/buffers.texi b/doc/lispref/buffers.texi index 0b6b30000a8..55fc8ea7706 100644 --- a/doc/lispref/buffers.texi +++ b/doc/lispref/buffers.texi | |||
| @@ -771,36 +771,37 @@ signal an error if the current buffer is read-only. | |||
| 771 | @section The Buffer List | 771 | @section The Buffer List |
| 772 | @cindex buffer list | 772 | @cindex buffer list |
| 773 | 773 | ||
| 774 | The @dfn{buffer list} is a list of all live buffers. The order of | 774 | The @dfn{buffer list} is a list of all live buffers. The order of the |
| 775 | the buffers in the list is based primarily on how recently each buffer | 775 | buffers in this list is based primarily on how recently each buffer has |
| 776 | has been displayed in a window. Several functions, notably | 776 | been displayed in a window. Several functions, notably |
| 777 | @code{other-buffer}, use this ordering. A buffer list displayed for | 777 | @code{other-buffer}, use this ordering. A buffer list displayed for the |
| 778 | the user also follows this order. | 778 | user also follows this order. |
| 779 | 779 | ||
| 780 | Creating a buffer adds it to the end of the buffer list, and killing | 780 | Creating a buffer adds it to the end of the buffer list, and killing a |
| 781 | a buffer removes it. Buffers move to the front of the list when they | 781 | buffer removes it from that list. A buffer moves to the front of this |
| 782 | are selected for display in a window (@pxref{Displaying Buffers}), and | 782 | list whenever it is chosen for display in a window (@pxref{Displaying |
| 783 | to the end when they are buried (see @code{bury-buffer}, below). | 783 | Buffers}) or a window displaying it is selected (@pxref{Selecting |
| 784 | There are no functions available to the Lisp programmer which directly | 784 | Windows}). A buffer moves to the end of the list when it is buried (see |
| 785 | manipulate the buffer list. | 785 | @code{bury-buffer}, below). There are no functions available to the |
| 786 | 786 | Lisp programmer which directly manipulate the buffer list. | |
| 787 | In addition to the fundamental Emacs buffer list, each frame has its | 787 | |
| 788 | own version of the buffer list, in which the buffers that have been | 788 | In addition to the fundamental buffer list just described, Emacs |
| 789 | selected in that frame come first, starting with the buffers most | 789 | maintains a local buffer list for each frame, in which the buffers that |
| 790 | recently selected @emph{in that frame}. (This order is recorded in | 790 | have been displayed (or had their windows selected) in that frame come |
| 791 | @var{frame}'s @code{buffer-list} frame parameter; see @ref{Buffer | 791 | first. (This order is recorded in the frame's @code{buffer-list} frame |
| 792 | Parameters}.) The buffers that were never selected in @var{frame} come | 792 | parameter; see @ref{Buffer Parameters}.) Buffers never displayed in |
| 793 | afterward, ordered according to the fundamental Emacs buffer list. | 793 | that frame come afterward, ordered according to the fundamental buffer |
| 794 | list. | ||
| 794 | 795 | ||
| 795 | @defun buffer-list &optional frame | 796 | @defun buffer-list &optional frame |
| 796 | This function returns the buffer list, including all buffers, even those | 797 | This function returns the buffer list, including all buffers, even those |
| 797 | whose names begin with a space. The elements are actual buffers, not | 798 | whose names begin with a space. The elements are actual buffers, not |
| 798 | their names. | 799 | their names. |
| 799 | 800 | ||
| 800 | If @var{frame} is a frame, this returns @var{frame}'s buffer list. If | 801 | If @var{frame} is a frame, this returns @var{frame}'s local buffer list. |
| 801 | @var{frame} is @code{nil}, the fundamental Emacs buffer list is used: | 802 | If @var{frame} is @code{nil} or omitted, the fundamental buffer list is |
| 802 | all the buffers appear in order of most recent selection, regardless of | 803 | used: the buffers appear in order of most recent display or selection, |
| 803 | which frames they were selected in. | 804 | regardless of which frames they were displayed on. |
| 804 | 805 | ||
| 805 | @example | 806 | @example |
| 806 | @group | 807 | @group |
| @@ -820,11 +821,10 @@ which frames they were selected in. | |||
| 820 | @end example | 821 | @end example |
| 821 | @end defun | 822 | @end defun |
| 822 | 823 | ||
| 823 | The list that @code{buffer-list} returns is constructed specifically | 824 | The list returned by @code{buffer-list} is constructed specifically; |
| 824 | by @code{buffer-list}; it is not an internal Emacs data structure, and | 825 | it is not an internal Emacs data structure, and modifying it has no |
| 825 | modifying it has no effect on the order of buffers. If you want to | 826 | effect on the order of buffers. If you want to change the order of |
| 826 | change the order of buffers in the frame-independent buffer list, here | 827 | buffers in the fundamental buffer list, here is an easy way: |
| 827 | is an easy way: | ||
| 828 | 828 | ||
| 829 | @example | 829 | @example |
| 830 | (defun reorder-buffer-list (new-list) | 830 | (defun reorder-buffer-list (new-list) |
| @@ -837,20 +837,21 @@ is an easy way: | |||
| 837 | no danger of losing a buffer or adding something that is not a valid | 837 | no danger of losing a buffer or adding something that is not a valid |
| 838 | live buffer. | 838 | live buffer. |
| 839 | 839 | ||
| 840 | To change the order or value of a frame's buffer list, set the frame's | 840 | To change the order or value of a specific frame's buffer list, set |
| 841 | @code{buffer-list} frame parameter with @code{modify-frame-parameters} | 841 | that frame's @code{buffer-list} parameter with |
| 842 | (@pxref{Parameter Access}). | 842 | @code{modify-frame-parameters} (@pxref{Parameter Access}). |
| 843 | 843 | ||
| 844 | @defun other-buffer &optional buffer visible-ok frame | 844 | @defun other-buffer &optional buffer visible-ok frame |
| 845 | This function returns the first buffer in the buffer list other than | 845 | This function returns the first buffer in the buffer list other than |
| 846 | @var{buffer}. Usually this is the buffer selected most recently (in | 846 | @var{buffer}. Usually, this is the buffer appearing in the most |
| 847 | frame @var{frame} or else the currently selected frame, @pxref{Input | 847 | recently selected window (in frame @var{frame} or else the selected |
| 848 | Focus}), aside from @var{buffer}. Buffers whose names start with a | 848 | frame, @pxref{Input Focus}), aside from @var{buffer}. Buffers whose |
| 849 | space are not considered at all. | 849 | names start with a space are not considered at all. |
| 850 | 850 | ||
| 851 | If @var{buffer} is not supplied (or if it is not a buffer), then | 851 | If @var{buffer} is not supplied (or if it is not a live buffer), then |
| 852 | @code{other-buffer} returns the first buffer in the selected frame's | 852 | @code{other-buffer} returns the first buffer in the selected frame's |
| 853 | buffer list that is not now visible in any window in a visible frame. | 853 | local buffer list. (If @var{frame} is non-@code{nil}, it returns the |
| 854 | first buffer in @var{frame}'s local buffer list instead.) | ||
| 854 | 855 | ||
| 855 | If @var{frame} has a non-@code{nil} @code{buffer-predicate} parameter, | 856 | If @var{frame} has a non-@code{nil} @code{buffer-predicate} parameter, |
| 856 | then @code{other-buffer} uses that predicate to decide which buffers to | 857 | then @code{other-buffer} uses that predicate to decide which buffers to |
| @@ -860,39 +861,58 @@ is @code{nil}, that buffer is ignored. @xref{Buffer Parameters}. | |||
| 860 | @c Emacs 19 feature | 861 | @c Emacs 19 feature |
| 861 | If @var{visible-ok} is @code{nil}, @code{other-buffer} avoids returning | 862 | If @var{visible-ok} is @code{nil}, @code{other-buffer} avoids returning |
| 862 | a buffer visible in any window on any visible frame, except as a last | 863 | a buffer visible in any window on any visible frame, except as a last |
| 863 | resort. If @var{visible-ok} is non-@code{nil}, then it does not matter | 864 | resort. If @var{visible-ok} is non-@code{nil}, then it does not matter |
| 864 | whether a buffer is displayed somewhere or not. | 865 | whether a buffer is displayed somewhere or not. |
| 865 | 866 | ||
| 866 | If no suitable buffer exists, the buffer @samp{*scratch*} is returned | 867 | If no suitable buffer exists, the buffer @samp{*scratch*} is returned |
| 867 | (and created, if necessary). | 868 | (and created, if necessary). |
| 868 | @end defun | 869 | @end defun |
| 869 | 870 | ||
| 871 | @defun last-buffer &optional buffer visible-ok frame | ||
| 872 | This function returns the last buffer in @var{frame}'s buffer list other | ||
| 873 | than @var{BUFFER}. If @var{frame} is omitted or @code{nil}, it uses the | ||
| 874 | selected frame's buffer list. | ||
| 875 | |||
| 876 | The argument @var{visible-ok} is handled as with @code{other-buffer}, | ||
| 877 | see above. If no suitable buffer can be found, the buffer | ||
| 878 | @samp{*scratch*} is returned. | ||
| 879 | @end defun | ||
| 880 | |||
| 870 | @deffn Command bury-buffer &optional buffer-or-name | 881 | @deffn Command bury-buffer &optional buffer-or-name |
| 871 | This function puts @var{buffer-or-name} at the end of the buffer list, | 882 | This command puts @var{buffer-or-name} at the end of the buffer list, |
| 872 | without changing the order of any of the other buffers on the list. | 883 | without changing the order of any of the other buffers on the list. |
| 873 | This buffer therefore becomes the least desirable candidate for | 884 | This buffer therefore becomes the least desirable candidate for |
| 874 | @code{other-buffer} to return. The argument can be either a buffer | 885 | @code{other-buffer} to return. The argument can be either a buffer |
| 875 | itself or the name of one. | 886 | itself or the name of one. |
| 876 | 887 | ||
| 877 | @code{bury-buffer} operates on each frame's @code{buffer-list} parameter | 888 | @code{bury-buffer} operates on each frame's @code{buffer-list} parameter |
| 878 | as well as the frame-independent Emacs buffer list; therefore, the | 889 | as well as the fundamental buffer list; therefore, the buffer that you |
| 879 | buffer that you bury will come last in the value of @code{(buffer-list | 890 | bury will come last in the value of @code{(buffer-list @var{frame})} and |
| 880 | @var{frame})} and in the value of @code{(buffer-list nil)}. | 891 | in the value of @code{(buffer-list)}. |
| 881 | 892 | ||
| 882 | If @var{buffer-or-name} is @code{nil} or omitted, this means to bury the | 893 | If @var{buffer-or-name} is @code{nil} or omitted, this means to bury the |
| 883 | current buffer. In addition, if the buffer is displayed in the selected | 894 | current buffer. In addition, if the buffer is displayed in the selected |
| 884 | window, this switches to some other buffer (obtained using | 895 | window, this switches to some other buffer (obtained using |
| 885 | @code{other-buffer}) in the selected window. But if the selected window | 896 | @code{other-buffer}) in the selected window. @xref{Displaying Buffers}. |
| 886 | is dedicated to its buffer, it deletes that window if there are other | 897 | But if the selected window is dedicated to its buffer, it deletes that |
| 887 | windows left on its frame. Otherwise, if the selected window is the | 898 | window if there are other windows left on its frame. Otherwise, if the |
| 888 | only window on its frame, it iconifies that frame. If | 899 | selected window is the only window on its frame, it iconifies that |
| 889 | @var{buffer-or-name} is displayed in some other window, it remains | 900 | frame. If @var{buffer-or-name} is displayed in some other window, it |
| 890 | displayed there. | 901 | remains displayed there. |
| 891 | 902 | ||
| 892 | To replace a buffer in all the windows that display it, use | 903 | To replace a buffer in all the windows that display it, use |
| 893 | @code{replace-buffer-in-windows}. @xref{Buffers and Windows}. | 904 | @code{replace-buffer-in-windows}. @xref{Buffers and Windows}. |
| 894 | @end deffn | 905 | @end deffn |
| 895 | 906 | ||
| 907 | @deffn Command unbury-buffer | ||
| 908 | This command switches to the last buffer in the local buffer list of the | ||
| 909 | selected frame. More precisely, it calls the function | ||
| 910 | @code{switch-to-buffer} (@pxref{Displaying Buffers}), to display the | ||
| 911 | buffer returned by @code{last-buffer}, see above, in the selected | ||
| 912 | window. | ||
| 913 | @end deffn | ||
| 914 | |||
| 915 | |||
| 896 | @node Creating Buffers | 916 | @node Creating Buffers |
| 897 | @section Creating Buffers | 917 | @section Creating Buffers |
| 898 | @cindex creating buffers | 918 | @cindex creating buffers |