aboutsummaryrefslogtreecommitdiffstats
path: root/lisp/net
diff options
context:
space:
mode:
authorBasil L. Contovounesios2018-04-29 15:37:45 +0100
committerNoam Postavsky2018-05-02 20:18:07 -0400
commitf2c74543edc7e8d07655b459ba8898eec9b6d4e8 (patch)
treeb6612a1370f9c20399e8fa32ff50be643a0ecabd /lisp/net
parent05e9477ab5d5dba1b960415d60b9957caa90da48 (diff)
downloademacs-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 'lisp/net')
-rw-r--r--lisp/net/eww.el10
1 files changed, 3 insertions, 7 deletions
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index e74f661ac75..97fdabd72bd 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -1813,13 +1813,9 @@ If CHARSET is nil then use UTF-8."
1813(defun eww-save-history () 1813(defun eww-save-history ()
1814 (plist-put eww-data :point (point)) 1814 (plist-put eww-data :point (point))
1815 (plist-put eww-data :text (buffer-string)) 1815 (plist-put eww-data :text (buffer-string))
1816 (push eww-data eww-history) 1816 (let ((history-delete-duplicates nil))
1817 (setq eww-data (list :title "")) 1817 (add-to-history 'eww-history eww-data eww-history-limit t))
1818 ;; Don't let the history grow infinitely. We store quite a lot of 1818 (setq eww-data (list :title "")))
1819 ;; data per page.
1820 (when-let* ((tail (and eww-history-limit
1821 (nthcdr eww-history-limit eww-history))))
1822 (setcdr tail nil)))
1823 1819
1824(defvar eww-current-buffer) 1820(defvar eww-current-buffer)
1825 1821