Last active
July 8, 2016 16:54
-
-
Save rothmichaels/1d546e61615190d2fea92fd80784b27d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defun gnus-user-format-function-t (dummy) | |
| (case (car gnus-tmp-method) | |
| (nnimap | |
| (let ((count (nnimap-request-message-count gnus-tmp-qualified-group))) | |
| (if count | |
| (format "%d" count) | |
| "?"))) | |
| (t | |
| gnus-tmp-number-total))) | |
| (defvar nnimap-message-count-cache-alist nil) | |
| (defun nnimap-message-count-cache-clear nil | |
| (setq nnimap-message-count-cache-alist nil)) | |
| (defun nnimap-message-count-cache-get (mbox &optional server) | |
| (when (nnimap-possibly-change-server server) | |
| (cadr (assoc (concat nnimap-current-server ":" mbox) | |
| nnimap-message-count-cache-alist)))) | |
| (defun nnimap-message-count-cache-set (mbox count &optional server) | |
| (when (nnimap-possibly-change-server server) | |
| (push (list (concat nnimap-current-server ":" mbox) | |
| count) nnimap-message-count-cache-alist)) | |
| count) | |
| (defun nnimap-request-message-count (mbox &optional server) | |
| (let ((count (or (nnimap-message-count-cache-get mbox server) | |
| (and (nnimap-possibly-change-server server) | |
| (progn | |
| (message "Requesting message count for %s..." | |
| mbox) | |
| (prog1 | |
| (imap-mailbox-status | |
| mbox 'messages nnimap-server-buffer) | |
| (message "Requesting message count for %s...done" | |
| mbox))))))) | |
| (when count | |
| (nnimap-message-count-cache-set mbox count server)) | |
| count)) | |
| (add-hook 'gnus-after-getting-new-news-hook 'nnimap-message-count-cache-clear) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment