aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Rudalics2008-12-31 17:13:32 +0000
committerMartin Rudalics2008-12-31 17:13:32 +0000
commit174dc00c7415e479d698f4fa8ef037223d50de08 (patch)
tree666cc116926e0e2be7f9f96daaa18a49122896e8
parent4dc1abebf93ec8bc60eacd830eb333355980ab1e (diff)
downloademacs-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/ChangeLog6
-rw-r--r--doc/lispref/buffers.texi118
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 @@
12008-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
12008-12-27 Eli Zaretskii <eliz@gnu.org> 72008-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
775the buffers in the list is based primarily on how recently each buffer 775buffers in this list is based primarily on how recently each buffer has
776has been displayed in a window. Several functions, notably 776been 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
778the user also follows this order. 778user 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
781a buffer removes it. Buffers move to the front of the list when they 781buffer removes it from that list. A buffer moves to the front of this
782are selected for display in a window (@pxref{Displaying Buffers}), and 782list whenever it is chosen for display in a window (@pxref{Displaying
783to the end when they are buried (see @code{bury-buffer}, below). 783Buffers}) or a window displaying it is selected (@pxref{Selecting
784There are no functions available to the Lisp programmer which directly 784Windows}). A buffer moves to the end of the list when it is buried (see
785manipulate the buffer list. 785@code{bury-buffer}, below). There are no functions available to the
786 786Lisp programmer which directly manipulate the buffer list.
787 In addition to the fundamental Emacs buffer list, each frame has its 787
788own version of the buffer list, in which the buffers that have been 788 In addition to the fundamental buffer list just described, Emacs
789selected in that frame come first, starting with the buffers most 789maintains a local buffer list for each frame, in which the buffers that
790recently selected @emph{in that frame}. (This order is recorded in 790have been displayed (or had their windows selected) in that frame come
791@var{frame}'s @code{buffer-list} frame parameter; see @ref{Buffer 791first. (This order is recorded in the frame's @code{buffer-list} frame
792Parameters}.) The buffers that were never selected in @var{frame} come 792parameter; see @ref{Buffer Parameters}.) Buffers never displayed in
793afterward, ordered according to the fundamental Emacs buffer list. 793that frame come afterward, ordered according to the fundamental buffer
794list.
794 795
795@defun buffer-list &optional frame 796@defun buffer-list &optional frame
796This function returns the buffer list, including all buffers, even those 797This function returns the buffer list, including all buffers, even those
797whose names begin with a space. The elements are actual buffers, not 798whose names begin with a space. The elements are actual buffers, not
798their names. 799their names.
799 800
800If @var{frame} is a frame, this returns @var{frame}'s buffer list. If 801If @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: 802If @var{frame} is @code{nil} or omitted, the fundamental buffer list is
802all the buffers appear in order of most recent selection, regardless of 803used: the buffers appear in order of most recent display or selection,
803which frames they were selected in. 804regardless 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;
824by @code{buffer-list}; it is not an internal Emacs data structure, and 825it is not an internal Emacs data structure, and modifying it has no
825modifying it has no effect on the order of buffers. If you want to 826effect on the order of buffers. If you want to change the order of
826change the order of buffers in the frame-independent buffer list, here 827buffers in the fundamental buffer list, here is an easy way:
827is 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:
837no danger of losing a buffer or adding something that is not a valid 837no danger of losing a buffer or adding something that is not a valid
838live buffer. 838live 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} 841that 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
845This function returns the first buffer in the buffer list other than 845This 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
847frame @var{frame} or else the currently selected frame, @pxref{Input 847recently selected window (in frame @var{frame} or else the selected
848Focus}), aside from @var{buffer}. Buffers whose names start with a 848frame, @pxref{Input Focus}), aside from @var{buffer}. Buffers whose
849space are not considered at all. 849names start with a space are not considered at all.
850 850
851If @var{buffer} is not supplied (or if it is not a buffer), then 851If @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
853buffer list that is not now visible in any window in a visible frame. 853local buffer list. (If @var{frame} is non-@code{nil}, it returns the
854first buffer in @var{frame}'s local buffer list instead.)
854 855
855If @var{frame} has a non-@code{nil} @code{buffer-predicate} parameter, 856If @var{frame} has a non-@code{nil} @code{buffer-predicate} parameter,
856then @code{other-buffer} uses that predicate to decide which buffers to 857then @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
861If @var{visible-ok} is @code{nil}, @code{other-buffer} avoids returning 862If @var{visible-ok} is @code{nil}, @code{other-buffer} avoids returning
862a buffer visible in any window on any visible frame, except as a last 863a buffer visible in any window on any visible frame, except as a last
863resort. If @var{visible-ok} is non-@code{nil}, then it does not matter 864resort. If @var{visible-ok} is non-@code{nil}, then it does not matter
864whether a buffer is displayed somewhere or not. 865whether a buffer is displayed somewhere or not.
865 866
866If no suitable buffer exists, the buffer @samp{*scratch*} is returned 867If 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
872This function returns the last buffer in @var{frame}'s buffer list other
873than @var{BUFFER}. If @var{frame} is omitted or @code{nil}, it uses the
874selected frame's buffer list.
875
876The argument @var{visible-ok} is handled as with @code{other-buffer},
877see 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
871This function puts @var{buffer-or-name} at the end of the buffer list, 882This command puts @var{buffer-or-name} at the end of the buffer list,
872without changing the order of any of the other buffers on the list. 883without changing the order of any of the other buffers on the list.
873This buffer therefore becomes the least desirable candidate for 884This 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
875itself or the name of one. 886itself 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
878as well as the frame-independent Emacs buffer list; therefore, the 889as well as the fundamental buffer list; therefore, the buffer that you
879buffer that you bury will come last in the value of @code{(buffer-list 890bury 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)}. 891in the value of @code{(buffer-list)}.
881 892
882If @var{buffer-or-name} is @code{nil} or omitted, this means to bury the 893If @var{buffer-or-name} is @code{nil} or omitted, this means to bury the
883current buffer. In addition, if the buffer is displayed in the selected 894current buffer. In addition, if the buffer is displayed in the selected
884window, this switches to some other buffer (obtained using 895window, 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}.
886is dedicated to its buffer, it deletes that window if there are other 897But if the selected window is dedicated to its buffer, it deletes that
887windows left on its frame. Otherwise, if the selected window is the 898window if there are other windows left on its frame. Otherwise, if the
888only window on its frame, it iconifies that frame. If 899selected window is the only window on its frame, it iconifies that
889@var{buffer-or-name} is displayed in some other window, it remains 900frame. If @var{buffer-or-name} is displayed in some other window, it
890displayed there. 901remains displayed there.
891 902
892To replace a buffer in all the windows that display it, use 903To 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
908This command switches to the last buffer in the local buffer list of the
909selected frame. More precisely, it calls the function
910@code{switch-to-buffer} (@pxref{Displaying Buffers}), to display the
911buffer returned by @code{last-buffer}, see above, in the selected
912window.
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