diff --git a/mu4e/mu4e-mark.el b/mu4e/mu4e-mark.el index b630032b..4b17f340 100644 --- a/mu4e/mu4e-mark.el +++ b/mu4e/mu4e-mark.el @@ -50,6 +50,10 @@ Value is one of the following symbols: (const ignore :tag "ignore marks without asking")) :group 'mu4e-headers) +(defcustom mu4e-mark-execute-pre-hook nil + "Hook run just *before* a mark is applied to a message. The hook function +is called with two arguments, the mark being executed and the message itself.") + (defvar mu4e-headers-show-target t "Whether to show targets (such as '-> delete', '-> /archive') when marking message. Normally, this is useful information for the @@ -404,7 +408,10 @@ If NO-CONFIRMATION is non-nil, don't ask user for confirmation." ;; note: whenever you do something with the message, ;; it looses its N (new) flag (if markdescr - (funcall (plist-get (cdr markdescr) :action) docid msg target) + (progn + (run-hook-with-args + 'mu4e-mark-execute-pre-hook mark msg) + (funcall (plist-get (cdr markdescr) :action) docid msg target)) (mu4e-error "Unrecognized mark %S" mark)))) mu4e~mark-map)) (mu4e-mark-unmark-all) diff --git a/mu4e/mu4e.texi b/mu4e/mu4e.texi index 00a6d868..a2e63c04 100644 --- a/mu4e/mu4e.texi +++ b/mu4e/mu4e.texi @@ -2114,6 +2114,10 @@ the marks (@key{x}). After you have marked some messages, you can execute them with @key{x} (@kbd{M-x mu4e-mark-execute-all}). +A hook, @code{mu4e-mark-execute-pre-hook}, is available which is run +right before execution of each mark. The hook is called with two +arguments, the mark and the message itself. + @node Leaving the headers buffer @section Leaving the headers buffer