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 C8768431FC9 for ; Sat, 5 May 2012 06:39:49 -0700 (PDT) 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 eENW9UCqLd8z for ; Sat, 5 May 2012 06:39:47 -0700 (PDT) Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com [209.85.212.179]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id 45A58431FD0 for ; Sat, 5 May 2012 06:39:46 -0700 (PDT) Received: by wibhn6 with SMTP id hn6so1781616wib.2 for ; Sat, 05 May 2012 06:39:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=uPap+PNqBubb4q9RTD1EZOyBGKttS0QrCtPmVuLo9iY=; b=nWJ7renOMlK+/py3gdN4OofYgJlHSxmhbfu+r/dfym1SY/MvFBH48vqFeJ74NK0BNj J4NlTiJlu4oeRKJwuSDZG2ryuZPMK+M3de7nvNLKx5w/sefHb5NosiwijjE7b35j/sKR mJ1ZRvML/KKw+GRIjqFcjPrKIKjle7L+iTmY+jMQzcP2CFiPo459iA3gk7gov519D1rG oymYQlTT5y5D49yx3CBW5mzMobou/qN9Pak5Ig+K6Cpry1sQmaxPeYbKZr5QjShaRLZT tnveVpskZQzgLe1qN3I06rLR5abU2G6rEs+xj9F2lGT9MRAaF8RyAVbg9Rg8+565JeYE hcCQ== Received: by 10.180.105.198 with SMTP id go6mr21196327wib.19.1336225184931; Sat, 05 May 2012 06:39:44 -0700 (PDT) Received: from localhost (94-192-233-223.zone6.bethere.co.uk. [94.192.233.223]) by mx.google.com with ESMTPS id ff9sm5804953wib.2.2012.05.05.06.39.43 (version=TLSv1/SSLv3 cipher=OTHER); Sat, 05 May 2012 06:39:44 -0700 (PDT) From: Mark Walters To: notmuch@notmuchmail.org Subject: [Patch v3 3/4] emacs: move notmuch-search-line-faces to "tag:" style. Date: Sat, 5 May 2012 14:39:46 +0100 Message-Id: <1336225187-8772-4-git-send-email-markwalters1009@gmail.com> X-Mailer: git-send-email 1.7.9.1 In-Reply-To: <1336225187-8772-1-git-send-email-markwalters1009@gmail.com> References: <1336225187-8772-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, 05 May 2012 13:39:50 -0000 notmuch-search-line-faces currently has pairs of the form ("TAG" . FACE). This changes it so that the pairs need to be of the form ("tag:tag" . FACE). This makes it consistent with the same change to notmuch-show-line-faces introduced in the next patch where we allow colouring based on flags (match and excluded) as well as tags. However, it will break people's existing colouring lines. It also makes it easier for the user to make the colouring rule for search and show the same. --- emacs/notmuch.el | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/emacs/notmuch.el b/emacs/notmuch.el index d5f40e2..40f0cbe 100644 --- a/emacs/notmuch.el +++ b/emacs/notmuch.el @@ -591,16 +591,16 @@ This function advances the next thread when finished." (goto-char (point-min)) (forward-line (1- notmuch-search-target-line)))))))) -(defcustom notmuch-search-line-faces '(("unread" :weight bold) - ("flagged" :foreground "blue")) +(defcustom notmuch-search-line-faces '(("tag:unread" :weight bold) + ("tag:flagged" :foreground "blue")) "Tag/face mapping for line highlighting in notmuch-search. Here is an example of how to color search results based on tags. (the following text would be placed in your ~/.emacs file): - (setq notmuch-search-line-faces '((\"deleted\" . (:foreground \"red\" + (setq notmuch-search-line-faces '((\"tag:deleted\" . (:foreground \"red\" :background \"blue\")) - (\"unread\" . (:foreground \"green\")))) + (\"tag:unread\" . (:foreground \"green\")))) The attributes defined for matching tags are merged, with later attributes overriding earlier. A message having both \"deleted\" @@ -612,7 +612,14 @@ foreground and blue background." (defun notmuch-search-color-line (start end line-tag-list) "Colorize lines in `notmuch-show' based on tags." - (notmuch-color-line start end line-tag-list notmuch-search-line-faces)) + ;; This is a little ugly (we do not match on flags in search-mode) + ;; but is done to keep the syntax consistent in + ;; notmuch-search-line-faces and notmuch-show-line-faces. + (let (tags-and-flags) + (mapc (lambda (tag) + (setq tags-and-flags (cons (concat "tag:" tag) tags-and-flags))) + line-tag-list) + (notmuch-color-line start end tags-and-flags notmuch-search-line-faces))) (defun notmuch-search-author-propertize (authors) "Split `authors' into matching and non-matching authors and -- 1.7.9.1