diff options
| author | Richard M. Stallman | 2007-10-24 08:15:03 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2007-10-24 08:15:03 +0000 |
| commit | 648db50deae4ed3add8a5665a749858dd7753f64 (patch) | |
| tree | 2b8a425aaf2e61a9984db72c4d06b88e14d9bad1 | |
| parent | 8ed7fe5cf40becaa68d3bcdffe1c167c13c4918a (diff) | |
| download | emacs-648db50deae4ed3add8a5665a749858dd7753f64.tar.gz emacs-648db50deae4ed3add8a5665a749858dd7753f64.zip | |
(savehist-save): Omit unreadable elements.
| -rw-r--r-- | lisp/ChangeLog | 13 | ||||
| -rw-r--r-- | lisp/savehist.el | 38 |
2 files changed, 47 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bcde6b0efc8..b45014057b8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,16 @@ | |||
| 1 | 2007-10-24 Richard Stallman <rms@gnu.org> | ||
| 2 | |||
| 3 | * savehist.el (savehist-save): Omit unreadable elements. | ||
| 4 | |||
| 5 | * loadhist.el (unload-function-defs-list): Renamed from | ||
| 6 | unload-function-features-list. | ||
| 7 | (unload-feature-special-hooks, unload-feature): Doc fixes. | ||
| 8 | |||
| 9 | * indent.el (indent-to-left-margin): If point's in the indentation, | ||
| 10 | move to the end of the indentation. | ||
| 11 | |||
| 12 | * cus-edit.el (customize-changed-options): Make arg optional. | ||
| 13 | |||
| 1 | 2007-10-24 Juanma Barranquero <lekktu@gmail.com> | 14 | 2007-10-24 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 15 | ||
| 3 | * bs.el (bs-select, bs-select-other-window): Fix typos in docstrings. | 16 | * bs.el (bs-select, bs-select-other-window): Fix typos in docstrings. |
diff --git a/lisp/savehist.el b/lisp/savehist.el index 83b46e5e04f..b28bd476933 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, | |||
| 309 | (insert ?\n) | 309 | (insert ?\n) |
| 310 | (dolist (symbol savehist-minibuffer-history-variables) | 310 | (dolist (symbol savehist-minibuffer-history-variables) |
| 311 | (when (boundp symbol) | 311 | (when (boundp symbol) |
| 312 | (let ((value (savehist-trim-history (symbol-value symbol)))) | 312 | (let ((value (savehist-trim-history (symbol-value symbol))) |
| 313 | (when value ; don't save empty histories | 313 | excess-space) |
| 314 | (prin1 `(setq ,symbol ',value) (current-buffer)) | 314 | (when value ; Don't save empty histories. |
| 315 | (insert ?\n)))))) | 315 | (insert "(setq ") |
| 316 | (prin1 symbol (current-buffer)) | ||
| 317 | (insert " '(") | ||
| 318 | ;; We will print an extra space before the first element. | ||
| 319 | ;; Record where that is. | ||
| 320 | (setq excess-space (point)) | ||
| 321 | ;; Print elements of VALUE one by one, carefully. | ||
| 322 | (dolist (elt value) | ||
| 323 | (let ((start (point))) | ||
| 324 | (insert " ") | ||
| 325 | (prin1 elt (current-buffer)) | ||
| 326 | ;; Try to read the element we just printed. | ||
| 327 | (condition-case nil | ||
| 328 | (save-excursion | ||
| 329 | (goto-char start) | ||
| 330 | (read (current-buffer))) | ||
| 331 | (error | ||
| 332 | ;; If reading it gets an error, comment it out. | ||
| 333 | (goto-char start) | ||
| 334 | (insert "\n") | ||
| 335 | (while (not (eobp)) | ||
| 336 | (insert ";;; ") | ||
| 337 | (forward-line 1)) | ||
| 338 | (insert "\n"))) | ||
| 339 | (goto-char (point-max)))) | ||
| 340 | ;; Delete the extra space before the first element. | ||
| 341 | (save-excursion | ||
| 342 | (goto-char excess-space) | ||
| 343 | (if (eq (following-char) ?\s) | ||
| 344 | (delete-region (point) (1+ (point))))) | ||
| 345 | (insert "))\n")))))) | ||
| 316 | ;; Save the additional variables. | 346 | ;; Save the additional variables. |
| 317 | (dolist (symbol savehist-additional-variables) | 347 | (dolist (symbol savehist-additional-variables) |
| 318 | (when (boundp symbol) | 348 | (when (boundp symbol) |