[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master f025c9df48f 2/3: Display commands with repeat-continue-only in de
From: |
Juri Linkov |
Subject: |
master f025c9df48f 2/3: Display commands with repeat-continue-only in describe-repeat-maps |
Date: |
Tue, 17 Dec 2024 13:59:44 -0500 (EST) |
branch: master
commit f025c9df48f8ad5f1cb13c9adac2fc1fbeb81b79
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>
Display commands with repeat-continue-only in describe-repeat-maps
* 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.
---
lisp/repeat.el | 37 ++++++++++++++++++++++++++++---------
1 file changed, 28 insertions(+), 9 deletions(-)
diff --git a/lisp/repeat.el b/lisp/repeat.el
index 2328c05a652..a114dc2c88b 100644
--- a/lisp/repeat.el
+++ b/lisp/repeat.el
@@ -653,15 +653,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
@@ -673,6 +681,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
@@ -688,7 +707,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)