aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorKarl Fogel <[email protected]>2000-12-13 22:56:38 +0000
committerKarl Fogel <[email protected]>2000-12-13 22:56:38 +0000
commit6192b604c1c9f23f5f3e7647fbb16ddff53e8d2a (patch)
tree5e57ad21b6042cc9bcd0920419fa7c1321f1532c /lisp
parentbf6282d22234e137a23714de3f0d7c96a415765c (diff)
* bookmark.el: Provide a generic exit hook, as suggested by Ovidiu
Predescu <[email protected]>: (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.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog12
-rw-r--r--lisp/bookmark.el26
2 files changed, 28 insertions, 10 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3e028b60e4..72693deffd 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,15 @@
+2000-12-13 Karl Fogel <[email protected]>
+
+ * bookmark.el: Provide a generic exit hook, as suggested by
+ Ovidiu Predescu <[email protected]>:
+ (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.
+
2000-12-13 Stefan Monnier <[email protected]>
* emacs-lisp/easymenu.el (easy-menu-define): Setup indentation.
diff --git a/lisp/bookmark.el b/lisp/bookmark.el
index 1aaefcba15..31bd50a2bc 100644
--- a/lisp/bookmark.el
+++ b/lisp/bookmark.el
@@ -300,16 +300,6 @@ So the cdr of each bookmark is an alist too.
(defvar bookmarks-already-loaded nil)
-;; just add the hook to make sure that people don't lose bookmarks
-;; when they kill Emacs, unless they don't want to save them.
-;;;###autoload
-(add-hook 'kill-emacs-hook
- (function
- (lambda () (and (featurep 'bookmark)
- bookmark-alist
- (bookmark-time-to-save-p t)
- (bookmark-save)))))
-
;; more stuff added by db.
(defvar bookmark-current-bookmark nil
@@ -2269,6 +2259,22 @@ corresponding bookmark function from Lisp \(the one without the
(defvar bookmark-load-hook nil
"Hook to run at the end of loading bookmark.")
+;;; Exit Hook, called from kill-emacs-hook
+(defvar bookmark-exit-hook nil
+ "Hook to run when emacs exits")
+
+(defun bookmark-exit-hook-internal ()
+ "Save bookmark state, if necessary, at Emacs exit time.
+This also runs `bookmark-exit-hooks'."
+ (and
+ (progn (run-hooks 'bookmark-exit-hooks) t)
+ bookmark-alist
+ (bookmark-time-to-save-p t)
+ (bookmark-save)))
+
+(add-hook 'kill-emacs-hook 'bookmark-exit-hook-internal)
+
+
(run-hooks 'bookmark-load-hook)
(provide 'bookmark)