]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/repeat.el (repeat-mode): Use 'called-interactively-p'.
authorJuri Linkov <juri@linkov.net>
Wed, 23 Jul 2025 17:56:05 +0000 (20:56 +0300)
committerEshel Yaron <me@eshelyaron.com>
Fri, 25 Jul 2025 08:12:41 +0000 (10:12 +0200)
This logic is copied from 'define-minor-mode' that displays a message
about mode activation only when called interactively (bug#79081).

(cherry picked from commit 128e8311be5b2c65a106fe4ee96056751d600b0d)

lisp/repeat.el

index 191e335ae2465a5321376676441189b7119b58af..3fd76aa8700005f4be3c3b5a3d651e5490257e54 100644 (file)
@@ -446,15 +446,18 @@ See `describe-repeat-maps' for a list of all repeatable commands."
     (when repeat-keep-prefix
       (add-hook 'pre-command-hook 'repeat-pre-hook))
     (add-hook 'post-command-hook 'repeat-post-hook)
-    (let* ((keymaps nil)
-           (commands (all-completions
-                      "" obarray (lambda (s)
-                                   (and (commandp s)
-                                        (get s 'repeat-map)
-                                        (push (get s 'repeat-map) keymaps))))))
-      (message "Repeat mode is enabled for %d commands and %d keymaps; see `describe-repeat-maps'"
-               (length commands)
-               (length (delete-dups keymaps))))))
+    (when (called-interactively-p 'any)
+      (let* ((keymaps nil)
+             (commands (all-completions
+                        "" obarray
+                        (lambda (s)
+                          (and (commandp s)
+                               (get s 'repeat-map)
+                               (push (get s 'repeat-map) keymaps))))))
+        (message "Repeat mode is enabled for %d commands and %d keymaps; \
+see `describe-repeat-maps'"
+                 (length commands)
+                 (length (delete-dups keymaps)))))))
 
 (defun repeat--command-property (property)
   (or (and (symbolp this-command)