diff options
| author | Juri Linkov | 2019-10-14 00:18:56 +0300 |
|---|---|---|
| committer | Juri Linkov | 2019-10-14 00:18:56 +0300 |
| commit | dafd329771f5028cdac1a2691a236ffa296c360c (patch) | |
| tree | 0ef873256e2e8dc0a8a77839a3cd81607e4f528e | |
| parent | e56c0bba4f66d5171daccbd743fbc5dd721c7dc3 (diff) | |
| download | emacs-dafd329771f5028cdac1a2691a236ffa296c360c.tar.gz emacs-dafd329771f5028cdac1a2691a236ffa296c360c.zip | |
* lisp/window.el (next-buffer, previous-buffer): Add repeat count arg.
* doc/emacs/buffers.texi (Select Buffer): Mention arg as repeat count.
(Bug#37514)
| -rw-r--r-- | doc/emacs/buffers.texi | 3 | ||||
| -rw-r--r-- | etc/NEWS | 7 | ||||
| -rw-r--r-- | lisp/window.el | 18 |
3 files changed, 16 insertions, 12 deletions
diff --git a/doc/emacs/buffers.texi b/doc/emacs/buffers.texi index 269f9f7d6fe..74e6211f808 100644 --- a/doc/emacs/buffers.texi +++ b/doc/emacs/buffers.texi | |||
| @@ -127,7 +127,8 @@ Modes}). | |||
| 127 | (@code{previous-buffer}) selects the previous buffer (following the | 127 | (@code{previous-buffer}) selects the previous buffer (following the |
| 128 | order of most recent selection in the current frame), while @kbd{C-x | 128 | order of most recent selection in the current frame), while @kbd{C-x |
| 129 | @key{RIGHT}} (@code{next-buffer}) moves through buffers in the reverse | 129 | @key{RIGHT}} (@code{next-buffer}) moves through buffers in the reverse |
| 130 | direction. | 130 | direction. Both commands support a numeric prefix argument that |
| 131 | serves as a repeat count. | ||
| 131 | 132 | ||
| 132 | @kindex C-x 4 b | 133 | @kindex C-x 4 b |
| 133 | @findex switch-to-buffer-other-window | 134 | @findex switch-to-buffer-other-window |
| @@ -2115,9 +2115,10 @@ The new command 'global-tab-line-mode' enables the tab line above each | |||
| 2115 | window, which you can use to switch buffers in the window. Selecting | 2115 | window, which you can use to switch buffers in the window. Selecting |
| 2116 | the previous window-local tab is the same as typing 'C-x <LEFT>' | 2116 | the previous window-local tab is the same as typing 'C-x <LEFT>' |
| 2117 | (previous-buffer), selecting the next tab is the same as 'C-x <RIGHT>' | 2117 | (previous-buffer), selecting the next tab is the same as 'C-x <RIGHT>' |
| 2118 | (next-buffer). Clicking on the plus icon adds a new buffer to the | 2118 | (next-buffer). Both commands support a numeric prefix argument as |
| 2119 | window-local tab line of buffers. Using the mouse wheel on the | 2119 | a repeat count. Clicking on the plus icon adds a new buffer to the |
| 2120 | tab line scrolls tabs that display the window buffers. | 2120 | window-local tab line of buffers. Using the mouse wheel on the tab |
| 2121 | line scrolls tabs that display the window buffers. | ||
| 2121 | 2122 | ||
| 2122 | ** fileloop.el lets one setup multifile operations like search&replace. | 2123 | ** fileloop.el lets one setup multifile operations like search&replace. |
| 2123 | 2124 | ||
diff --git a/lisp/window.el b/lisp/window.el index d7955209cd4..80d9d2e072b 100644 --- a/lisp/window.el +++ b/lisp/window.el | |||
| @@ -4747,31 +4747,33 @@ displayed there." | |||
| 4747 | (interactive) | 4747 | (interactive) |
| 4748 | (switch-to-buffer (last-buffer))) | 4748 | (switch-to-buffer (last-buffer))) |
| 4749 | 4749 | ||
| 4750 | (defun next-buffer () | 4750 | (defun next-buffer (&optional arg) |
| 4751 | "In selected window switch to next buffer. | 4751 | "In selected window switch to ARGth next buffer. |
| 4752 | Call `switch-to-next-buffer' unless the selected window is the | 4752 | Call `switch-to-next-buffer' unless the selected window is the |
| 4753 | minibuffer window or is dedicated to its buffer." | 4753 | minibuffer window or is dedicated to its buffer." |
| 4754 | (interactive) | 4754 | (interactive "p") |
| 4755 | (cond | 4755 | (cond |
| 4756 | ((window-minibuffer-p) | 4756 | ((window-minibuffer-p) |
| 4757 | (user-error "Cannot switch buffers in minibuffer window")) | 4757 | (user-error "Cannot switch buffers in minibuffer window")) |
| 4758 | ((eq (window-dedicated-p) t) | 4758 | ((eq (window-dedicated-p) t) |
| 4759 | (user-error "Window is strongly dedicated to its buffer")) | 4759 | (user-error "Window is strongly dedicated to its buffer")) |
| 4760 | (t | 4760 | (t |
| 4761 | (switch-to-next-buffer)))) | 4761 | (dotimes (_ (or arg 1)) |
| 4762 | (switch-to-next-buffer))))) | ||
| 4762 | 4763 | ||
| 4763 | (defun previous-buffer () | 4764 | (defun previous-buffer (&optional arg) |
| 4764 | "In selected window switch to previous buffer. | 4765 | "In selected window switch to ARGth previous buffer. |
| 4765 | Call `switch-to-prev-buffer' unless the selected window is the | 4766 | Call `switch-to-prev-buffer' unless the selected window is the |
| 4766 | minibuffer window or is dedicated to its buffer." | 4767 | minibuffer window or is dedicated to its buffer." |
| 4767 | (interactive) | 4768 | (interactive "p") |
| 4768 | (cond | 4769 | (cond |
| 4769 | ((window-minibuffer-p) | 4770 | ((window-minibuffer-p) |
| 4770 | (user-error "Cannot switch buffers in minibuffer window")) | 4771 | (user-error "Cannot switch buffers in minibuffer window")) |
| 4771 | ((eq (window-dedicated-p) t) | 4772 | ((eq (window-dedicated-p) t) |
| 4772 | (user-error "Window is strongly dedicated to its buffer")) | 4773 | (user-error "Window is strongly dedicated to its buffer")) |
| 4773 | (t | 4774 | (t |
| 4774 | (switch-to-prev-buffer)))) | 4775 | (dotimes (_ (or arg 1)) |
| 4776 | (switch-to-prev-buffer))))) | ||
| 4775 | 4777 | ||
| 4776 | (defun delete-windows-on (&optional buffer-or-name frame) | 4778 | (defun delete-windows-on (&optional buffer-or-name frame) |
| 4777 | "Delete all windows showing BUFFER-OR-NAME. | 4779 | "Delete all windows showing BUFFER-OR-NAME. |