diff options
| author | Tino Calancha | 2020-09-12 14:14:45 +0200 |
|---|---|---|
| committer | Tino Calancha | 2020-09-17 16:32:18 +0200 |
| commit | 23a3333b3ef0768f48f64f382ee899050b6103be (patch) | |
| tree | c856800e7fdefb5fe11844738cd49294d09de08b /test/src | |
| parent | cd151d06084bff6fa9ba48f8fa13b6bf24e8778c (diff) | |
| download | emacs-23a3333b3ef0768f48f64f382ee899050b6103be.tar.gz emacs-23a3333b3ef0768f48f64f382ee899050b6103be.zip | |
Give Lisp control on the lossage size
Add a command 'lossage-size' to set the maximum
number or recorded keystrokes (Bug#38796).
* src/keyboard.c (lossage_limit):
Static variable with the current lossage size limit.
(MIN_NUM_RECENT_KEYS): Renamed from NUM_RECENT_KEYS.
Set it as 100 and use it as the minimum value for lossage_limit.
Keep the same default for the vector size as before (300).
(lossage-size): New command.
(update_recent_keys): Helper function.
(command_loop_1)
(record_char)
(recent-keys)
(syms_of_keyboard): Use lossage_limit as the vector size.
* lisp/help.el (view-lossage): Mention the new command in the docstring.
* etc/NEWS (Changes in Emacs 28.1): Announce this change.
* doc/emacs/help.texi (Misc Help): Update manual.
* test/src/keyboard-tests.el (keyboard-lossage-size): Add test.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/keyboard-tests.el | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/src/keyboard-tests.el b/test/src/keyboard-tests.el index 1988ba51a76..970a53555f9 100644 --- a/test/src/keyboard-tests.el +++ b/test/src/keyboard-tests.el | |||
| @@ -32,5 +32,20 @@ | |||
| 32 | (read-event nil nil 2)) | 32 | (read-event nil nil 2)) |
| 33 | ?\C-b))) | 33 | ?\C-b))) |
| 34 | 34 | ||
| 35 | (ert-deftest keyboard-lossage-size () | ||
| 36 | "Test `lossage-size'." | ||
| 37 | (let ((min-value 100) | ||
| 38 | (lossage-orig (lossage-size))) | ||
| 39 | (dolist (factor (list 1 3 4 5 10 7 3)) | ||
| 40 | (let ((new-lossage (* factor min-value))) | ||
| 41 | (should (= new-lossage (lossage-size new-lossage))))) | ||
| 42 | ;; Wrong type | ||
| 43 | (should-error (lossage-size -5)) | ||
| 44 | (should-error (lossage-size "200")) | ||
| 45 | ;; Less that minimum value | ||
| 46 | (should-error (lossage-size (1- min-value))) | ||
| 47 | (should (= lossage-orig (lossage-size lossage-orig))))) | ||
| 48 | |||
| 49 | |||
| 35 | (provide 'keyboard-tests) | 50 | (provide 'keyboard-tests) |
| 36 | ;;; keyboard-tests.el ends here | 51 | ;;; keyboard-tests.el ends here |