mu4e: add mu4e-headers-search-pre-hook

Just before executing a search, a hook-function
`mu4e-headers-search-pre-hook` is invoked, which receives the search
expression as its parameter.
This commit is contained in:
djcb 2016-02-18 20:59:02 +02:00
parent eca427d3a2
commit 7716e005bf
3 changed files with 11 additions and 6 deletions

View File

@ -20,6 +20,9 @@
- Let `mu4e~read-char-choice' become case-insensitive if there is
no exact match; small convenience that affects most the
single-char option reading in mu4e.
- Now, just before executing a search, a hook-function
`mu4e-headers-search-pre-hook` is invoked, which receives the
search expression as its parameter.
** 0.9.16

View File

@ -160,10 +160,9 @@ query have been received and are displayed."
:type 'hook
:group 'mu4e-headers)
(defcustom mu4e-headers-search-bookmark-hook nil
"Hook run just we're about to do a bookmarked search. The only
argument is `expr' which is the bookmarked search we're about to
execute."
(defcustom mu4e-headers-search-pre-hook nil
"Hook run just before executing a new search operation. This
function receives the query as its parameter."
:type 'hook
:group 'mu4e-headers)
@ -1015,6 +1014,7 @@ the query history stack."
(mu4e-context-label)))))
(switch-to-buffer buf)
(run-hook-with-args 'mu4e-headers-search-pre-hook expr)
(mu4e~proc-find
expr
mu4e-headers-show-threads
@ -1300,7 +1300,6 @@ the search."
(let ((expr
(or expr
(mu4e-ask-bookmark (if edit "Select bookmark: " "Bookmark: ")))))
(run-hook-with-args 'mu4e-headers-search-bookmark-hook expr)
(mu4e-headers-search expr (when edit "Edit bookmark: ") edit)))
(defun mu4e-headers-search-bookmark-edit ()

View File

@ -827,7 +827,10 @@ Jamie Zawinski's mail threading algorithm,
found during the indexing process, and if there is no current
user-interaction. If you do not want such automatic updates, set
@code{mu4e-headers-auto-update} to @code{nil}.
@item There is a hook-function @code{mu4e-headers-found-hook} available which
@item Just before executing a search, a hook-function
@code{mu4e-headers-search-pre-hook} is invoked, which receives the
search expression as its parameter.
@item Also, there is a hook-function @code{mu4e-headers-found-hook} available which
is invoked just after @t{mu4e} has completed showing the messages in the
headers-view.
@end itemize