Function: savehist--reload
savehist--reload is a byte-compiled function defined in
savehist.el.gz.
Signature
(savehist--reload INTERACTIVELY)
Documentation
Load the history data from savehist-file.
Be careful to do it while preserving the current history data.
Source Code
;; Defined in /usr/src/emacs/lisp/savehist.el.gz
(defun savehist--reload (interactively)
"Load the history data from `savehist-file'.
Be careful to do it while preserving the current history data."
(when (and (file-exists-p savehist-file)
(not (and savehist-loaded
(equal savehist--file-sync-modtime
(savehist--file-modtime)))))
;; FIXME: Process the file manually rather than passing it to `load'.
(let ((savehist-old-minibuffer-history-variables
(delq nil (mapcar (lambda (s)
(and (boundp s) (cons s (symbol-value s))))
(cons 'savehist-minibuffer-history-variables
savehist-minibuffer-history-variables)))))
(condition-case errvar
(progn
;; Don't set coding-system-for-read -- we rely on the
;; coding cookie to convey that information. That way, if
;; the user changes the value of savehist-coding-system,
;; we can still correctly load the old file.
(let ((warning-inhibit-types '((files missing-lexbind-cookie))))
(load savehist-file nil
(not interactively)))
(setq savehist--file-sync-modtime (savehist--file-modtime))
(setq savehist-loaded t))
(error
;; Don't install the mode if reading failed. Doing so would
;; effectively destroy the user's data at the next save.
(setq savehist-mode nil)
(savehist-uninstall)
(signal (car errvar) (cdr errvar))))
;; In case we're loading the file late, there was info in the history
;; variables that may have been overwritten by the info extracted from
;; the file, so put it back in.
(pcase-dolist (`(,s . ,v) savehist-old-minibuffer-history-variables)
;; 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.
(unless (equal v (symbol-value s))
(set s (savehist--merge v (symbol-value s)))))))))