Commit dafd3297 authored by Juri Linkov's avatar Juri Linkov

* lisp/window.el (next-buffer, previous-buffer): Add repeat count arg.

* doc/emacs/buffers.texi (Select Buffer): Mention arg as repeat count.
(Bug#37514)
parent e56c0bba
Pipeline #3616 failed with stage
in 90 minutes and 2 seconds
...@@ -127,7 +127,8 @@ Modes}). ...@@ -127,7 +127,8 @@ Modes}).
(@code{previous-buffer}) selects the previous buffer (following the (@code{previous-buffer}) selects the previous buffer (following the
order of most recent selection in the current frame), while @kbd{C-x order of most recent selection in the current frame), while @kbd{C-x
@key{RIGHT}} (@code{next-buffer}) moves through buffers in the reverse @key{RIGHT}} (@code{next-buffer}) moves through buffers in the reverse
direction. direction. Both commands support a numeric prefix argument that
serves as a repeat count.
@kindex C-x 4 b @kindex C-x 4 b
@findex switch-to-buffer-other-window @findex switch-to-buffer-other-window
......
...@@ -2115,9 +2115,10 @@ The new command 'global-tab-line-mode' enables the tab line above each ...@@ -2115,9 +2115,10 @@ The new command 'global-tab-line-mode' enables the tab line above each
window, which you can use to switch buffers in the window. Selecting window, which you can use to switch buffers in the window. Selecting
the previous window-local tab is the same as typing 'C-x <LEFT>' the previous window-local tab is the same as typing 'C-x <LEFT>'
(previous-buffer), selecting the next tab is the same as 'C-x <RIGHT>' (previous-buffer), selecting the next tab is the same as 'C-x <RIGHT>'
(next-buffer). Clicking on the plus icon adds a new buffer to the (next-buffer). Both commands support a numeric prefix argument as
window-local tab line of buffers. Using the mouse wheel on the a repeat count. Clicking on the plus icon adds a new buffer to the
tab line scrolls tabs that display the window buffers. window-local tab line of buffers. Using the mouse wheel on the tab
line scrolls tabs that display the window buffers.
** fileloop.el lets one setup multifile operations like search&replace. ** fileloop.el lets one setup multifile operations like search&replace.
......
...@@ -4747,31 +4747,33 @@ displayed there." ...@@ -4747,31 +4747,33 @@ displayed there."
(interactive) (interactive)
(switch-to-buffer (last-buffer))) (switch-to-buffer (last-buffer)))
(defun next-buffer () (defun next-buffer (&optional arg)
"In selected window switch to next buffer. "In selected window switch to ARGth next buffer.
Call `switch-to-next-buffer' unless the selected window is the Call `switch-to-next-buffer' unless the selected window is the
minibuffer window or is dedicated to its buffer." minibuffer window or is dedicated to its buffer."
(interactive) (interactive "p")
(cond (cond
((window-minibuffer-p) ((window-minibuffer-p)
(user-error "Cannot switch buffers in minibuffer window")) (user-error "Cannot switch buffers in minibuffer window"))
((eq (window-dedicated-p) t) ((eq (window-dedicated-p) t)
(user-error "Window is strongly dedicated to its buffer")) (user-error "Window is strongly dedicated to its buffer"))
(t (t
(switch-to-next-buffer)))) (dotimes (_ (or arg 1))
(switch-to-next-buffer)))))
(defun previous-buffer () (defun previous-buffer (&optional arg)
"In selected window switch to previous buffer. "In selected window switch to ARGth previous buffer.
Call `switch-to-prev-buffer' unless the selected window is the Call `switch-to-prev-buffer' unless the selected window is the
minibuffer window or is dedicated to its buffer." minibuffer window or is dedicated to its buffer."
(interactive) (interactive "p")
(cond (cond
((window-minibuffer-p) ((window-minibuffer-p)
(user-error "Cannot switch buffers in minibuffer window")) (user-error "Cannot switch buffers in minibuffer window"))
((eq (window-dedicated-p) t) ((eq (window-dedicated-p) t)
(user-error "Window is strongly dedicated to its buffer")) (user-error "Window is strongly dedicated to its buffer"))
(t (t
(switch-to-prev-buffer)))) (dotimes (_ (or arg 1))
(switch-to-prev-buffer)))))
(defun delete-windows-on (&optional buffer-or-name frame) (defun delete-windows-on (&optional buffer-or-name frame)
"Delete all windows showing BUFFER-OR-NAME. "Delete all windows showing BUFFER-OR-NAME.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment