diff options
author | Miles Bader <miles@gnu.org> | 2007-10-27 09:07:17 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 2007-10-27 09:07:17 +0000 |
commit | fdc9061358d3654e14bfc1419632e1d6c6c5c13e (patch) | |
tree | 00f5484d576513deddd938a9a277d0db860b9a5b /lisp/savehist.el | |
parent | ebe4c71027cd6ec8583631e895e7fdd3decfc099 (diff) | |
parent | b6ff295c434269fe824ec47cbfc87c6a02dfd94d (diff) | |
download | emacs-fdc9061358d3654e14bfc1419632e1d6c6c5c13e.tar.gz emacs-fdc9061358d3654e14bfc1419632e1d6c6c5c13e.tar.bz2 emacs-fdc9061358d3654e14bfc1419632e1d6c6c5c13e.zip |
Merge from emacs--rel--22
Patches applied:
* emacs--rel--22 (patch 131-137)
- Update from CVS
- Merge from gnus--rel--5.10
* gnus--rel--5.10 (patch 261-262)
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--devo--0--patch-908
Diffstat (limited to 'lisp/savehist.el')
-rw-r--r-- | lisp/savehist.el | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/lisp/savehist.el b/lisp/savehist.el index 0b531b37f2b..7cc56842d4b 100644 --- a/lisp/savehist.el +++ b/lisp/savehist.el @@ -309,10 +309,40 @@ If AUTO-SAVE is non-nil, compare the saved contents to the one last saved, (insert ?\n) (dolist (symbol savehist-minibuffer-history-variables) (when (boundp symbol) - (let ((value (savehist-trim-history (symbol-value symbol)))) - (when value ; don't save empty histories - (prin1 `(setq ,symbol ',value) (current-buffer)) - (insert ?\n)))))) + (let ((value (savehist-trim-history (symbol-value symbol))) + excess-space) + (when value ; Don't save empty histories. + (insert "(setq ") + (prin1 symbol (current-buffer)) + (insert " '(") + ;; We will print an extra space before the first element. + ;; Record where that is. + (setq excess-space (point)) + ;; Print elements of VALUE one by one, carefully. + (dolist (elt value) + (let ((start (point))) + (insert " ") + (prin1 elt (current-buffer)) + ;; Try to read the element we just printed. + (condition-case nil + (save-excursion + (goto-char start) + (read (current-buffer))) + (error + ;; If reading it gets an error, comment it out. + (goto-char start) + (insert "\n") + (while (not (eobp)) + (insert ";;; ") + (forward-line 1)) + (insert "\n"))) + (goto-char (point-max)))) + ;; Delete the extra space before the first element. + (save-excursion + (goto-char excess-space) + (if (eq (following-char) ?\s) + (delete-region (point) (1+ (point))))) + (insert "))\n")))))) ;; Save the additional variables. (dolist (symbol savehist-additional-variables) (when (boundp symbol) |