summaryrefslogtreecommitdiffhomepage
path: root/attic
diff options
context:
space:
mode:
Diffstat (limited to 'attic')
-rw-r--r--attic/elisp/misc.el26
1 files changed, 26 insertions, 0 deletions
diff --git a/attic/elisp/misc.el b/attic/elisp/misc.el
index a74349c..fec2c41 100644
--- a/attic/elisp/misc.el
+++ b/attic/elisp/misc.el
@@ -318,6 +318,32 @@
(gnus-server-exit)
(message "Restarting all servers... done"))
+;;;; startup and kill
+;; close gnus when closing emacs, but ask when exiting
+(setq gnus-interactive-exit t)
+
+(defun jao-gnus-started-hook ()
+ (add-hook 'before-kill-emacs-hook 'gnus-group-exit))
+
+(add-hook 'gnus-started-hook 'jao-gnus-started-hook)
+
+(defun jao-gnus-after-exiting-hook ()
+ (remove-hook 'before-kill-emacs-hook 'gnus-group-exit))
+
+(add-hook 'gnus-after-exiting-gnus-hook 'jao-gnus-after-exiting-hook)
+
+;; define a wrapper around the save-buffers-kill-emacs
+;; to run the new hook before:
+(advice-add 'save-buffers-kill-emacs :before (lambda ()
+ (run-hooks 'before-kill-emacs-hook)))
+
+(defadvice save-buffers-kill-emacs
+ (before my-save-buffers-kill-emacs activate)
+ "Install hook when emacs exits before emacs asks to save this and that."
+ (run-hooks 'before-kill-emacs-hook))
+
+(advice-remove 'ad-Advice-save-buffers-kill-emacs 'save-buffers-kill-emacs)
+
;;;; delayed expiry
(defvar jao-gnus--expire-every 50)
(defvar jao-gnus--get-count (1+ jao-gnus--expire-every))