1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-01-30 04:10:54 -08:00

(savehist-minibuffer-hook): Exclude uninterned history vars

* lisp/savehist.el (savehist--reload): Don't bother merging the value
of vars that were not changed.
(savehist-minibuffer-hook): Exclude uninterned history vars.
This commit is contained in:
Stefan Monnier 2025-04-20 10:10:17 -04:00
parent 6fb2a4691f
commit 2f2fbae882

View file

@ -243,7 +243,8 @@ Be careful to do it while preserving the current history data."
;; For each histvar that we knew about, make sure all the entries that
;; were there before are still here now and in the same order.
(with-demoted-errors "%S" ;Maybe some var is not a list or something.
(set s (savehist--merge v (symbol-value s))))))))
(unless (equal v (symbol-value s))
(set s (savehist--merge v (symbol-value s)))))))))
(defun savehist--file-modtime ()
(or (file-attribute-modification-time (file-attributes savehist-file))
@ -443,7 +444,12 @@ Does nothing if Savehist mode is off."
;; (which `read-password' does),
;; `minibuffer-history-variable' is bound to t to mean
;; "no history is being recorded".
(memq minibuffer-history-variable savehist-ignored-variables))
(memq minibuffer-history-variable savehist-ignored-variables)
;; Filter out uninterned history vars since we can't
;; reliably write+read them back in anyway (and presumably
;; they are not intended to survive sessions).
(not (eq (intern-soft minibuffer-history-variable)
minibuffer-history-variable)))
(add-to-list 'savehist-minibuffer-history-variables
minibuffer-history-variable)))