mirror of https://github.com/djcb/mu.git
* mu4e: add hooks mu4e-headers-found-hook and mu4e-update-pre-hook, document them.
This commit is contained in:
parent
c36030a086
commit
92158cfdd4
|
@ -209,6 +209,11 @@ PREDICATE-FUNC as PARAM. This is useful for getting user-input.")
|
||||||
(defvar mu4e-headers-full-search nil
|
(defvar mu4e-headers-full-search nil
|
||||||
"Whether to show all results.
|
"Whether to show all results.
|
||||||
If this is nil show results up to `mu4e-search-results-limit')")
|
If this is nil show results up to `mu4e-search-results-limit')")
|
||||||
|
|
||||||
|
(defvar mu4e-headers-found-hook nil
|
||||||
|
"Hook run just *after* all of the headers for the last search
|
||||||
|
query have been received and are displayed.")
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
|
||||||
|
@ -477,6 +482,9 @@ if provided, or at the end of the buffer otherwise."
|
||||||
(defconst mu4e~no-matches (purecopy "No matching messages found"))
|
(defconst mu4e~no-matches (purecopy "No matching messages found"))
|
||||||
(defconst mu4e~end-of-results (purecopy "End of search results"))
|
(defconst mu4e~end-of-results (purecopy "End of search results"))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(defun mu4e~headers-found-handler (count)
|
(defun mu4e~headers-found-handler (count)
|
||||||
"Create a one line description of the number of headers found
|
"Create a one line description of the number of headers found
|
||||||
after the end of the search results."
|
after the end of the search results."
|
||||||
|
@ -491,9 +499,11 @@ after the end of the search results."
|
||||||
(insert (propertize str 'face 'mu4e-system-face 'intangible t))
|
(insert (propertize str 'face 'mu4e-system-face 'intangible t))
|
||||||
(unless (= 0 count)
|
(unless (= 0 count)
|
||||||
(mu4e-message "Found %d matching message%s"
|
(mu4e-message "Found %d matching message%s"
|
||||||
count (if (= 1 count) "" "s"))
|
count (if (= 1 count) "" "s"))))
|
||||||
;; highlight the first message
|
;; highlight the first message
|
||||||
(mu4e~headers-highlight (mu4e~headers-docid-at-point (point-min)))))))))
|
(mu4e~headers-highlight (mu4e~headers-docid-at-point (point-min)))
|
||||||
|
;; run-hooks
|
||||||
|
(run-hooks 'mu4e-headers-found-hook)))))
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -804,6 +804,7 @@ The messages are inserted into the process buffer."
|
||||||
run-in-background is non-nil (or called with prefix-argument), run
|
run-in-background is non-nil (or called with prefix-argument), run
|
||||||
in the background; otherwise, pop up a window."
|
in the background; otherwise, pop up a window."
|
||||||
(interactive "P")
|
(interactive "P")
|
||||||
|
(run-hooks 'mu4e-update-pre-hook)
|
||||||
(unless mu4e-get-mail-command
|
(unless mu4e-get-mail-command
|
||||||
(mu4e-error "`mu4e-get-mail-command' is not defined"))
|
(mu4e-error "`mu4e-get-mail-command' is not defined"))
|
||||||
(let* ((process-connection-type t)
|
(let* ((process-connection-type t)
|
||||||
|
@ -827,7 +828,7 @@ in the background; otherwise, pop up a window."
|
||||||
(buf (process-buffer proc))
|
(buf (process-buffer proc))
|
||||||
(visible-window (get-buffer-window buf 'visible)))
|
(visible-window (get-buffer-window buf 'visible)))
|
||||||
(message nil)
|
(message nil)
|
||||||
;; there may be an error, give the user up to 5 seconds to check
|
;; there may be an erro, give the user up to 5 seconds to check
|
||||||
(when maybe-error (sit-for 5))
|
(when maybe-error (sit-for 5))
|
||||||
(mu4e-update-index)
|
(mu4e-update-index)
|
||||||
(when (and (buffer-live-p buf) visible-window)
|
(when (and (buffer-live-p buf) visible-window)
|
||||||
|
|
|
@ -78,6 +78,11 @@ mu4e."
|
||||||
:group 'mu4e
|
:group 'mu4e
|
||||||
:safe 'integerp)
|
:safe 'integerp)
|
||||||
|
|
||||||
|
(defvar mu4e-update-pre-hook nil
|
||||||
|
"Hook run just *before* the mail-retrieval / database updating process starts.
|
||||||
|
You can use this hook for example to `mu4e-get-mail-command' with
|
||||||
|
some specific setting.")
|
||||||
|
|
||||||
(defvar mu4e-hide-index-messages nil
|
(defvar mu4e-hide-index-messages nil
|
||||||
"If non-nil, mu4e does not show the \"Indexing...\" messages, or
|
"If non-nil, mu4e does not show the \"Indexing...\" messages, or
|
||||||
any messages relating to updated contacts.")
|
any messages relating to updated contacts.")
|
||||||
|
@ -128,7 +133,7 @@ personal message. This is used when indexing messages."
|
||||||
`format-time-string'."
|
`format-time-string'."
|
||||||
:type 'string
|
:type 'string
|
||||||
:group 'mu4e)
|
:group 'mu4e)
|
||||||
|
|
||||||
(defvar mu4e-debug nil
|
(defvar mu4e-debug nil
|
||||||
"When set to non-nil, log debug information to the *mu4e-log* buffer.")
|
"When set to non-nil, log debug information to the *mu4e-log* buffer.")
|
||||||
|
|
||||||
|
|
|
@ -477,6 +477,11 @@ A simple setup could look something like:
|
||||||
mu4e-update-interval 300) ;; update every 5 minutes
|
mu4e-update-interval 300) ;; update every 5 minutes
|
||||||
@end lisp
|
@end lisp
|
||||||
|
|
||||||
|
A hook @code{mu4e-update-pre-hook} is available which is run right before
|
||||||
|
starting the process, which you can for example to influence
|
||||||
|
@code{mu4e-get-mail-command} based on the the current situation (location,
|
||||||
|
time of day, ...).
|
||||||
|
|
||||||
It is possible to get notifications when the indexing process does any updates
|
It is possible to get notifications when the indexing process does any updates
|
||||||
- for example when receiving new mail. See @code{mu4e-index-updated-hook} and
|
- for example when receiving new mail. See @code{mu4e-index-updated-hook} and
|
||||||
some tips on its usage in the @ref{FAQ}.
|
some tips on its usage in the @ref{FAQ}.
|
||||||
|
@ -582,7 +587,7 @@ correctly, and then shows you the @t{mu4e} main view. Its major mode is
|
||||||
|
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
* Overview: MV Overview.
|
* Overview: MV Overview.
|
||||||
* Basic actions::
|
* Basic actions::
|
||||||
* Bookmarks: MV Bookmarks.
|
* Bookmarks: MV Bookmarks.
|
||||||
* Miscellaneous::
|
* Miscellaneous::
|
||||||
|
@ -764,6 +769,9 @@ Jamie Zawinski's mail threading algorithm,
|
||||||
found during the indexing process, and if there is no current
|
found during the indexing process, and if there is no current
|
||||||
user-interaction. If you do not want such automatic updates, set
|
user-interaction. If you do not want such automatic updates, set
|
||||||
@code{mu4e-headers-auto-update} to @code{nil}.
|
@code{mu4e-headers-auto-update} to @code{nil}.
|
||||||
|
@item 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
|
@end itemize
|
||||||
|
|
||||||
@node Keybindings
|
@node Keybindings
|
||||||
|
@ -917,7 +925,7 @@ include a new header @t{Recip#} with the number of recipients.
|
||||||
|
|
||||||
Note that this function can be used in both the headers-view and the
|
Note that this function can be used in both the headers-view and the
|
||||||
message-view; if you need something specific for one of these, you can check
|
message-view; if you need something specific for one of these, you can check
|
||||||
for the mode in your function.
|
for the mode in your function.
|
||||||
|
|
||||||
@node HV Actions
|
@node HV Actions
|
||||||
@section Actions
|
@section Actions
|
||||||
|
@ -1281,12 +1289,12 @@ For more information, see the @command{mu-verify} manual page.
|
||||||
|
|
||||||
Sometimes the normal headers that @t{mu4e} offers (Date, From, To, Subject
|
Sometimes the normal headers that @t{mu4e} offers (Date, From, To, Subject
|
||||||
etc.) may not be enough. For these cases, @t{mu4e} offers @emph{custom
|
etc.) may not be enough. For these cases, @t{mu4e} offers @emph{custom
|
||||||
headers} in both the headers-view and the message-view.
|
headers} in both the headers-view and the message-view.
|
||||||
|
|
||||||
See @ref{HV Custom headers} for an example of this; the difference for the
|
See @ref{HV Custom headers} for an example of this; the difference for the
|
||||||
message-view is that you should add your custom header to
|
message-view is that you should add your custom header to
|
||||||
@code{mu4e-view-fields} rather than @code{mu4e-headers-fields}.
|
@code{mu4e-view-fields} rather than @code{mu4e-headers-fields}.
|
||||||
|
|
||||||
@node MSGV Actions
|
@node MSGV Actions
|
||||||
@section Actions
|
@section Actions
|
||||||
|
|
||||||
|
@ -2268,7 +2276,7 @@ guidelines for doing so.
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
* Extension points::
|
* Extension points::
|
||||||
* Available functions::
|
* Available functions::
|
||||||
* Message functions::
|
* Message functions::
|
||||||
* Utility functions::
|
* Utility functions::
|
||||||
@end menu
|
@end menu
|
||||||
|
@ -2911,8 +2919,8 @@ In this chapter we list a number of actual and anticipated questions and their
|
||||||
answers.
|
answers.
|
||||||
|
|
||||||
@menu
|
@menu
|
||||||
* General::
|
* General::
|
||||||
* Reading messages::
|
* Reading messages::
|
||||||
* Writing messages::
|
* Writing messages::
|
||||||
* Known issues::
|
* Known issues::
|
||||||
@end menu
|
@end menu
|
||||||
|
|
Loading…
Reference in New Issue