@@ -3920,8 +3920,13 @@ or killed, or has been already shown by a recent invocation of
39203920If repeated invocations of this command have already shown all buffers
39213921previously shown in @var {window }, further invocations will show buffers
39223922from the buffer list of the frame @var {window } appears on (@pxref {Buffer
3923- List }), trying to skip buffers that are already shown in another window
3924- on that frame.
3923+ List }).
3924+
3925+ The option @code {switch-to-prev-buffer-skip } described below can be
3926+ used to inhibit switching to certain buffers, for example, to those
3927+ already shown in another window. Also, if @var {window }'s frame has a
3928+ @code {buffer-predicate } parameter (@pxref {Buffer Parameters }), that
3929+ predicate may inhibit switching to certain buffers.
39253930@end deffn
39263931
39273932@deffn Command switch-to-next-buffer &optional window
@@ -3933,20 +3938,65 @@ defaults to the selected one.
39333938If there is no recent invocation of @code {switch-to-prev-buffer } that
39343939can be undone, this function tries to show a buffer from the buffer list
39353940of the frame @var {window } appears on (@pxref {Buffer List }).
3941+
3942+ The option @code {switch-to-prev-buffer-skip } and the
3943+ @code {buffer-predicate } (@pxref {Buffer Parameters }) of @var {window }'s
3944+ frame affect this command as they do for @code {switch-to-prev-buffer }.
39363945@end deffn
39373946
3938- By default @code {switch-to-prev-buffer } and @code {switch-to-next-buffer }
3939- can switch to a buffer that is already shown in another window on the
3940- same frame. The following option can be used to override this behavior.
3941-
3942- @defopt switch-to-visible-buffer
3943- If this variable is non-@code {nil }, @code {switch-to-prev-buffer } and
3944- @code {switch-to-next-buffer } may switch to a buffer that is already
3945- visible on the same frame, provided the buffer was shown in the
3946- relevant window before. If it is @code {nil },
3947- @code {switch-to-prev-buffer } and @code {switch-to-next-buffer } always
3948- try to avoid switching to a buffer that is already visible in another
3949- window on the same frame. The default is @code {t }.
3947+ By default @code {switch-to-prev-buffer } and
3948+ @code {switch-to-next-buffer } can switch to a buffer that is already
3949+ shown in another window. The following option can be used to override
3950+ this behavior.
3951+
3952+ @defopt switch-to-prev-buffer-skip
3953+ If this variable is @code {nil }, @code {switch-to-prev-buffer } may
3954+ switch to any buffer, including those already shown in other windows.
3955+
3956+ If this variable is non-@code {nil }, @code {switch-to-prev-buffer } will
3957+ refrain from switching to certain buffers. The following values can
3958+ be used:
3959+
3960+ @itemize @bullet
3961+ @item
3962+ @code {this } means do not switch to a buffer shown on the frame that
3963+ hosts the window @code {switch-to-prev-buffer } is acting upon.
3964+
3965+ @item
3966+ @code {visible } means do not switch to a buffer shown on any visible
3967+ frame.
3968+
3969+ @item
3970+ 0 (the number zero) means do not switch to a buffer shown on any
3971+ visible or iconified frame.
3972+
3973+ @item
3974+ @code {t } means do not switch to a buffer shown on any live frame.
3975+
3976+ @item
3977+ A function that takes three arguments--- the @var {window } argument of
3978+ @code {switch-to-prev-buffer }, a buffer @code {switch-to-prev-buffer }
3979+ intends to switch to and the @var {bury-or-kill } argument of
3980+ @code {switch-to-prev-buffer }. If that function returns
3981+ non-@code {nil }, @code {switch-to-prev-buffer } will refrain from
3982+ switching to the buffer specified by the second argument.
3983+ @end itemize
3984+
3985+ The command @code {switch-to-next-buffer } obeys this option in a
3986+ similar way. If this option specifies a function,
3987+ @code {switch-to-next-buffer } will call that function with the third
3988+ argument always @code {nil }.
3989+
3990+ Note that since @code {switch-to-prev-buffer } is called by
3991+ @code {bury-buffer }, @code {replace-buffer-in-windows } and
3992+ @code {quit-restore-window } as well, customizing this option may also
3993+ affect the behavior of Emacs when a window is quit or a buffer gets
3994+ buried or killed.
3995+
3996+ Note also that under certain circumstances
3997+ @code {switch-to-prev-buffer } and @code {switch-to-next-buffer } may
3998+ ignore this option, for example, when there is only one buffer left
3999+ these functions can switch to.
39504000@end defopt
39514001
39524002
0 commit comments