From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 9BE5542119B for ; Thu, 30 Jun 2011 00:56:27 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] 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 A9+ZzXSxHtcv for ; Thu, 30 Jun 2011 00:56:27 -0700 (PDT) Received: from mail-ww0-f45.google.com (mail-ww0-f45.google.com [74.125.82.45]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 028A6421192 for ; Thu, 30 Jun 2011 00:56:26 -0700 (PDT) Received: by wwj40 with SMTP id 40so1610357wwj.2 for ; Thu, 30 Jun 2011 00:56:25 -0700 (PDT) Received: by 10.216.163.207 with SMTP id a57mr1510889wel.39.1309420585768; Thu, 30 Jun 2011 00:56:25 -0700 (PDT) Received: from localhost ([109.131.21.173]) by mx.google.com with ESMTPS id l53sm983153weq.47.2011.06.30.00.56.23 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 30 Jun 2011 00:56:24 -0700 (PDT) From: Pieter Praet To: Jani Nikula , notmuch@notmuchmail.org Subject: Re: [PATCH 4/4] emacs: Add pseudo tag to match all messages that have no tags In-Reply-To: <21340f6b77dcd4f27bb06a39236f276cdfb5b2f7.1309244829.git.jani@nikula.org> References: <21340f6b77dcd4f27bb06a39236f276cdfb5b2f7.1309244829.git.jani@nikula.org> User-Agent: Notmuch/0.5-303-g00a1bf6 (http://notmuchmail.org) Emacs/23.1.50.1 (x86_64-pc-linux-gnu) Date: Thu, 30 Jun 2011 09:56:22 +0200 Message-ID: <871uyb7nx5.fsf@praet.org> 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: Thu, 30 Jun 2011 07:56:27 -0000 On Tue, 28 Jun 2011 07:31:32 +0000, Jani Nikula wrote: > Add a pseudo tag that matches all the messages that have no tags. Add new > customization option notmuch-tags-nomatch to enable and name the pseudo > tag. > --- > emacs/notmuch-hello.el | 18 ++++++++++++++++-- > 1 files changed, 16 insertions(+), 2 deletions(-) > > diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el > index b9c9b01..1770f60 100644 > --- a/emacs/notmuch-hello.el > +++ b/emacs/notmuch-hello.el > @@ -53,6 +53,12 @@ > string) > :group 'notmuch) > > +(defcustom notmuch-tags-nomatch nil > + "Name of the pseudo tag to match messages that have no tags." > + :type '(choice (const :tag "Off" nil) > + string) > + :group 'notmuch) > + > (defvar notmuch-hello-indent 4 > "How much to indent non-headers.") > > @@ -352,7 +358,7 @@ Complete list of currently available key bindings: > > (defun notmuch-hello-generate-tag-alist () > "Return an alist from tags to queries to display in the all-tags section." > - (notmuch-remove-if-not > + (let ((tag-alist (notmuch-remove-if-not > #'cdr > (mapcar (lambda (tag) > (cons tag > @@ -367,7 +373,15 @@ Complete list of currently available key bindings: > (notmuch-remove-if-not > (lambda (tag) > (not (member tag notmuch-hello-hide-tags))) > - (process-lines notmuch-command "search-tags"))))) > + (process-lines notmuch-command "search-tags")))))) > + (when notmuch-tags-nomatch > + (let ((no-tag-search > + (cons notmuch-tags-nomatch > + (mapconcat (lambda (arg) (concat "(not (" (cdr arg) "))")) tag-alist " and ")))) > + (if (> (string-to-number (notmuch-saved-search-count (cdr no-tag-search))) 0) > + ;; Append the no-match search. > + (add-to-list 'tag-alist no-tag-search t)))) > + tag-alist)) > > (defun notmuch-hello-saved-alist () > (if notmuch-saved-searches > -- > 1.7.1 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch IMHO, this should be handled in notmuch core. eg. `notmuch search tag:*' matches all tagged `notmuch search tag:' matches all non-tagged. -> No need for an extra customization option in Emacs, just a simple saved search. Opinions? Peace -- Pieter