diff options
| author | Juri Linkov | 2021-11-30 21:05:05 +0200 |
|---|---|---|
| committer | Juri Linkov | 2021-11-30 21:07:18 +0200 |
| commit | ea5a90b4f47f008a3e2dd58cda5a6b771fb80403 (patch) | |
| tree | 54f96b17219b166eeba477e78e56abf7e8df83fe /test | |
| parent | ef4954b69c17831f4c8360c436352170305666ea (diff) | |
| download | emacs-ea5a90b4f47f008a3e2dd58cda5a6b771fb80403.tar.gz emacs-ea5a90b4f47f008a3e2dd58cda5a6b771fb80403.zip | |
* lisp/repeat.el: Fix long-standing problem when a random key activates map
* lisp/repeat.el (repeat-check-key): New defcustom (bug#51390).
(repeat--command-property): New internal function.
(repeat-check-key): New function.
(repeat-post-hook): Use repeat--command-property and repeat-check-key.
* test/lisp/repeat-tests.el (repeat-tests-check-key): New test.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/repeat-tests.el | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/lisp/repeat-tests.el b/test/lisp/repeat-tests.el index 76abd24ea2f..02d9ddbc96e 100644 --- a/test/lisp/repeat-tests.el +++ b/test/lisp/repeat-tests.el | |||
| @@ -37,6 +37,8 @@ | |||
| 37 | (defvar repeat-tests-map | 37 | (defvar repeat-tests-map |
| 38 | (let ((map (make-sparse-keymap))) | 38 | (let ((map (make-sparse-keymap))) |
| 39 | (define-key map (kbd "C-x w a") 'repeat-tests-call-a) | 39 | (define-key map (kbd "C-x w a") 'repeat-tests-call-a) |
| 40 | (define-key map (kbd "M-C-a") 'repeat-tests-call-a) | ||
| 41 | (define-key map (kbd "M-C-z") 'repeat-tests-call-a) | ||
| 40 | map) | 42 | map) |
| 41 | "Keymap for keys that initiate repeating sequences.") | 43 | "Keymap for keys that initiate repeating sequences.") |
| 42 | 44 | ||
| @@ -70,6 +72,38 @@ | |||
| 70 | ;; Check for self-inserting keys | 72 | ;; Check for self-inserting keys |
| 71 | (should (equal (buffer-string) inserted))) | 73 | (should (equal (buffer-string) inserted))) |
| 72 | 74 | ||
| 75 | (ert-deftest repeat-tests-check-key () | ||
| 76 | (with-repeat-mode | ||
| 77 | (let ((repeat-echo-function 'ignore)) | ||
| 78 | (let ((repeat-check-key t)) | ||
| 79 | (repeat-tests--check | ||
| 80 | "C-x w a b a c" | ||
| 81 | '((1 a) (1 b) (1 a)) "c") | ||
| 82 | (repeat-tests--check | ||
| 83 | "M-C-a b a c" | ||
| 84 | '((1 a) (1 b) (1 a)) "c") | ||
| 85 | (repeat-tests--check | ||
| 86 | "M-C-z b a c" | ||
| 87 | '((1 a)) "bac") | ||
| 88 | (unwind-protect | ||
| 89 | (progn | ||
| 90 | (put 'repeat-tests-call-a 'repeat-check-key 'no) | ||
| 91 | (repeat-tests--check | ||
| 92 | "M-C-z b a c" | ||
| 93 | '((1 a) (1 b) (1 a)) "c")) | ||
| 94 | (put 'repeat-tests-call-a 'repeat-check-key nil))) | ||
| 95 | (let ((repeat-check-key nil)) | ||
| 96 | (repeat-tests--check | ||
| 97 | "M-C-z b a c" | ||
| 98 | '((1 a) (1 b) (1 a)) "c") | ||
| 99 | (unwind-protect | ||
| 100 | (progn | ||
| 101 | (put 'repeat-tests-call-a 'repeat-check-key t) | ||
| 102 | (repeat-tests--check | ||
| 103 | "M-C-z b a c" | ||
| 104 | '((1 a)) "bac")) | ||
| 105 | (put 'repeat-tests-call-a 'repeat-check-key nil)))))) | ||
| 106 | |||
| 73 | (ert-deftest repeat-tests-exit-key () | 107 | (ert-deftest repeat-tests-exit-key () |
| 74 | (with-repeat-mode | 108 | (with-repeat-mode |
| 75 | (let ((repeat-echo-function 'ignore)) | 109 | (let ((repeat-echo-function 'ignore)) |