On Thu, 07 Jul 2011, Daniel Schoepe wrote: Non-text part: multipart/signed > On Thu, 07 Jul 2011 17:23:13 +0200, Michal Sojka <sojkam1@fel.cvut.cz> wrote: > > This wouldn't work for me. My all-tags section covers almost entire > > screen and finding non-zero entries there is not very convenient. I find > > much more useful to have a section saying: "Hey, you have unread > > messages only for these three tags". Moreover, it wouldn't help me to see > > non-zero number of unread messages and when I click the button I would > > see all the messages, not only the unread ones. It simply seems very > > confusing to me. > > I agree with you, personally, but I don't think this particular bit > (:hide-empty-searches) increases code complexity that much (and all of > it is localized to the functions generating the sections, which possibly > should be moved to a separate file). I also find it plausible that a > user might want behavior like this (as, e.g. an overview, if he doesn't > want an all tags section, but still see what tags he has set). > > Hence I don't see why we should not provide this option. OK. I changed my mind. I thought that the approach with 'notmuch search-tags QEURY' followed by 'notmuch count tag:XXX and QUERY' for returned tags would be faster then 'notmuch search-tags' followed by 'notmuch count tag:XXX and QUERY' for all tags, but it turned out not to be the case. I played with the customization interface a bit and found the following problems: - It is annoying to insert section titles that includes ": " at the end in order to be nicely "rendered". I think this could be appended automatically. - :hide-empty-tags should be renamed in :hide-empty-searches to be effective (see the patch below). - The title of custom tags section was not passed correctly to the functions. This is also fixed in the patch below. -Michal diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el index 9c18caa..7e81076 100644 --- a/emacs/notmuch-hello.el +++ b/emacs/notmuch-hello.el @@ -113,7 +113,7 @@ Typically \",\" in the US and UK and \".\" in Europe." (:make-count (string :tag "Different query to generate counts")) (:hide-tags (repeat :tag "Tags that will be hidden" string)) (:initially-hidden (boolean :tag "Hide this on startup?")) - (:hide-empty-tags (boolean :tag "Hide tags with no matching messages")) + (:hide-empty-searches (boolean :tag "Hide tags with no matching messages")) (:hide-if-empty (boolean :tag "Hide if empty"))))) `(list (const :tag "" notmuch-hello-insert-tags-section) (plist :inline t :options ,opts)))) @@ -129,7 +129,7 @@ Typically \",\" in the US and UK and \".\" in Europe." (plist :inline t :options ((:initially-hidden (boolean :tag "Hide this on startup?")) - (:hide-empty-tags + (:hide-empty-searches (boolean :tag "Hide tags with no matching messages")) (:hide-if-empty (boolean :tag "Hide if empty")))))) @@ -629,7 +629,7 @@ Supports the following entries in OPTIONS as a plist: (indent-rigidly start (point) notmuch-hello-indent) target-pos)))) -(defun notmuch-hello-insert-tags-section (&optional title &rest options) +(defun notmuch-hello-insert-tags-section (&rest options) "Insert a section displaying all tags and message counts for each. TITLE defaults to \"All tags: \". @@ -638,7 +638,7 @@ following: :hide-tags - List of tags that should be excluded." (apply 'notmuch-hello-insert-searches - (or title "All tags: ") + (plist-get options :title) (notmuch-hello-generate-tag-alist (plist-get options :hide-tags) (plist-get options :make-query) @@ -656,8 +656,8 @@ following: (defun notmuch-hello-insert-alltags () "Insert a section displaying all tags and associated message counts" - (notmuch-hello-insert-tags-section nil :initially-hidden - (not notmuch-show-all-tags-list))) + (notmuch-hello-insert-tags-section :title "All tags: " + :initially-hidden (not notmuch-show-all-tags-list))) (defun notmuch-hello-insert-footer () "Insert the notmuch-hello footer."