diff options
| author | Karl Fogel | 2000-12-13 22:56:38 +0000 |
|---|---|---|
| committer | Karl Fogel | 2000-12-13 22:56:38 +0000 |
| commit | 6192b604c1c9f23f5f3e7647fbb16ddff53e8d2a (patch) | |
| tree | 5e57ad21b6042cc9bcd0920419fa7c1321f1532c | |
| parent | bf6282d22234e137a23714de3f0d7c96a415765c (diff) | |
| download | emacs-6192b604c1c9f23f5f3e7647fbb16ddff53e8d2a.tar.gz emacs-6192b604c1c9f23f5f3e7647fbb16ddff53e8d2a.zip | |
* bookmark.el: Provide a generic exit hook, as suggested by Ovidiu
Predescu <ovidiu@cup.hp.com>:
(bookmark-exit-hook): new var.
(bookmark-exit-hook-internal): new func, replaces old raw lambda form
in `kill-emacs-hook', and runs new `bookmark-exit-hooks'. No longer
tests for the bookmark feature, as logically that feature must have
been provided if this function is running.
Removed ;;;###autoload before the `add-hook' call.
| -rw-r--r-- | lisp/ChangeLog | 12 | ||||
| -rw-r--r-- | lisp/bookmark.el | 26 |
2 files changed, 28 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3e028b60e43..72693deffd3 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,15 @@ | |||
| 1 | 2000-12-13 Karl Fogel <kfogel@red-bean.com> | ||
| 2 | |||
| 3 | * bookmark.el: Provide a generic exit hook, as suggested by | ||
| 4 | Ovidiu Predescu <ovidiu@cup.hp.com>: | ||
| 5 | (bookmark-exit-hook): new var. | ||
| 6 | (bookmark-exit-hook-internal): new func, replaces | ||
| 7 | old raw lambda form in `kill-emacs-hook', and runs new | ||
| 8 | `bookmark-exit-hooks'. No longer tests for the bookmark feature, | ||
| 9 | as logically that feature must have been provided if this function | ||
| 10 | is running. | ||
| 11 | Removed ;;;###autoload before the `add-hook' call. | ||
| 12 | |||
| 1 | 2000-12-13 Stefan Monnier <monnier@cs.yale.edu> | 13 | 2000-12-13 Stefan Monnier <monnier@cs.yale.edu> |
| 2 | 14 | ||
| 3 | * emacs-lisp/easymenu.el (easy-menu-define): Setup indentation. | 15 | * emacs-lisp/easymenu.el (easy-menu-define): Setup indentation. |
diff --git a/lisp/bookmark.el b/lisp/bookmark.el index 1aaefcba15a..31bd50a2bc6 100644 --- a/lisp/bookmark.el +++ b/lisp/bookmark.el | |||
| @@ -300,16 +300,6 @@ So the cdr of each bookmark is an alist too. | |||
| 300 | (defvar bookmarks-already-loaded nil) | 300 | (defvar bookmarks-already-loaded nil) |
| 301 | 301 | ||
| 302 | 302 | ||
| 303 | ;; just add the hook to make sure that people don't lose bookmarks | ||
| 304 | ;; when they kill Emacs, unless they don't want to save them. | ||
| 305 | ;;;###autoload | ||
| 306 | (add-hook 'kill-emacs-hook | ||
| 307 | (function | ||
| 308 | (lambda () (and (featurep 'bookmark) | ||
| 309 | bookmark-alist | ||
| 310 | (bookmark-time-to-save-p t) | ||
| 311 | (bookmark-save))))) | ||
| 312 | |||
| 313 | ;; more stuff added by db. | 303 | ;; more stuff added by db. |
| 314 | 304 | ||
| 315 | (defvar bookmark-current-bookmark nil | 305 | (defvar bookmark-current-bookmark nil |
| @@ -2269,6 +2259,22 @@ corresponding bookmark function from Lisp \(the one without the | |||
| 2269 | (defvar bookmark-load-hook nil | 2259 | (defvar bookmark-load-hook nil |
| 2270 | "Hook to run at the end of loading bookmark.") | 2260 | "Hook to run at the end of loading bookmark.") |
| 2271 | 2261 | ||
| 2262 | ;;; Exit Hook, called from kill-emacs-hook | ||
| 2263 | (defvar bookmark-exit-hook nil | ||
| 2264 | "Hook to run when emacs exits") | ||
| 2265 | |||
| 2266 | (defun bookmark-exit-hook-internal () | ||
| 2267 | "Save bookmark state, if necessary, at Emacs exit time. | ||
| 2268 | This also runs `bookmark-exit-hooks'." | ||
| 2269 | (and | ||
| 2270 | (progn (run-hooks 'bookmark-exit-hooks) t) | ||
| 2271 | bookmark-alist | ||
| 2272 | (bookmark-time-to-save-p t) | ||
| 2273 | (bookmark-save))) | ||
| 2274 | |||
| 2275 | (add-hook 'kill-emacs-hook 'bookmark-exit-hook-internal) | ||
| 2276 | |||
| 2277 | |||
| 2272 | (run-hooks 'bookmark-load-hook) | 2278 | (run-hooks 'bookmark-load-hook) |
| 2273 | 2279 | ||
| 2274 | (provide 'bookmark) | 2280 | (provide 'bookmark) |