From: Juri Linkov <juri@linkov.net>
To: Ramesh Nedunchezian <rameshnedunchezian@outlook.com>
Cc: 47688@debbugs.gnu.org
Subject: bug#47688: 28.0.50; repeat-mode: Make rectangle commands repeatable. Also some misc. queries, comments
Date: Tue, 13 Apr 2021 19:09:07 +0300 [thread overview]
Message-ID: <87czuy9otg.fsf@mail.linkov.net> (raw)
In-Reply-To: <87lf9nxyun.fsf@mail.linkov.net> (Juri Linkov's message of "Mon, 12 Apr 2021 19:16:16 +0300")
[-- Attachment #1: Type: text/plain, Size: 477 bytes --]
> Could you please demonstrate an example of the real key sequences
> where repeat-mode could help to greatly reduce the length of
> such key sequences.
An example where such repeating map is sorely missing is gdb.
Until now, stepping through the program was a hassle that required
typing such overly long key sequences:
'C-x C-a C-n C-x C-a C-n C-x C-a C-n C-x C-a C-n C-x C-a C-n ...'
Now with the following patch, stepping is much easier:
'C-x C-a C-n n n n n ...'
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: gud-step-repeat-map.patch --]
[-- Type: text/x-diff, Size: 1324 bytes --]
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
index b105cbaa0e..45ba9fff07 100644
--- a/lisp/progmodes/gud.el
+++ b/lisp/progmodes/gud.el
@@ -293,6 +293,12 @@ gud-tool-bar-map
(tool-bar-local-item-from-menu
(car x) (cdr x) map gud-minor-mode-map))))
+(defvar gud-step-repeat-map
+ (let ((map (make-sparse-keymap)))
+ map)
+ "Keymap to repeat gud stepping instructions `C-x C-a C-n n n'.
+Used in `repeat-mode'.")
+
(defun gud-file-name (f)
"Transform a relative file name to an absolute file name.
Uses `gud-<MINOR-MODE>-directories' to find the source files."
@@ -784,6 +790,17 @@ gud-gdb
(gud-def gud-until "until %l" "\C-u" "Continue to current line.")
(gud-def gud-run "run" nil "Run the program.")
+ (dolist (cmd '(("n" . gud-next)
+ ("s" . gud-step)
+ ("i" . gud-stepi)
+ ("c" . gud-cont)
+ ("l" . gud-refresh)
+ ("f" . gud-finish)
+ ("<" . gud-up)
+ (">" . gud-down)))
+ (define-key gud-step-repeat-map (car cmd) (cdr cmd))
+ (put (cdr cmd) 'repeat-map 'gud-step-repeat-map))
+
(add-hook 'completion-at-point-functions #'gud-gdb-completion-at-point
nil 'local)
(setq-local gud-gdb-completion-function 'gud-gdb-completions)
[-- Attachment #3: Type: text/plain, Size: 114 bytes --]
Also you can see that adding a convenience macro wouldn't much of help here,
dolist is quite convenient as well.
next prev parent reply other threads:[~2021-04-13 16:09 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-10 8:23 bug#47688: 28.0.50; repeat-mode: Make rectangle commands repeatable. Also some misc. queries, comments Ramesh Nedunchezian
2021-04-10 10:34 ` Dmitry Gutov
2021-04-10 13:04 ` Ramesh Nedunchezian
2021-04-10 14:54 ` Dmitry Gutov
2021-04-10 12:32 ` Ramesh Nedunchezian
2021-04-12 16:16 ` Juri Linkov
2021-04-13 16:09 ` Juri Linkov [this message]
2021-04-14 18:12 ` Juri Linkov
[not found] ` <handler.47688.D47688.161842410719411.notifdone@debbugs.gnu.org>
2021-05-04 4:19 ` bug#47688: closed (Re: bug#47688: 28.0.50; repeat-mode: Make rectangle commands repeatable. Also some misc. queries, comments) Ramesh Nedunchezian
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=87czuy9otg.fsf@mail.linkov.net \
--to=juri@linkov.net \
--cc=47688@debbugs.gnu.org \
--cc=rameshnedunchezian@outlook.com \
/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).