summaryrefslogtreecommitdiffhomepage
path: root/attic
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-10-06 06:23:42 +0100
committerjao <jao@gnu.org>2022-10-06 06:25:22 +0100
commitcad941cca575d0f38c9668e3f5c69fc33dd3b24d (patch)
treebcd44adaaef0240d6d467eb7897091fadcede52a /attic
parent476028d5114de399528e69bdbd12ad664f8c60db (diff)
downloadelibs-cad941cca575d0f38c9668e3f5c69fc33dd3b24d.tar.gz
elibs-cad941cca575d0f38c9668e3f5c69fc33dd3b24d.tar.bz2
gnus adjustments
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))