Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 6E09F431FD0 for ; Fri, 8 Jul 2011 14:23:45 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id u+BdQlx1CfFP for ; Fri, 8 Jul 2011 14:23:44 -0700 (PDT) Received: from max.feld.cvut.cz (max.feld.cvut.cz [147.32.192.36]) by olra.theworths.org (Postfix) with ESMTP id 6D1BF431FB6 for ; Fri, 8 Jul 2011 14:23:44 -0700 (PDT) Received: from localhost (unknown [192.168.200.4]) by max.feld.cvut.cz (Postfix) with ESMTP id 316CB19F3346; Fri, 8 Jul 2011 23:23:43 +0200 (CEST) X-Virus-Scanned: IMAP AMAVIS Received: from max.feld.cvut.cz ([192.168.200.1]) by localhost (styx.feld.cvut.cz [192.168.200.4]) (amavisd-new, port 10044) with ESMTP id hss-pUykJaJg; Fri, 8 Jul 2011 23:23:41 +0200 (CEST) Received: from imap.feld.cvut.cz (imap.feld.cvut.cz [147.32.192.34]) by max.feld.cvut.cz (Postfix) with ESMTP id C22CE19F3345; Fri, 8 Jul 2011 23:23:41 +0200 (CEST) Received: from steelpick.2x.cz (cable-86-56-4-108.cust.telecolumbus.net [86.56.4.108]) (Authenticated sender: sojkam1) by imap.feld.cvut.cz (Postfix) with ESMTPSA id 7973E15C028; Fri, 8 Jul 2011 23:23:41 +0200 (CEST) Received: from wsh by steelpick.2x.cz with local (Exim 4.76) (envelope-from ) id 1QfIWS-0000mC-DW; Fri, 08 Jul 2011 23:23:40 +0200 From: Michal Sojka To: Daniel Schoepe , notmuch@notmuchmail.org Subject: Re: [PATCH v3 1/2] emacs: User-defined sections in notmuch-hello In-Reply-To: <87wrfuc5i6.fsf@gilead.invalid> References: <1309379221-5617-1-git-send-email-daniel.schoepe@googlemail.com> <1309883030-28899-1-git-send-email-daniel.schoepe@googlemail.com> <1309883030-28899-2-git-send-email-daniel.schoepe@googlemail.com> <87fwmjabii.fsf@steelpick.2x.cz> <87oc17r38a.fsf@tredergarh.home.box> <871uy25d3y.fsf@steelpick.2x.cz> <87wrfuc5i6.fsf@gilead.invalid> User-Agent: Notmuch/0.5-332-gf8bc48d (http://notmuchmail.org) Emacs/23.3.1 (x86_64-pc-linux-gnu) Date: Fri, 08 Jul 2011 23:23:40 +0200 Message-ID: <87k4bs4gbn.fsf@steelpick.2x.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jul 2011 21:23:45 -0000 On Thu, 07 Jul 2011, Daniel Schoepe wrote: Non-text part: multipart/signed > On Thu, 07 Jul 2011 17:23:13 +0200, Michal Sojka 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."