Hello,

I found myself very often adding something like 'tag:inbox and ...' to
the saved searches. I want my messages to be tagged by mailing list so
whenever I subscribe to a new mailing list I have to update both the
tagging script and saved searches. This work duplication doesn't seem
ideal for me so here is a patch, which shows a section "What's in your
inbox" in notmuch-hello screen. This section contains all tags of
messages that are tagged by "inbox".

It would be nice to have some configuration for the "What's in your
inbox" section - for example to specify which tags are not interesting
for me (e.g. unread).

I'm not sure whether the patch applies to recent dme's notmuch-hello
updates. If not, I'll rebase it as soon as these patches appear in
master.

Signed-off-by: Michal Sojka <sojkam1 at fel.cvut.cz>

---
 emacs/notmuch-hello.el |   39 +++++++++++++++++++++++++++++++++++++--
 1 files changed, 37 insertions(+), 2 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 6a1c56e..e61f37a 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -55,6 +55,11 @@
   :type 'boolean
   :group 'notmuch)

+(defcustom notmuch-show-inbox-tags-list nil
+  "Should all tags in your inbox be shown in the notmuch-hello view?"
+  :type 'boolean
+  :group 'notmuch)
+
 (defface notmuch-hello-logo-background
   '((((class color)
       (background dark))
@@ -289,7 +294,36 @@ diagonal."
                                (mapcar '(lambda (tag) (cons tag (concat "tag:" 
tag)))
                                        (process-lines notmuch-command 
"search-tags"))))
             (alltags-widest (notmuch-hello-longest-label alltags-alist))
-            (widest (max saved-widest alltags-widest)))
+            (inboxtags-alist (if notmuch-show-inbox-tags-list
+                                 (mapcar '(lambda (tag) (cons tag (concat 
"tag:inbox and tag:" tag)))
+                                         (process-lines notmuch-command 
"search-tags" "tag:inbox"))))
+            (inboxtags-widest (notmuch-hello-longest-label inboxtags-alist))
+            (widest (max saved-widest alltags-widest inboxtags-widest)))
+
+
+       (when inboxtags-alist
+         (widget-insert "What's in your inbox: ")
+         (widget-create 'push-button
+                        :notify (lambda (widget &rest ignore)
+                                  (setq notmuch-show-inbox-tags-list nil)
+                                  (notmuch-hello-update))
+                        "hide")
+         (widget-insert "\n\n")
+         (setq final-target-pos (point-marker))
+         (let ((start (point)))
+           (setq found-target-pos (notmuch-hello-insert-tags inboxtags-alist 
widest target))
+           (if (not final-target-pos)
+               (setq final-target-pos found-target-pos))
+           (indent-rigidly start (point) notmuch-hello-indent)))
+
+       (when (not notmuch-show-inbox-tags-list)
+         (widget-create 'push-button
+                        :notify (lambda (widget &rest ignore)
+                                  (setq notmuch-show-inbox-tags-list t)
+                                  (notmuch-hello-update))
+                        "Show tags in your inbox")
+         (widget-insert "\n"))
+       (widget-insert "\n")

        (when saved-alist
          (widget-insert "Saved searches: ")
@@ -297,8 +331,9 @@ diagonal."
                         :notify (lambda (&rest ignore)
                                   (customize-variable 'notmuch-saved-searches))
                         "edit")
+         (if (not final-target-pos)
+             (setq final-target-pos (point-marker)))
          (widget-insert "\n\n")
-         (setq final-target-pos (point-marker))
          (let ((start (point)))
            (setq found-target-pos (notmuch-hello-insert-tags saved-alist 
widest target))
            (if found-target-pos
-- 
tg: (1d528f8..) t/emacs-what-is-in-your-inbox (depends on: master)

Reply via email to