diff options
author | JSDurand <mmemmew@gmail.com> | 2023-02-23 21:38:57 +0800 |
---|---|---|
committer | JSDurand <mmemmew@gmail.com> | 2023-02-23 21:38:57 +0800 |
commit | b4ca140005dec52532e5b93a59ceef08d63abfe8 (patch) | |
tree | e5c92806c3bb68882cb77613a0a0592e2fb58c88 /mail.el | |
parent | 20ed2505c93e021d5516b212dae4746ccd2413bd (diff) |
mail: Add the option of only running hooks without updating
* mail.el (durand-mail-update): Now if we run the update command with
the argument of `0', then it only runs the hook
`durand-mail-update-hook`, which currently contains only the
function `notmuch-poll`. This allows the user to index mails
without fetching mails, which is useful since the timer that fetches
mails in the background does not index mails, intentionally.
Diffstat (limited to 'mail.el')
-rw-r--r-- | mail.el | 41 |
1 files changed, 28 insertions, 13 deletions
@@ -290,19 +290,34 @@ PROCESS is finished." (defun durand-mail-update (&optional foreground-p) "Update mails. If FOREGROUND-P is non-nil, also display the progress in a -separate buffer." - (interactive (list t)) - (make-process - :name "durand-mail-update" - :command durand-mail-update-command - :filter (cond (foreground-p #'durand-mail-update-filter)) - :sentinel (cond (foreground-p #'durand-mail-update-sentinel)) - :buffer (cond - (foreground-p - (let ((buffer - (get-buffer-create durand-mail-update-buffer))) - (buffer-disable-undo buffer) - buffer))))) +separate buffer. + +If FOREGROUND-P is `0', do not fetch mails, but just run +`durand-mail-update-hook.'" + (interactive + (list + (let ((arg current-prefix-arg)) + (cond + ((and (numberp arg) + (= arg 0)) + 0) + ((null arg)))))) + (cond + ((and (numberp foreground-p) + (= foreground-p 0)) + (message "hi") + (run-hooks 'durand-mail-update-hook)) + ((make-process + :name "durand-mail-update" + :command durand-mail-update-command + :filter (cond (foreground-p #'durand-mail-update-filter)) + :sentinel (cond (foreground-p #'durand-mail-update-sentinel)) + :buffer (cond + (foreground-p + (let ((buffer + (get-buffer-create durand-mail-update-buffer))) + (buffer-disable-undo buffer) + buffer))))))) (defvar durand-mail-update-timer nil "A timer to automatically update mail in the background.") |