unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: martin rudalics <rudalics@gmx.at>
Cc: Lars Ingebrigtsen <larsi@gnus.org>,
	Jefferson Carpenter <jefferson@aoeu2code.com>,
	37514 <37514@debbugs.gnu.org>
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	[thread overview]
Message-ID: <87eezhen1h.fsf@mail.linkov.net> (raw)
In-Reply-To: <87o8ypixj8.fsf@mail.linkov.net> (Juri Linkov's message of "Wed,  09 Oct 2019 21:48:11 +0300")

[-- Attachment #1: Type: text/plain, Size: 331 bytes --]

>>> 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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: next-buffer-arg.patch --]
[-- Type: text/x-diff, Size: 1549 bytes --]

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	other threads:[~2019-10-12 20:47 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-25 21:24 bug#37514: PATCH: Add setting to allow switching to an already-visible buffer by default Jefferson Carpenter
2019-09-26  7:12 ` Eli Zaretskii
2019-09-26 19:13   ` Jefferson Carpenter
2019-09-26 19:14     ` Jefferson Carpenter
2019-09-27  8:16     ` martin rudalics
2019-09-28 21:00       ` Jefferson Carpenter
2019-10-02  3:36         ` Jefferson Carpenter
2019-10-02  8:54           ` martin rudalics
2019-10-04  0:45             ` Jefferson Carpenter
2019-10-05  8:42               ` martin rudalics
2019-10-05  9:30                 ` Eli Zaretskii
2020-01-20 19:35             ` Stefan Kangas
2020-03-18  5:36               ` Stefan Kangas
2019-10-07  4:25       ` Lars Ingebrigtsen
2019-10-07  9:26         ` martin rudalics
2019-10-07 18:09           ` Juri Linkov
2019-10-08  8:45             ` martin rudalics
2019-10-09 18:48               ` Juri Linkov
2019-10-12 20:47                 ` Juri Linkov [this message]
2019-10-13  8:17                   ` martin rudalics
2019-10-08 16:32             ` Lars Ingebrigtsen
2019-10-09 20:50               ` Juri Linkov
2019-10-09 20:59                 ` Lars Ingebrigtsen
2019-10-11  8:16                   ` martin rudalics
2019-10-07 12:04         ` Robert Pluim
2019-10-08  8:42           ` martin rudalics
2019-10-08 11:42             ` Robert Pluim
2019-09-26  7:20 ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eezhen1h.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=37514@debbugs.gnu.org \
    --cc=jefferson@aoeu2code.com \
    --cc=larsi@gnus.org \
    --cc=rudalics@gmx.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).