summaryrefslogtreecommitdiff
path: root/mail.el
diff options
context:
space:
mode:
Diffstat (limited to 'mail.el')
-rw-r--r--mail.el41
1 files changed, 28 insertions, 13 deletions
diff --git a/mail.el b/mail.el
index ed2dd00..57d680f 100644
--- a/mail.el
+++ b/mail.el
@@ -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.")