From: Mark Walters Date: Sat, 22 Mar 2014 11:51:08 +0000 (+0000) Subject: [Patch v4 4/8] emacs: tag: add customize for deleted/added tag formats X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=c665d6aa8a0deee6b966a59f7b536b4a543fce14;p=notmuch-archives.git [Patch v4 4/8] emacs: tag: add customize for deleted/added tag formats --- diff --git a/bb/97603d566bed75aaeaba2392380f0f61e476b4 b/bb/97603d566bed75aaeaba2392380f0f61e476b4 new file mode 100644 index 000000000..9d5218b8f --- /dev/null +++ b/bb/97603d566bed75aaeaba2392380f0f61e476b4 @@ -0,0 +1,147 @@ +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 B6034431E82 + for ; Sat, 22 Mar 2014 04:51:41 -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 FxR2+65PBpco for ; + Sat, 22 Mar 2014 04:51:36 -0700 (PDT) +Received: from mail-we0-f172.google.com (mail-we0-f172.google.com + [74.125.82.172]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 754AB431FC7 + for ; Sat, 22 Mar 2014 04:51:30 -0700 (PDT) +Received: by mail-we0-f172.google.com with SMTP id t61so2289928wes.31 + for ; Sat, 22 Mar 2014 04:51:29 -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:in-reply-to:references; + bh=3mn4Z8Novthzzmi09A36uvLhNRHsr55R10VctPoTDj8=; + b=0hlIfUEkb/sM1XZsXks10EXbP2/Mptxvt6Xz+s3VaHBmTt99JWHmSZFlBvQnuYqpwN + Wzxnw1zZEscYRKA6Xz11nE7Ubis6C/Bo+PwHeUOWfyA46JdC10BIs2BulbXzQPRsXaK0 + mnfWCkwYL+ZuLECcO5oQDm2QJfO28/3ocF08J3KPgICMnc/zajLAMkAab5IhhK49DbBV + CoOyNx5CdvkJ+PYtOZyTJw+QU5zLc5gHEyntyH2LlxpjgOxRMCeNMhfTfzbFMTx7869/ + BWJOEfFaq7Xlw0l1qL1enEk6Dt7zms3rGADz3Ghh6hEV4+xxI9L8fdokbkh+56O0DftF + eaQA== +X-Received: by 10.180.98.35 with SMTP id ef3mr3313453wib.39.1395489089404; + Sat, 22 Mar 2014 04:51:29 -0700 (PDT) +Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) + by mx.google.com with ESMTPSA id + bj3sm16866803wjb.14.2014.03.22.04.51.28 for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Sat, 22 Mar 2014 04:51:28 -0700 (PDT) +From: Mark Walters +To: notmuch@notmuchmail.org, + amdragon@mit.edu +Subject: [Patch v4 4/8] emacs: tag: add customize for deleted/added tag + formats +Date: Sat, 22 Mar 2014 11:51:08 +0000 +Message-Id: <1395489072-19001-5-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.10.4 +In-Reply-To: <1395489072-19001-1-git-send-email-markwalters1009@gmail.com> +References: <1395489072-19001-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, 22 Mar 2014 11:51:42 -0000 + +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 | 46 +++++++++++++++++++++++++++++++++++++++++++++- + 1 file changed, 45 insertions(+), 1 deletion(-) + +diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el +index a4dea39..3ae5e62 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)) +@@ -87,6 +87,50 @@ (defcustom notmuch-tag-formats + with images." + :group 'notmuch-search + :group 'notmuch-show ++ :group 'notmuch-faces ++ :type 'notmuch-tag-format-type) ++ ++(defcustom notmuch-tag-deleted-formats ++ '(("unread" (notmuch-apply-face bare-tag ++ (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))))) ++ "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; that is `tag' ++passed to the function is the tag with all these previous ++formattings applied. The formatted can access the original ++unformatted tag as `bare-tag'. ++ ++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 ++ :group 'notmuch-faces ++ :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. ++ ++To disable special formatting of added tags, set this variable to ++nil. ++ ++See `notmuch-tag-formats' for full documentation." ++ :group 'notmuch-show ++ :group 'notmuch-faces + :type 'notmuch-tag-format-type) + + (defun notmuch-tag-format-image-data (tag data) +-- +1.7.10.4 +