summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2020-11-25 05:04:10 +0000
committerjao <jao@gnu.org>2020-11-25 05:04:10 +0000
commit10f8d7dfd552c2bfc0e237d6a5d7d8d1c5265881 (patch)
treeca0c5cc261c8536919f5e0227229bd821a4931e0
parent44d77e343203b589b13346cb23df1755f122a3b4 (diff)
downloadelibs-10f8d7dfd552c2bfc0e237d6a5d7d8d1c5265881.tar.gz
elibs-10f8d7dfd552c2bfc0e237d6a5d7d8d1c5265881.tar.bz2
jao-maildir: accepting regexps for tracked dirs
-rw-r--r--net/jao-maildir.el11
1 files changed, 9 insertions, 2 deletions
diff --git a/net/jao-maildir.el b/net/jao-maildir.el
index cae0372..701a848 100644
--- a/net/jao-maildir.el
+++ b/net/jao-maildir.el
@@ -27,12 +27,14 @@
;;; Code:
+(require 'seq)
(require 'jao-minibuffer)
(defvar jao-maildirs nil)
(defvar jao-maildir-counts nil)
(defvar jao-maildir-debug-p nil)
(defvar jao-maildir-echo-p t)
+(defvar jao-maildir-tracked-maildirs nil)
(defun jao-maildir--maildir-new (mbox) (expand-file-name "new" mbox))
@@ -56,6 +58,10 @@
"Face used to highlihgt non-boring tracked maildirs"
:group 'jao-maildir-faces)
+(defun jao-maildir--tracked (m)
+ (seq-find (lambda (e) (string-match-p (car e) m))
+ jao-maildir-tracked-maildirs))
+
(defun jao-maildir--update-info-string ()
(let ((total 0)
(counts))
@@ -63,11 +69,12 @@
(when (> (cdr c) 0)
(let* ((m (car c))
(n (cdr c))
- (a (assoc m jao-maildir-tracked-maildirs))
+ (a (jao-maildir--tracked m))
(an (cadr a))
(ab (caddr a))
(am (when a (format "%s%s" an n)))
- (am (when am (if ab am (propertize am 'face 'jao-maildir-emph)))))
+ (f (when am (if (eq t ab) 'jao-maildir-emph ab)))
+ (am (when am (if f (propertize am 'face f) am))))
(when (null a) (setq total (+ n total)))
(when a
(if ab (push am counts) (setq counts (nconc counts (list am))))))))