aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuri Linkov2021-12-01 19:41:37 +0200
committerJuri Linkov2021-12-01 19:41:37 +0200
commit334ff0232e07dad2ff5595b7f85c0f6f5efcb11c (patch)
tree77aa1fd7992de2b06a3f07d6f6f90b4bc1c2f396
parent8230a47ecc8c11f518ee20a9055c0c27339a6730 (diff)
downloademacs-334ff0232e07dad2ff5595b7f85c0f6f5efcb11c.tar.gz
emacs-334ff0232e07dad2ff5595b7f85c0f6f5efcb11c.zip
* lisp/repeat.el: Use same logic for repeat-check-key and repeat-exit-timeout.
* lisp/repeat.el (repeat-check-key): Use for repeat-check-key the same logic as is used for repeat-exit-timeout in repeat-post-hook (bug#51390). (repeat-post-hook): Check for repeat-exit-timeout symbol property.
-rw-r--r--lisp/repeat.el27
1 files changed, 16 insertions, 11 deletions
diff --git a/lisp/repeat.el b/lisp/repeat.el
index 664a4d68ec6..308ba46a265 100644
--- a/lisp/repeat.el
+++ b/lisp/repeat.el
@@ -345,7 +345,9 @@ For example, you can set it to <return> like `isearch-exit'."
345(defcustom repeat-exit-timeout nil 345(defcustom repeat-exit-timeout nil
346 "Break the repetition chain of keys after specified timeout. 346 "Break the repetition chain of keys after specified timeout.
347When a number, exit the transient repeating mode after idle time 347When a number, exit the transient repeating mode after idle time
348of the specified number of seconds." 348of the specified number of seconds.
349You can also set the property `repeat-exit-timeout' on the command symbol.
350This property can override the value of this variable."
349 :type '(choice (const :tag "No timeout to exit repeating sequence" nil) 351 :type '(choice (const :tag "No timeout to exit repeating sequence" nil)
350 (number :tag "Timeout in seconds to exit repeating")) 352 (number :tag "Timeout in seconds to exit repeating"))
351 :group 'convenience 353 :group 'convenience
@@ -431,8 +433,9 @@ See `describe-repeat-maps' for a list of all repeatable commands."
431 433
432(defun repeat-check-key (key map) 434(defun repeat-check-key (key map)
433 "Check if the last key is suitable to activate the repeating MAP." 435 "Check if the last key is suitable to activate the repeating MAP."
434 (let ((property (repeat--command-property 'repeat-check-key))) 436 (let* ((prop (repeat--command-property 'repeat-check-key))
435 (or (if repeat-check-key (eq property 'no) (not (eq property t))) 437 (check-key (unless (eq prop 'no) (or prop repeat-check-key))))
438 (or (not check-key)
436 (lookup-key map (vector key)) 439 (lookup-key map (vector key))
437 ;; Try without modifiers: 440 ;; Try without modifiers:
438 (lookup-key map (vector (event-basic-type key)))))) 441 (lookup-key map (vector (event-basic-type key))))))
@@ -475,14 +478,16 @@ See `describe-repeat-maps' for a list of all repeatable commands."
475 (cancel-timer repeat-exit-timer) 478 (cancel-timer repeat-exit-timer)
476 (setq repeat-exit-timer nil)) 479 (setq repeat-exit-timer nil))
477 480
478 (when repeat-exit-timeout 481 (let* ((prop (repeat--command-property 'repeat-exit-timeout))
479 (setq repeat-exit-timer 482 (timeout (unless (eq prop 'no) (or prop repeat-exit-timeout))))
480 (run-with-idle-timer 483 (when timeout
481 repeat-exit-timeout nil 484 (setq repeat-exit-timer
482 (lambda () 485 (run-with-idle-timer
483 (setq repeat-in-progress nil) 486 timeout nil
484 (funcall exitfun) 487 (lambda ()
485 (funcall repeat-echo-function nil))))))))))) 488 (setq repeat-in-progress nil)
489 (funcall exitfun)
490 (funcall repeat-echo-function nil))))))))))))
486 491
487 (setq repeat-map nil) 492 (setq repeat-map nil)
488 (setq repeat--prev-mb (cons (minibuffer-depth) current-minibuffer-command)) 493 (setq repeat--prev-mb (cons (minibuffer-depth) current-minibuffer-command))