summaryrefslogtreecommitdiffhomepage
path: root/net/jao-maildir.el
diff options
context:
space:
mode:
Diffstat (limited to 'net/jao-maildir.el')
-rw-r--r--net/jao-maildir.el31
1 files changed, 13 insertions, 18 deletions
diff --git a/net/jao-maildir.el b/net/jao-maildir.el
index ee064a1..cae0372 100644
--- a/net/jao-maildir.el
+++ b/net/jao-maildir.el
@@ -27,6 +27,8 @@
;;; Code:
+(require 'jao-minibuffer)
+
(defvar jao-maildirs nil)
(defvar jao-maildir-counts nil)
(defvar jao-maildir-debug-p nil)
@@ -45,17 +47,7 @@
jao-maildirs)))
(defvar jao-maildir-tracked-maildirs)
-(defvar jao-maildir-mode-line-string "")
-(defvar jao-maildir-additional-info ())
-
-(defun jao-maildir-refresh-echo ()
- (with-current-buffer " *Minibuf-0*"
- (erase-buffer)
- (let ((mailp (not (string-blank-p jao-maildir-mode-line-string))))
- (insert (format "%s%s%s"
- (if mailp "Mail" "")
- (if mailp jao-maildir-mode-line-string "")
- (or (format-mode-line jao-maildir-additional-info) ""))))))
+(defvar jao-maildir-info-string "")
(defgroup jao-maildir-faces nil "Faces"
:group 'faces)
@@ -64,7 +56,7 @@
"Face used to highlihgt non-boring tracked maildirs"
:group 'jao-maildir-faces)
-(defun jao-maildir--update-mode-line-string ()
+(defun jao-maildir--update-info-string ()
(let ((total 0)
(counts))
(dolist (c jao-maildir-counts)
@@ -81,9 +73,10 @@
(if ab (push am counts) (setq counts (nconc counts (list am))))))))
(let* ((total (if (> total 0) (format " %d " total) " "))
(s (mapconcat 'identity counts " "))
- (s (if (string-empty-p s) s (concat s " "))))
- (setq jao-maildir-mode-line-string (format "%s%s" total s))
- (when jao-maildir-echo-p (jao-maildir-refresh-echo))
+ (s (if (string-empty-p s) s (concat s " ")))
+ (s (format "%s%s%s" "" total s)))
+ (setq jao-maildir-info-string s)
+ (when jao-maildir-echo-p (jao-minibuffer-refresh))
(force-mode-line-update t))))
(defvar jao-maildir--watches nil)
@@ -103,7 +96,7 @@
(setcdr (assoc mbox jao-maildir-counts)
(jao-maildir--maildir-new-count mbox))
;; (jao-maildir-counts)
- (jao-maildir--update-mode-line-string)
+ (jao-maildir--update-info-string)
(when cb (funcall cb mbox)))))
(defun jao-maildir--setup-watches (cb)
@@ -119,8 +112,10 @@
(defun jao-maildir-setup (maildirs mode-line &optional cb)
(setq jao-maildirs maildirs)
(setq jao-maildir-counts (jao-maildir-counts))
- (when mode-line
- (add-to-list 'global-mode-string 'jao-maildir-mode-line-string t))
+ (cond ((eq 'mode-line mode-line)
+ (add-to-list 'global-mode-string 'jao-maildir-info-string t))
+ (mode-line
+ (jao-minibuffer-add-variable 'jao-maildir-info-string)))
(jao-maildir--setup-watches cb))