mu4e: Add mu4e-mark-execute-pre-hook

Add a hook that runs just before executing a mark.

Signed-off-by: Magnus Therning <magnus@therning.org>
This commit is contained in:
Magnus Therning 2016-01-30 13:10:23 +01:00 committed by djcb
parent 974d728bd4
commit fe1104a94f
2 changed files with 12 additions and 1 deletions

View File

@ -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)

View File

@ -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