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 11EB5431FBD for ; Sat, 18 Jan 2014 15:31:16 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0.201 X-Spam-Level: X-Spam-Status: No, score=0.201 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001, 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 k-eetTZq5n3O for ; Sat, 18 Jan 2014 15:31:11 -0800 (PST) Received: from mail-we0-f171.google.com (mail-we0-f171.google.com [74.125.82.171]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 675DB431FC0 for ; Sat, 18 Jan 2014 15:31:06 -0800 (PST) Received: by mail-we0-f171.google.com with SMTP id w61so5849187wes.16 for ; Sat, 18 Jan 2014 15:31:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Ea6a6cfdaLH6c+PcZc+IFhMcn9SQ93d9EWbC0UUOgGg=; b=Nj/Z4ItiLDdjXB5FqQyfzjhXUJZXu7QAOtkdgaz0U0JH1mwGkcYZYl/+8b+aerS58y +hbHd/MeZlyLT3t8l7yux3eD+JYoHC3tmxcvK6+DBSUBnkHQSswKtM98kq069AX7dEbC sRdOYIJ5x8YrXhF+N4eh8U/2D24Rd/nHHNU6hC6SLS8erxhI3sCoRTUeG1bwYqXKZkuX utcMILOO5EIsGZMbB6i3/UGzSyvifelxvuWT4mVAyoKNbyKgTK+VrpRfk8ZMxHfB+lQW I8MX06nE1K+OwakfK1SDKrFyHdBd0Qn9QBDHaCUu4jyq1yRG80blHW95C+UJbHYUlwxG z7NA== X-Received: by 10.194.62.70 with SMTP id w6mr39008wjr.55.1390087865300; Sat, 18 Jan 2014 15:31:05 -0800 (PST) Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) by mx.google.com with ESMTPSA id ci4sm13898024wjc.21.2014.01.18.15.31.04 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 18 Jan 2014 15:31:04 -0800 (PST) From: Mark Walters To: notmuch@notmuchmail.org Subject: [PATCH 2/7] emacs: tag: allow default case in notmuch-tag-formats Date: Sat, 18 Jan 2014 23:30:50 +0000 Message-Id: <1390087855-26194-3-git-send-email-markwalters1009@gmail.com> X-Mailer: git-send-email 1.7.9.1 In-Reply-To: <1390087855-26194-1-git-send-email-markwalters1009@gmail.com> References: <1390087855-26194-1-git-send-email-markwalters1009@gmail.com> 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: Sat, 18 Jan 2014 23:31:16 -0000 Allow an empty string in notmuch-tag-formats which matches all tags except those matched explicitly matched. This allows the user to tell notmuch to hide all tags except those specified. This will be useful once formatting for deleted/added tags is added later in the series: a user might want to hide all deleted tags for example. --- emacs/notmuch-tag.el | 20 +++++++++++--------- 1 files changed, 11 insertions(+), 9 deletions(-) diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el index 2153068..92c1249 100644 --- a/emacs/notmuch-tag.el +++ b/emacs/notmuch-tag.el @@ -65,14 +65,15 @@ This gives a list that maps from tag names to lists of formatting expressions. The car of each element gives a tag name and the cdr gives a list of Elisp expressions that modify the tag. If -the list is empty, the tag will simply be hidden. Otherwise, -each expression will be evaluated in order: for the first -expression, the variable `tag' will be bound to the tag name; for -each later expression, the variable `tag' will be bound to the -result of the previous expression. In this way, each expression -can build on the formatting performed by the previous expression. -The result of the last expression will displayed in place of the -tag. +the car is an empty string it matches all tags that do not have +an explicit match. If the list is empty, the tag will simply be +hidden. Otherwise, each expression will be evaluated in order: +for the first expression, the variable `tag' will be bound to the +tag name; for each later expression, the variable `tag' will be +bound to the result of the previous expression. In this way, +each expression can build on the formatting performed by the +previous expression. The result of the last expression will +displayed in place of the tag. For example, to replace a tag with another string, simply use that string as a formatting expression. To change the foreground @@ -140,7 +141,8 @@ This can be used with `notmuch-tag-format-image-data'." (defun notmuch-tag-format-tag (tag) "Format TAG by looking into `notmuch-tag-formats'." - (let ((formats (assoc tag notmuch-tag-formats))) + (let ((formats (or (assoc tag notmuch-tag-formats) + (assoc "" notmuch-tag-formats)))) (cond ((null formats) ;; - Tag not in `notmuch-tag-formats', tag) ;; the format is the tag itself. -- 1.7.9.1