emacs-diffs
[Top][All Lists]
Advanced

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

master 94a2ef4: * lisp/repeat.el (describe-repeat): New command (bug#492


From: Juri Linkov
Subject: master 94a2ef4: * lisp/repeat.el (describe-repeat): New command (bug#49265).
Date: Tue, 29 Jun 2021 16:36:32 -0400 (EDT)

branch: master
commit 94a2ef436b857d8b9909d8629190bd3fbb1be5d7
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    * lisp/repeat.el (describe-repeat): New command (bug#49265).
---
 lisp/repeat.el | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/lisp/repeat.el b/lisp/repeat.el
index 46c880d..503cb34 100644
--- a/lisp/repeat.el
+++ b/lisp/repeat.el
@@ -397,7 +397,7 @@ When Repeat mode is enabled, and the command symbol has the 
property named
                                    (and (commandp s)
                                         (get s 'repeat-map)
                                         (push (get s 'repeat-map) keymaps))))))
-      (message "Repeat mode is enabled for %d commands and %d keymaps"
+      (message "Repeat mode is enabled for %d commands and %d keymaps; see 
`describe-repeat'."
                (length commands)
                (length (delete-dups keymaps))))))
 
@@ -489,6 +489,28 @@ When Repeat mode is enabled, and the command symbol has 
the property named
                                             repeat-echo-mode-line-string)))
     (force-mode-line-update t)))
 
+(defun describe-repeat ()
+  "Describe repeatable commands and keymaps."
+  (interactive)
+  (help-setup-xref (list #'describe-repeat)
+                   (called-interactively-p 'interactive))
+  (let ((keymaps nil))
+    (all-completions
+     "" obarray (lambda (s)
+                  (and (commandp s)
+                       (get s 'repeat-map)
+                       (push s (alist-get (get s 'repeat-map) keymaps)))))
+    (with-help-window (help-buffer)
+      (with-current-buffer standard-output
+        (princ "This is a list of repeatable keymaps and commands.\n\n")
+
+        (dolist (keymap (sort keymaps (lambda (a b) (string-lessp (car a) (car 
b)))))
+          (princ (format-message "`%s' keymap is repeatable by these 
commands:\n"
+                                 (car keymap)))
+          (dolist (command (sort (cdr keymap) 'string-lessp))
+            (princ (format-message " `%s'\n" command)))
+          (princ "\n"))))))
+
 (provide 'repeat)
 
 ;;; repeat.el ends here



reply via email to

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