summaryrefslogtreecommitdiff
path: root/lisp/repeat.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/repeat.el')
-rw-r--r--lisp/repeat.el75
1 files changed, 43 insertions, 32 deletions
diff --git a/lisp/repeat.el b/lisp/repeat.el
index 4d04f5ae951..a32f3a4c507 100644
--- a/lisp/repeat.el
+++ b/lisp/repeat.el
@@ -176,7 +176,7 @@ that variable on the theory they're doing more good than harm; `repeat' does
that, and usually does do more good than harm. However, like all do-gooders,
sometimes `repeat' gets surprising results from its altruism. The value of
this function is always whether the value of `this-command' would've been
-'repeat if `repeat' hadn't modified it."
+`repeat' if `repeat' hadn't modified it."
(= repeat-num-input-keys-at-repeat num-input-keys))
;; An example of the use of (repeat-is-really-this-command) may still be
@@ -368,8 +368,8 @@ When non-nil and the last typed key (with or without modifiers)
doesn't exist in the keymap attached by the `repeat-map' property,
then don't activate that keymap for the next command. So only the
same keys among repeatable keys are allowed in the repeating sequence.
-For example, with a non-nil value, only `C-x u u' repeats undo,
-whereas `C-/ u' doesn't.
+For example, with a non-nil value, only \\`C-x u u' repeats undo,
+whereas \\`C-/ u' doesn't.
You can also set the property `repeat-check-key' on the command symbol.
This property can override the value of this variable.
@@ -500,14 +500,17 @@ See `describe-repeat-maps' for a list of all repeatable commands."
(defun repeat-echo-message-string (keymap)
"Return a string with a list of repeating keys."
(let (keys)
- (map-keymap (lambda (key _) (push key keys)) keymap)
+ (map-keymap (lambda (key cmd) (and cmd (push key keys))) keymap)
(format-message "Repeat with %s%s"
(mapconcat (lambda (key)
- (key-description (vector key)))
+ (substitute-command-keys
+ (format "\\`%s'"
+ (key-description (vector key)))))
keys ", ")
(if repeat-exit-key
- (format ", or exit with %s"
- (key-description repeat-exit-key))
+ (substitute-command-keys
+ (format ", or exit with \\`%s'"
+ (key-description repeat-exit-key)))
""))))
(defun repeat-echo-message (keymap)
@@ -546,31 +549,39 @@ See `describe-repeat-maps' for a list of all repeatable commands."
Used in `repeat-mode'."
(interactive)
(require 'help-fns)
- (help-setup-xref (list #'describe-repeat-maps)
- (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 "A list of keymaps used by commands with the symbol property `repeat-map'.\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))
- (let* ((info (help-fns--analyze-function command))
- (map (list (symbol-value (car keymap))))
- (desc (mapconcat (lambda (key)
- (format-message "`%s'" (key-description key)))
- (or (where-is-internal command map)
- (where-is-internal (nth 3 info) map))
- ", ")))
- (princ (format-message " `%s' (bound to %s)\n" command desc))))
- (princ "\n"))))))
+ (let ((help-buffer-under-preparation t))
+ (help-setup-xref (list #'describe-repeat-maps)
+ (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
+ (insert "A list of keymaps used by commands with the symbol property `repeat-map'.\n\n")
+
+ (dolist (keymap (sort keymaps (lambda (a b)
+ (when (and (symbolp (car a))
+ (symbolp (car b)))
+ (string-lessp (car a) (car b))))))
+ (insert (format-message
+ "`%s' keymap is repeatable by these commands:\n"
+ (car keymap)))
+ (dolist (command (sort (cdr keymap) #'string-lessp))
+ (let* ((info (help-fns--analyze-function command))
+ (map (list (if (symbolp (car keymap))
+ (symbol-value (car keymap))
+ (car keymap))))
+ (desc (mapconcat (lambda (key)
+ (propertize (key-description key)
+ 'face 'help-key-binding))
+ (or (where-is-internal command map)
+ (where-is-internal (nth 3 info) map))
+ ", ")))
+ (insert (format-message " `%s' (bound to %s)\n" command desc))))
+ (insert "\n")))))))
(provide 'repeat)