]> git.eshelyaron.com Git - emacs.git/commitdiff
Display commands with repeat-continue-only in describe-repeat-maps
authorJuri Linkov <juri@linkov.net>
Tue, 17 Dec 2024 18:51:03 +0000 (20:51 +0200)
committerEshel Yaron <me@eshelyaron.com>
Mon, 23 Dec 2024 15:12:07 +0000 (16:12 +0100)
* lisp/repeat.el (describe-repeat-maps): Display commands with the
property 'repeat-continue-only' used to continue the currently
active repeat-map (bug#74140).  Also use 'cl--map-keymap-recursively'
instead of 'map-keymap' to find more deep keybindings.

(cherry picked from commit f025c9df48f8ad5f1cb13c9adac2fc1fbeb81b79)

lisp/repeat.el

index a0e4ae6bafb975b7844f4c56f45fb85e5329f127..df0eeaecc1acc7fa36e68ebf15bf7347ea285e4d 100644 (file)
@@ -654,15 +654,23 @@ Click on a keymap to see the commands repeatable by the keymap.\n")
                             (symbol-value (car keymap))
                           (car keymap)))
                    (repeat-commands (cdr keymap))
-                   map-commands commands-enter commands-exit)
-              (map-keymap (lambda (_key cmd)
-                            (when (symbolp cmd) (push cmd map-commands)))
-                          map)
+                   map-commands commands-enter commands-exit commands-continue)
+              (cl--map-keymap-recursively
+               (lambda (_key cmd)
+                 (when (symbolp cmd) (push cmd map-commands)))
+               map)
               (setq map-commands (seq-uniq map-commands))
-              (setq commands-enter (seq-difference repeat-commands map-commands))
-              (setq commands-exit  (seq-difference map-commands repeat-commands))
-
-              (when (or commands-enter commands-exit)
+              (setq commands-continue
+                    (seq-filter (lambda (s) (memq (car keymap)
+                                                  (get s 'repeat-continue-only)))
+                                map-commands))
+              (setq commands-enter
+                    (seq-difference repeat-commands map-commands))
+              (setq commands-exit
+                    (seq-difference (seq-difference map-commands repeat-commands)
+                                    commands-continue))
+
+              (when (or commands-enter commands-exit commands-continue)
                 (when commands-enter
                   (insert "\n** Entered with:\n\n")
                   (fill-region-as-paragraph
@@ -674,6 +682,17 @@ Click on a keymap to see the commands repeatable by the keymap.\n")
                                         ", "))
                      (point)))
                   (insert "\n"))
+                (when commands-continue
+                  (insert "\n** Continued only with:\n\n")
+                  (fill-region-as-paragraph
+                   (point)
+                   (progn
+                     (insert (mapconcat (lambda (cmd)
+                                          (format-message "`%s'" cmd))
+                                        (sort commands-continue #'string<)
+                                        ", "))
+                     (point)))
+                  (insert "\n"))
                 (when commands-exit
                   (insert "\n** Exited with:\n\n")
                   (fill-region-as-paragraph
@@ -689,7 +708,7 @@ Click on a keymap to see the commands repeatable by the keymap.\n")
           ;; Hide ^Ls.
           (goto-char (point-min))
           (while (search-forward "\n\f\n" nil t)
-           (put-text-property (1+ (match-beginning 0)) (1- (match-end 0))
+            (put-text-property (1+ (match-beginning 0)) (1- (match-end 0))
                                'invisible t)))))))
 
 (provide 'repeat)