diff options
| author | Basil L. Contovounesios | 2018-04-29 15:37:45 +0100 |
|---|---|---|
| committer | Noam Postavsky | 2018-05-02 20:18:07 -0400 |
| commit | f2c74543edc7e8d07655b459ba8898eec9b6d4e8 (patch) | |
| tree | b6612a1370f9c20399e8fa32ff50be643a0ecabd /test/src | |
| parent | 05e9477ab5d5dba1b960415d60b9957caa90da48 (diff) | |
| download | emacs-f2c74543edc7e8d07655b459ba8898eec9b6d4e8.tar.gz emacs-f2c74543edc7e8d07655b459ba8898eec9b6d4e8.zip | |
Fix off-by-one history pruning (bug#31211)
* lisp/subr.el (add-to-history): Clarify docstring.
Protect against negative history-length and unnecessary variable
modification, as per read_minibuf.
* lisp/ido.el (ido-record-command):
* lisp/international/mule-cmds.el (deactivate-input-method):
(set-language-environment-input-method):
* lisp/isearch.el (isearch-done):
* lisp/minibuffer.el (read-file-name-default):
* lisp/net/eww.el (eww-save-history):
* lisp/simple.el (edit-and-eval-command, repeat-complex-command):
(command-execute, kill-new, push-mark):
* src/callint.c (Fcall_interactively):
* src/minibuf.c (read_minibuf): Delegate to add-to-history.
* test/lisp/simple-tests.el (command-execute-prune-command-history):
* test/src/callint-tests.el
(call-interactively-prune-command-history): New tests.
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/callint-tests.el | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/src/callint-tests.el b/test/src/callint-tests.el index 9a812223ad0..feee9b692b7 100644 --- a/test/src/callint-tests.el +++ b/test/src/callint-tests.el | |||
| @@ -43,4 +43,12 @@ | |||
| 43 | (list a b)))) | 43 | (list a b)))) |
| 44 | '("a" "b")))) | 44 | '("a" "b")))) |
| 45 | 45 | ||
| 46 | (ert-deftest call-interactively-prune-command-history () | ||
| 47 | "Check that Bug#31211 is fixed." | ||
| 48 | (let ((history-length 1) | ||
| 49 | (command-history ())) | ||
| 50 | (dotimes (_ (1+ history-length)) | ||
| 51 | (call-interactively #'ignore t)) | ||
| 52 | (should (= (length command-history) history-length)))) | ||
| 53 | |||
| 46 | ;;; callint-tests.el ends here | 54 | ;;; callint-tests.el ends here |