There are several ways to get notified about incoming mail. There is gnus-notify.el by Mark Triggs. You can grab it from the Elisp area . Other possibilities are discussed below.
i’ve always wanted a simple way to signify in the status bar that new mail has arrived. as far as i know, there is no simple method. i added this function below to my .gnus.el. this is incredibly primitive. the function simply changes to the Group buffer and looks for a nonzero number of messages in INBOX.ALL (my “inbox” folder). this function is absolutely primitive elisp…i would love for it to be improved upon. sadly there is so little practical elisp documentation, i have found it difficult to find better information
;; biff (defvar foundnewmbox "") (defvar foundnewmbox "") (defun fmbiff () (interactive) (save-excursion (set-buffer "*Group*") (beginning-of-buffer) (defvar foundanymbox nil) (cond ((re-search-forward "INBOX.ALL" nil t) (setq foundanymbox t)) (t (setq foundanymbox nil))) (set-buffer "*Group*") (beginning-of-buffer) (cond ((re-search-forward "0: INBOX.ALL" nil t) (setq foundnewmbox "")) (t (if foundanymbox (setq foundnewmbox "[M]") (setq foundnewmbox "")))))) (unless (member 'foundnewmbox global-mode-string) (setq global-mode-string (append global-mode-string (list 'foundnewmbox)))) (add-hook 'gnus-after-getting-new-news-hook 'fmbiff)
[new] How about:
(defvar mac-biff-lighter "" "Lighter used by `mac-biff-mode'.") (defvar mac-biff-mail-re "\\([[:digit:]]+\\)" "Regular expression to match number counts in a Gnus buffer.") (define-minor-mode mac-biff-mode "Minor mode to display state of new email." nil mac-biff-lighter nil (if mac-biff-mode (progn (add-hook 'gnus-after-getting-new-news-hook 'mac-biff-update) (add-hook 'gnus-exit-group-hook 'mac-biff-update) (mac-biff-update)) (remove-hook 'gnus-after-getting-new-news-hook 'mac-biff-update) (remove-hook 'gnus-exit-group-hook 'mac-biff-update))) (defun mac-biff-update () "Read the mail count from Gnus." (let ((buffer (get-buffer "*Group*")) (count 0)) (when buffer (with-current-buffer buffer (goto-char (point-min)) (while (re-search-forward mac-biff-mail-re nil t) (setq count (+ count (string-to-number (match-string 1))))))) (setq mac-biff-lighter (if (= count 0) "" (format " [%d]" count)))))
I wanted a variant that would work with arbitrary Gnus groups, including remote IMAP and NNTP groups. So I wrote this, which reuses the existing display-time-mail mail signalling functions and lets you point them at an arbitrary group:
;; Mail notification configuration (require 'mail-source) (defvar wg/gnus-biff-groups nil "Groups to track within Gnus.") (defun wg/gnus-biff () "Update `mail-source-new-mail-available' with selected Gnus newsgroups." (setq mail-source-new-mail-available (ignore-errors (apply 'append (mapcar 'gnus-list-of-unread-articles wg/gnus-biff-groups)))) (display-time-event-handler)) (setq display-time-mail-function 'mail-source-new-mail-p) (add-hook 'gnus-after-getting-new-news-hook 'wg/gnus-biff) (add-hook 'gnus-summary-exit-hook 'wg/gnus-biff) (setq wg/gnus-biff-groups '("nnvirtual:mail" "gmane.linux.debian.user.security.announce") mail-source-flash nil)