all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@linkov.net>
To: Matt Armstrong <matt@rfc20.org>
Cc: 46515@debbugs.gnu.org
Subject: bug#46515: Repeat mode
Date: Mon, 15 Feb 2021 19:04:12 +0200	[thread overview]
Message-ID: <87czx1z2ib.fsf@mail.linkov.net> (raw)
In-Reply-To: <87sg5xy85o.fsf@mail.linkov.net> (Juri Linkov's message of "Mon,  15 Feb 2021 11:17:31 +0200")

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

>> repeat.el doesn't describe the key binding, but it does say a repeat
>> mode is active. Kmacro is so smart that it aranges for the repeat key to
>> be based on whatever key the command was invoked with.
>
> Unlike `indent-rigidly', `kmacro' message
>
>   (Type e to repeat macro)
>
> is displayed on every keypress, so it's a good example.
> Now added in the following patch applied over the previous patch.

Here is another incremental patch that adds more messaging:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: repeat-message-2.patch --]
[-- Type: text/x-diff, Size: 1566 bytes --]

diff --git a/lisp/repeat.el b/lisp/repeat.el
index 3c8be63c84..a322afed1d 100644
--- a/lisp/repeat.el
+++ b/lisp/repeat.el
@@ -349,7 +349,16 @@ repeat-mode
   :global t :group 'convenience
   (if (not repeat-mode)
       (remove-hook 'post-command-hook 'repeat-post-hook)
-    (add-hook 'post-command-hook 'repeat-post-hook)))
+    (add-hook 'post-command-hook 'repeat-post-hook)
+    (let* ((keymaps nil)
+           (commands (all-completions
+                      "" obarray (lambda (s)
+                                   (and (commandp s)
+                                        (get s 'repeat-map)
+                                        (push (get s 'repeat-map) keymaps))))))
+      (message "Repeat mode is enabled for %d commands and %d keymaps"
+               (length commands)
+               (length (delete-dups keymaps))))))
 
 (defun repeat-post-hook ()
   "Function run after commands to set transient keymap."
@@ -362,7 +371,10 @@ repeat-post-hook
         (let ((map (copy-keymap repeat-map)))
           (let (keys)
             (map-keymap (lambda (key _) (push (key-description (vector key)) keys)) map)
-            (message "To repeat type %s" (mapconcat #'identity keys ", ")))
+            (message "To repeat type %s%s"
+                     (mapconcat #'identity keys ", ")
+                     (when repeat-exit-key
+                       (format ", or %s to exit" (key-description repeat-exit-key)))))
           (when repeat-exit-key
             (define-key map repeat-exit-key 'ignore))
           (set-transient-map map))))))

  reply	other threads:[~2021-02-15 17:04 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-14 18:27 bug#46515: Repeat mode Juri Linkov
2021-02-14 23:59 ` Matt Armstrong
2021-02-15  9:17   ` Juri Linkov
2021-02-15 17:04     ` Juri Linkov [this message]
2021-02-16 16:49       ` Matt Armstrong
2021-02-17 18:05         ` Juri Linkov

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

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

  git send-email \
    --in-reply-to=87czx1z2ib.fsf@mail.linkov.net \
    --to=juri@linkov.net \
    --cc=46515@debbugs.gnu.org \
    --cc=matt@rfc20.org \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.