summaryrefslogtreecommitdiff
path: root/mu4e
diff options
context:
space:
mode:
authorDirk-Jan C. Binnema <djcb@djcbsoftware.nl>2025-10-11 22:19:12 +0300
committerDirk-Jan C. Binnema <djcb@djcbsoftware.nl>2025-10-11 22:19:12 +0300
commit0d1540bcf2e06e2b9e1282f21c50be8afd44c69c (patch)
tree90b8f155d97620a8c1334e11b0c41dc4b065e6dd /mu4e
parentacf861265b59ed6d3da77de12f1f62190ce49082 (diff)
mu4e: implement mu4e-quit-hook
As seen on r/emacs.
Diffstat (limited to 'mu4e')
-rw-r--r--mu4e/mu4e.el13
-rw-r--r--mu4e/mu4e.texi5
2 files changed, 14 insertions, 4 deletions
diff --git a/mu4e/mu4e.el b/mu4e/mu4e.el
index daaaa8d..16708aa 100644
--- a/mu4e/mu4e.el
+++ b/mu4e/mu4e.el
@@ -45,12 +45,22 @@
(require 'mu4e-notification)
(require 'mu4e-server) ;; communication with backend
-
(when mu4e-speedbar-support
(require 'mu4e-speedbar)) ;; support for speedbar
(when mu4e-org-support
(require 'mu4e-org)) ;; support for org-mode links
+(defcustom mu4e-quit-hook nil
+ "Hook run just before quitting mu4e.
+
+This hook runs just before mu4e performs its own cleanup.
+
+Note that it only fires when mu4e actually terminates; i.e.,
+`mu4e-quit' _without_ the \"bury-only\" parameter."
+ :type 'hook
+ :package-version '(mu4e . "1.12.14")
+ :group 'mu4e)
+
;; We can't properly use compose buffers that are revived using
;; desktop-save-mode; so let's turn that off.
(with-eval-after-load 'desktop
@@ -171,6 +181,7 @@ invoke FUNC (if available) afterwards."
(defun mu4e--stop ()
"Stop mu4e."
+ (run-hooks 'mu4e-quit-hook)
(when mu4e--update-timer
(cancel-timer mu4e--update-timer)
(setq mu4e--update-timer nil))
diff --git a/mu4e/mu4e.texi b/mu4e/mu4e.texi
index 8ba0258..9fe6046 100644
--- a/mu4e/mu4e.texi
+++ b/mu4e/mu4e.texi
@@ -909,8 +909,7 @@ visible only if you have actually set up mail-queuing. @ref{Queuing
mail}
@item @t{[A]bout mu4e} provides general information about the program
@item @t{[H]elp} shows help information for this view
-@item Finally, @t{[q]uit mu4e} quits your @code{mu4e}-session@footnote{@t{mu4e-quit}; or with a @t{C-u}
-prefix argument, it merely buries the buffer}
+@item Finally, @t{[q]uit mu4e} quits your @code{mu4e}-session@footnote{@t{mu4e-quit}; or with a @t{C-u} prefix argument, it merely buries the buffer. A hook @code{mu4e-quit-hook} is available as well}
@end itemize
@node Headers view
@@ -4359,7 +4358,7 @@ usually because one of the following reasons:
changes in @code{mu4e} are not immediately visible in the command-line @command{mu},
since it can take a while before changes are committed to disk (for performance
reasons). Note that quitting @code{mu4e} or invoking @t{mu4e-update-mail-and-index}
-and @t{mu4e-update-index} trigger committing to disk as a side-effect.
+and @t{mu4e-update-index} have the side-effect of committing changed data to disk.
@item different options:
@code{mu4e} defaults to having @t{mu4e-headers-include-related}, and
@t{mu4e-headers-results-limit} set to 500. However, the command-line @command{mu