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 6537C431FB6 for ; Sat, 5 May 2012 04:45:30 -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 vOJ9Q3AUsSea for ; Sat, 5 May 2012 04:45:26 -0700 (PDT) Received: from mail-lb0-f181.google.com (mail-lb0-f181.google.com [209.85.217.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id A0C9C431FAE for ; Sat, 5 May 2012 04:45:25 -0700 (PDT) Received: by lbbgk8 with SMTP id gk8so2839017lbb.26 for ; Sat, 05 May 2012 04:45:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:subject:in-reply-to:references:user-agent:date:message-id :mime-version:content-type:x-gm-message-state; bh=rrgnsvX9gTtAeqH1CASjLgJLqWVwBSmf0oJHSRaywIc=; b=ibEfIM43ycp2DkoX4tuDh6TwTV2FG6tca8K60MniFOsubx4EL5I0cLwnCuRU7DtiGV bqS22svsGLKul6We07pRT4W1CKzxIo3UmC41NCgczpTYFxzgB32+OcOC10FcJj3vrxGh lflz8cDgLzBDuLIL1VHhFzGaTCXV5w8pusGN+DLGUYthAYSCJRpd5WVGW2hnLCz7J4vY 6HstPV7Il9YlEmFCBsQ5Y27oToSlJ44V6BbG8FjZW3pQ3Ld2FWXqPLq6apRxzHkdySsM S/etf6gpM07JFA1sc5Q8/EjO8I9EgL4Jkg66sNq4yK+jemArE1wqWi86t57vSueKf2lv QkqQ== Received: by 10.152.114.106 with SMTP id jf10mr8849397lab.16.1336218322454; Sat, 05 May 2012 04:45:22 -0700 (PDT) Received: from localhost (dsl-hkibrasgw4-fe50dc00-68.dhcp.inet.fi. [80.220.80.68]) by mx.google.com with ESMTPS id j6sm14856244lbl.0.2012.05.05.04.45.19 (version=SSLv3 cipher=OTHER); Sat, 05 May 2012 04:45:20 -0700 (PDT) From: Jani Nikula To: Mark Walters , notmuch@notmuchmail.org Subject: Re: [Patch v2 2/3] emacs: Add `notmuch-show-line-faces' and apply it. In-Reply-To: <1335739697-8501-3-git-send-email-markwalters1009@gmail.com> References: <1335739697-8501-1-git-send-email-markwalters1009@gmail.com> <1335739697-8501-3-git-send-email-markwalters1009@gmail.com> User-Agent: Notmuch/0.12+169~g45438b0 (http://notmuchmail.org) Emacs/23.3.1 (i686-pc-linux-gnu) Date: Sat, 05 May 2012 14:45:17 +0300 Message-ID: <87bom2j1gy.fsf@nikula.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Gm-Message-State: ALoCoQn47k/AHPvksT0n6SxFsA8T9R+AmEWdlk4QO4+etoexOgRKESVkfpbDZYyWdW8QpivPCZBL 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 11:45:31 -0000 On Mon, 30 Apr 2012, Mark Walters wrote: > Similar to `notmuch-search-line-faces', `notmuch-show-line-faces' > allows the header line in `notmuch-show-mode' buffers to be coloured > according to the tags of the message. This is just a rebased version of > the emacs/notmuch-show.el of David Edmondson's patch > id:"1325006003-27152-1-git-send-email-dme@dme.org" > --- > emacs/notmuch-show.el | 33 +++++++++++++++++++++++++++++---- > 1 files changed, 29 insertions(+), 4 deletions(-) > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el > index 37f0ebb..bb7db6e 100644 > --- a/emacs/notmuch-show.el > +++ b/emacs/notmuch-show.el > @@ -93,6 +93,24 @@ any given message." > :group 'notmuch-show > :group 'notmuch-hooks) > > +(defcustom notmuch-show-line-faces nil > + "Tag to face mapping for header line highlighting in `notmuch-show-mode'. > + > +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 '((\"delete\" . (:foreground \"red\" That should be notmuch-show-line-faces. Jani. > + :background \"blue\")) > + (\"unread\" . (:foreground \"green\")))) > + > +The attributes defined for matching tags are merged, with later > +attributes overriding earlier. A message having both \"delete\" > +and \"unread\" tags with the above settings would have a green > +foreground and blue background." > + :type '(alist :key-type (string) :value-type (custom-face-edit)) > + :group 'notmuch-show > + :group 'notmuch-faces) > + > ;; Mostly useful for debugging. > (defcustom notmuch-show-all-multipart/alternative-parts t > "Should all parts of multipart/alternative parts be shown?" > @@ -411,7 +429,8 @@ unchanged ADDRESS if parsing fails." > (defun notmuch-show-insert-headerline (headers date tags depth) > "Insert a notmuch style headerline based on HEADERS for a > message at DEPTH in the current thread." > - (let ((start (point))) > + (let ((start (point)) > + overlay) > (insert (notmuch-show-spaces-n (* notmuch-show-indent-messages-width depth)) > (notmuch-show-clean-address (plist-get headers :From)) > " (" > @@ -420,7 +439,9 @@ message at DEPTH in the current thread." > (propertize (mapconcat 'identity tags " ") > 'face 'notmuch-tag-face) > ")\n") > - (overlay-put (make-overlay start (point)) 'face 'notmuch-message-summary-face))) > + (setq overlay (make-overlay start (point))) > + (overlay-put overlay 'face 'notmuch-message-summary-face) > + (overlay-put overlay 'priority 2))) > > (defun notmuch-show-insert-header (header header-value) > "Insert a single header." > @@ -852,7 +873,8 @@ current buffer, if possible." > body-start body-end > (headers-invis-spec (notmuch-show-make-symbol "header")) > (message-invis-spec (notmuch-show-make-symbol "message")) > - (bare-subject (notmuch-show-strip-re (plist-get headers :Subject)))) > + (bare-subject (notmuch-show-strip-re (plist-get headers :Subject))) > + (tags (plist-get msg :tags))) > > ;; Set `buffer-invisibility-spec' to `nil' (a list), otherwise > ;; removing items from `buffer-invisibility-spec' (which is what > @@ -877,10 +899,13 @@ current buffer, if possible." > (plist-get msg :date_relative) > nil) > (plist-get headers :Date)) > - (plist-get msg :tags) depth) > + tags depth) > > (setq content-start (point-marker)) > > + ;; Colour the header line according to the tags of the message. > + (notmuch-color-line message-start content-start tags notmuch-show-line-faces) > + > (plist-put msg :headers-invis-spec headers-invis-spec) > (plist-put msg :message-invis-spec message-invis-spec) > > -- > 1.7.9.1 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch