From 2444e023462205d7f52c4ae016f185a010173f89 Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Sat, 22 Mar 2014 07:47:39 +0000 Subject: [PATCH] Re: [Patch v3 4/8] emacs: tag: add customize for deleted/added tag formats --- ce/1e96b67af20740ebcf866dbcc6af82224b465c | 186 ++++++++++++++++++++++ 1 file changed, 186 insertions(+) create mode 100644 ce/1e96b67af20740ebcf866dbcc6af82224b465c diff --git a/ce/1e96b67af20740ebcf866dbcc6af82224b465c b/ce/1e96b67af20740ebcf866dbcc6af82224b465c new file mode 100644 index 000000000..fc64a7407 --- /dev/null +++ b/ce/1e96b67af20740ebcf866dbcc6af82224b465c @@ -0,0 +1,186 @@ +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 58F50431FBC + for ; Sat, 22 Mar 2014 00:47:52 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -1.098 +X-Spam-Level: +X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5 + tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001, + NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] 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 LwvCwlMdCfhz for ; + Sat, 22 Mar 2014 00:47:48 -0700 (PDT) +Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6]) + (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 01D1A431FAE + for ; Sat, 22 Mar 2014 00:47:47 -0700 (PDT) +Received: from smtp.qmul.ac.uk ([138.37.6.40]) + by mail2.qmul.ac.uk with esmtp (Exim 4.71) + (envelope-from ) + id 1WRGeb-00039i-Fd; Sat, 22 Mar 2014 07:47:41 +0000 +Received: from 93-97-24-31.zone5.bethere.co.uk ([93.97.24.31] helo=localhost) + by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.71) + (envelope-from ) + id 1WRGea-0004OQ-SI; Sat, 22 Mar 2014 07:47:41 +0000 +From: Mark Walters +To: Austin Clements +Subject: Re: [Patch v3 4/8] emacs: tag: add customize for deleted/added tag + formats +In-Reply-To: <20140322021609.GB31187@mit.edu> +References: <1394597397-8486-1-git-send-email-markwalters1009@gmail.com> + <1394597397-8486-5-git-send-email-markwalters1009@gmail.com> + <20140322021609.GB31187@mit.edu> +User-Agent: Notmuch/0.15.2+615~g78e3a93 (http://notmuchmail.org) Emacs/23.4.1 + (x86_64-pc-linux-gnu) +Date: Sat, 22 Mar 2014 07:47:39 +0000 +Message-ID: <87ior6oesk.fsf@qmul.ac.uk> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +X-Sender-Host-Address: 93.97.24.31 +X-QM-Geographic: According to ripencc, + this message was delivered by a machine in Britain (UK) (GB). +X-QM-SPAM-Info: Sender has good ham record. :) +X-QM-Body-MD5: 033e6cf192a41b6134c9b330e4d76b83 (of first 20000 bytes) +X-SpamAssassin-Score: 0.0 +X-SpamAssassin-SpamBar: / +X-SpamAssassin-Report: The QM spam filters have analysed this message to + determine if it is + spam. We require at least 5.0 points to mark a message as spam. + This message scored 0.0 points. Summary of the scoring: + * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail + provider * (markwalters1009[at]gmail.com) + * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay + * domain + * 0.0 AWL AWL: From: address is in the auto white-list +X-QM-Scan-Virus: ClamAV says the message is clean +Cc: notmuch@notmuchmail.org +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, 22 Mar 2014 07:47:52 -0000 + + +Hi + +Many thanks for the review. + +On Sat, 22 Mar 2014, Austin Clements wrote: +> Quoth Mark Walters on Mar 12 at 4:09 am: +>> Add customize options for deleted/added tag formats. These are not +>> used yet but will be later in the series. +>> +>> We switch to using `notmuch-apply-face' rather than `propertize' in +>> the defcustom for faces so that the faces for deleted/added tags add +>> to the default face attributes for the tag. +>> +>> We special case deleting the unread tag as that tag is a strong visual +>> cue and we don't need that cue when we are just saying it used to be +>> unread. Thus, we revert to the normal tag face with strikethough for +>> deleted unread tags. +>> --- +>> emacs/notmuch-tag.el | 37 ++++++++++++++++++++++++++++++++++++- +>> 1 files changed, 36 insertions(+), 1 deletions(-) +>> +>> diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el +>> index a4dea39..4698856 100644 +>> --- a/emacs/notmuch-tag.el +>> +++ b/emacs/notmuch-tag.el +>> @@ -39,7 +39,7 @@ (define-widget 'notmuch-tag-format-type 'lazy +>> (string :tag "Display as") +>> (list :tag "Face" :extra-offset -4 +>> (const :format "" :inline t +>> - (propertize tag 'face)) +>> + (notmuch-apply-face tag)) +>> (list :format "%v" +>> (const :format "" quote) +>> custom-face-edit)) +>> @@ -89,6 +89,41 @@ (defcustom notmuch-tag-formats +>> :group 'notmuch-show +>> :type 'notmuch-tag-format-type) +>> +>> +(defcustom notmuch-tag-deleted-formats +>> + '(("unread" (notmuch-apply-face "unread" +>> + (if (display-supports-face-attributes-p '(:strike-through "red")) +>> + '(:strike-through "red") +>> + '(:inverse-video t)))) +>> + (".*" (notmuch-apply-face tag +>> + (if (display-supports-face-attributes-p '(:strike-through "red")) +>> + '(:strike-through "red") +>> + '(:inverse-video t))))) +> +> Aren't the two formatters above the same thing? Is this somehow +> different from just having the .* formatter? The indentation also +> seems a little odd, though that may just be the diff. + +These are not the same because these functions apply to tag which is the +partially formatted tag, not tag itself. Thus the latter applies the +above formatting to the string "unread" rather than `tag' which would be +the string unread with previous formatting applied. + +It might be nice to change the name in the function so a formatter has +access to tag and formatted-tag but that would break people's existing +formats. + +> +>> + "Custom formats for tags when deleted. +>> + +>> +For deleted tags the formats in `notmuch-tag-formats` are applied +>> +first and then these formats are applied on top. +>> + +>> +By default this shows deleted tags with strike-through in red, +>> +unless strike-through is not available (e.g., emacs is running in +>> +a terminal) in which case it uses inverse video. To hide deleted +>> +tags completely set this to +>> + '((\".*\" nil)) +>> + +>> +See `notmuch-tag-formats' for full documentation." +>> + :group 'notmuch-show +>> + :type 'notmuch-tag-format-type) +>> + +>> +(defcustom notmuch-tag-added-formats +>> + '((".*" (notmuch-apply-face tag '(:underline "green")))) +>> + "Custom formats for tags when added. +>> + +>> +For added tags the formats in `notmuch-tag-formats` are applied +>> +first and then these formats are applied on top. +> +> Maybe add +> +> To disable special formatting of added tags, set this to (). +> +> to parallel notmuch-tag-deleted-formats? + +Yes this is a good point as it is not obvious what the correct form is +as it is different from the deleted case (here we want to apply no +further formatting to the tag so it shows as normal, there we wanted to +hide the tag) + +Best wishes + +Mark + + +> +>> + +>> +See `notmuch-tag-formats' for full documentation." +>> + :group 'notmuch-show +>> + :type 'notmuch-tag-format-type) +>> + +>> (defun notmuch-tag-format-image-data (tag data) +>> "Replace TAG with image DATA, if available. +>> -- 2.26.2