summaryrefslogtreecommitdiff
path: root/lisp/repeat.el
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2021-04-12 19:14:45 +0300
committerJuri Linkov <juri@linkov.net>2021-04-12 19:14:45 +0300
commited4b51962ea5494b92e0d078916558cab27a836a (patch)
tree3d065b5652fd05c3e2422d2b2093ac39bb2cd270 /lisp/repeat.el
parent632fd8079ddc3badd86d09a9770d617be78f5fac (diff)
downloademacs-ed4b51962ea5494b92e0d078916558cab27a836a.tar.gz
* lisp/repeat.el (repeat-mode-echo): New defcustom.
(repeat-post-hook): Use it. (repeat-mode-message): New function (bug#47566). (repeat-post-hook): Use real-this-command instead of this-command to handle e.g. rectangle-exchange-point-and-mark remapped to exchange-point-and-mark (bug#47688).
Diffstat (limited to 'lisp/repeat.el')
-rw-r--r--lisp/repeat.el25
1 files changed, 20 insertions, 5 deletions
diff --git a/lisp/repeat.el b/lisp/repeat.el
index b3c58f2f818..f1b20d369bf 100644
--- a/lisp/repeat.el
+++ b/lisp/repeat.el
@@ -348,6 +348,17 @@ For example, you can set it to <return> like `isearch-exit'."
:group 'convenience
:version "28.1")
+(defcustom repeat-mode-echo #'repeat-mode-message
+ "Function to display a hint about available keys.
+Function is called after every repeatable command with one argument:
+a string with a list of keys."
+ :type '(choice (const :tag "Show hints in the echo area"
+ repeat-mode-message)
+ (const :tag "Don't show hints" ignore)
+ (function :tag "Function"))
+ :group 'convenience
+ :version "28.1")
+
;;;###autoload
(defvar repeat-map nil
"The value of the repeating map for the next command.
@@ -377,8 +388,8 @@ When Repeat mode is enabled, and the command symbol has the property named
"Function run after commands to set transient keymap for repeatable keys."
(when repeat-mode
(let ((rep-map (or repeat-map
- (and (symbolp this-command)
- (get this-command 'repeat-map)))))
+ (and (symbolp real-this-command)
+ (get real-this-command 'repeat-map)))))
(when rep-map
(when (boundp rep-map)
(setq rep-map (symbol-value rep-map)))
@@ -403,9 +414,7 @@ When Repeat mode is enabled, and the command symbol has the property named
(format ", or exit with %s"
(key-description repeat-exit-key))
""))))
- (if (current-message)
- (message "%s [%s]" (current-message) mess)
- (message mess))))
+ (funcall repeat-mode-echo mess)))
;; Adding an exit key
(when repeat-exit-key
@@ -417,6 +426,12 @@ When Repeat mode is enabled, and the command symbol has the property named
(set-transient-map map))))))
(setq repeat-map nil))
+(defun repeat-mode-message (mess)
+ "Function that displays available repeating keys in the echo area."
+ (if (current-message)
+ (message "%s [%s]" (current-message) mess)
+ (message mess)))
+
(provide 'repeat)
;;; repeat.el ends here