Skip to content

Commit

Permalink
A hook for new mail arrival is introduced.
Browse files Browse the repository at this point in the history
  • Loading branch information
ikazuhiro committed Feb 4, 2017
1 parent a1640fe commit 1a49ac0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
9 changes: 9 additions & 0 deletions wl/ChangeLog
@@ -1,3 +1,12 @@
2017-02-04 Kazuhiro Ito <kzhr@d1.dion.ne.jp>
Suggested by Pascal Haakmat <pascalh@gmail.com>

* wl-vars.el (wl-biff-new-mail-hook): New hook.

* wl-util.el (wl-biff-notify): Run wl-biff-new-mail-hook when new
mail has arrived.
Cf. [wl-en:06109], https://github.com/wanderlust/wanderlust/pull/137

2017-02-04 Kazuhiro Ito <kzhr@d1.dion.ne.jp>

* wl-util.el (wl-biff-start, wl-biff-launch-handler)
Expand Down
11 changes: 7 additions & 4 deletions wl/wl-util.el
Expand Up @@ -823,10 +823,13 @@ that `read' can handle, whenever this is possible."


(defsubst wl-biff-notify (new-mails notify-minibuf)
(when (and (not wl-modeline-biff-status) (> new-mails 0))
(run-hooks 'wl-biff-notify-hook))
(when (and wl-modeline-biff-status (eq new-mails 0))
(run-hooks 'wl-biff-unnotify-hook))
(if (> new-mails 0)
(progn
(unless wl-modeline-biff-status
(run-hooks 'wl-biff-notify-hook))
(run-hook-with-args 'wl-biff-new-mail-hook new-mails))
(when (and wl-modeline-biff-status (eq new-mails 0))
(run-hooks 'wl-biff-unnotify-hook)))
(setq wl-modeline-biff-status (> new-mails 0))
(force-mode-line-update t)
(when notify-minibuf
Expand Down
4 changes: 4 additions & 0 deletions wl/wl-vars.el
Expand Up @@ -887,6 +887,10 @@ The cursor point is located at top of the body.")
"A hook called when a biff-notification is invoked.")
(defvar wl-biff-unnotify-hook nil
"A hook called when a biff-notification is removed.")
(defvar wl-biff-new-mail-hook nil
"A hook called when `wl-biff-notify' found non-zero new
mails. The hook functions receive the number of new mails as
the first argument.")
(defvar wl-auto-check-folder-pre-hook nil
"A hook called before auto check folders.")
(defvar wl-auto-check-folder-hook nil
Expand Down

0 comments on commit 1a49ac0

Please sign in to comment.