bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#37514: PATCH: Add setting to allow switching to an already-visible b


From: Juri Linkov
Subject: bug#37514: PATCH: Add setting to allow switching to an already-visible buffer by default
Date: Sat, 12 Oct 2019 23:47:30 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

>>> C-x <C-left>, C-x <left>, <XF86Back>
>>> C-x <C-right>, C-x <right>, <XF86Forward>
>>
>> These are not auto-repeatable, alas.
>
> At least we need to add a numeric arg to make them more repeatable
> with e.g. 'C-3 C-x <C-left>' - easy to type key sequence
> while holding the Ctrl key.

This patch makes them more repeatable:

diff --git a/lisp/window.el b/lisp/window.el
index d7955209cd..9fd00b94c2 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -4747,31 +4747,33 @@ unbury-buffer
   (interactive)
   (switch-to-buffer (last-buffer)))
 
-(defun next-buffer ()
-  "In selected window switch to next buffer.
+(defun next-buffer (&optional arg)
+  "In selected window switch to ARGth next buffer.
 Call `switch-to-next-buffer' unless the selected window is the
 minibuffer window or is dedicated to its buffer."
-  (interactive)
+  (interactive "p")
   (cond
    ((window-minibuffer-p)
     (user-error "Cannot switch buffers in minibuffer window"))
    ((eq (window-dedicated-p) t)
     (user-error "Window is strongly dedicated to its buffer"))
    (t
-    (switch-to-next-buffer))))
+    (dotimes (_ arg)
+      (switch-to-next-buffer)))))
 
-(defun previous-buffer ()
-  "In selected window switch to previous buffer.
+(defun previous-buffer (&optional arg)
+  "In selected window switch to ARGth previous buffer.
 Call `switch-to-prev-buffer' unless the selected window is the
 minibuffer window or is dedicated to its buffer."
-  (interactive)
+  (interactive "p")
   (cond
    ((window-minibuffer-p)
     (user-error "Cannot switch buffers in minibuffer window"))
    ((eq (window-dedicated-p) t)
     (user-error "Window is strongly dedicated to its buffer"))
    (t
-    (switch-to-prev-buffer))))
+    (dotimes (_ arg)
+      (switch-to-prev-buffer)))))
 
 (defun delete-windows-on (&optional buffer-or-name frame)
   "Delete all windows showing BUFFER-OR-NAME.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]