Created
December 1, 2014 12:02
-
-
Save mickesv/ac7e706e04c2fc303832 to your computer and use it in GitHub Desktop.
Emacs Unread Mailcount in mode-line
This file contains 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
;; Add unread mailcount to modeline | |
;; I "cheat" by letting geektools run a script to do the real work once every 30secs, and then store it in a file. | |
;; (works better than letting emacs freeze to do the same thing) | |
;; ---------- | |
(setq msv-checkmail-timeout 10) | |
(setq msv-mailcount "") | |
(defun msv-check-mailcount () | |
(if (boundp 'msv-time-last) | |
(if (> (nth 1 (current-time)) (+ msv-time-last msv-checkmail-timeout)) | |
(progn (setq msv-time-last (nth 1 (current-time))) | |
(with-temp-buffer | |
(insert-file-contents "/Users/msv/A_Other/geektools/gmailcount.txt") | |
(setq msv-mailcount (car (split-string (buffer-string) "\n" t))))) | |
(if (< (nth 1 (current-time)) msv-time-last) | |
(setq msv-time-last (nth 1 (current-time))))) | |
(setq msv-time-last (nth 1 (current-time)))) | |
(concat | |
(if (not (= (length msv-mailcount) 0)) | |
(concat | |
"[Unread: " | |
msv-mailcount | |
"]") | |
nil) | |
"")) | |
(add-to-list 'global-mode-string '(:eval (msv-check-mailcount))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment