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 3296D429E4E for ; Tue, 28 Jun 2011 00:31:55 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "References" 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 PV8Ew36cnxl4 for ; Tue, 28 Jun 2011 00:31:54 -0700 (PDT) Received: from mail-qy0-f181.google.com (mail-qy0-f181.google.com [209.85.216.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id BA7A2429E5B for ; Tue, 28 Jun 2011 00:31:54 -0700 (PDT) Received: by mail-qy0-f181.google.com with SMTP id 9so3511754qyk.5 for ; Tue, 28 Jun 2011 00:31:54 -0700 (PDT) Received: by 10.229.47.18 with SMTP id l18mr1841005qcf.55.1309246314518; Tue, 28 Jun 2011 00:31:54 -0700 (PDT) Received: from localhost (nikula.org [92.243.24.172]) by mx.google.com with ESMTPS id t21sm4628575qcs.38.2011.06.28.00.31.53 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 28 Jun 2011 00:31:53 -0700 (PDT) From: Jani Nikula To: notmuch@notmuchmail.org Subject: [PATCH 4/4] emacs: Add pseudo tag to match all messages that have no tags Date: Tue, 28 Jun 2011 07:31:32 +0000 Message-Id: <21340f6b77dcd4f27bb06a39236f276cdfb5b2f7.1309244829.git.jani@nikula.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: References: In-Reply-To: References: X-Mailman-Approved-At: Tue, 28 Jun 2011 10:59:27 -0700 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: Tue, 28 Jun 2011 07:31:55 -0000 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