From b3098238e9506e496f40469a1b8093ce46dec58e Mon Sep 17 00:00:00 2001 From: Mark Walters Date: Wed, 19 Feb 2014 20:20:07 +0000 Subject: [PATCH] [PATCH v2 2/7] emacs: tag split customise option for format-tags into a widget --- cf/4982602d4555e5ce25a4968cd366ba1c1b18d6 | 149 ++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 cf/4982602d4555e5ce25a4968cd366ba1c1b18d6 diff --git a/cf/4982602d4555e5ce25a4968cd366ba1c1b18d6 b/cf/4982602d4555e5ce25a4968cd366ba1c1b18d6 new file mode 100644 index 000000000..08da7950c --- /dev/null +++ b/cf/4982602d4555e5ce25a4968cd366ba1c1b18d6 @@ -0,0 +1,149 @@ +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 3C8A9431FDB + for ; Wed, 19 Feb 2014 12:20:46 -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 wfkSTnPjjwx6 for ; + Wed, 19 Feb 2014 12:20:40 -0800 (PST) +Received: from mail-we0-f175.google.com (mail-we0-f175.google.com + [74.125.82.175]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id A2BD8431FC0 + for ; Wed, 19 Feb 2014 12:20:37 -0800 (PST) +Received: by mail-we0-f175.google.com with SMTP id q59so768293wes.34 + for ; Wed, 19 Feb 2014 12:20:35 -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=4LzwHar1hpoICTcNkClFjIR6jB6LwIxFvo6/UMygL54=; + b=mUL5tzOqb1ZnDBB0LQHxJJAx4P9VAJz98FyH2KIbCI44bJ1Ptzm8mq4N31gceuGdK9 + lpFufBFmcQTkX16F4s/zcBsR+4x8cdz+IM7VPNBorlRTnU5eDzgTKZo3+lkOx5Qfx3ch + W37vfyYTHasGj3rLcsNUVs413cxjUAxDA6DETmaMQF/pgmMfNBCAcnPdwJK3iaHkf3YF + bVHgTyHs28m9q9B70yaKtxpImhgjaEwkcCHz/coIzLljGa/of31yIL0hVz2D3VpqYlvM + cIH7SYzurcsS+f9WrILL0/gSRfeVJdAoDYLfbQaQlVTwGf230UuZappvo7HrnaROT5vv + K4pw== +X-Received: by 10.180.35.36 with SMTP id e4mr3444839wij.8.1392841235117; + Wed, 19 Feb 2014 12:20:35 -0800 (PST) +Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31]) + by mx.google.com with ESMTPSA id d6sm4702686wiz.4.2014.02.19.12.20.33 + for + (version=TLSv1.2 cipher=RC4-SHA bits=128/128); + Wed, 19 Feb 2014 12:20:34 -0800 (PST) +From: Mark Walters +To: notmuch@notmuchmail.org +Subject: [PATCH v2 2/7] emacs: tag split customise option for format-tags into + a widget +Date: Wed, 19 Feb 2014 20:20:07 +0000 +Message-Id: <1392841212-8494-3-git-send-email-markwalters1009@gmail.com> +X-Mailer: git-send-email 1.7.9.1 +In-Reply-To: <1392841212-8494-1-git-send-email-markwalters1009@gmail.com> +References: <1392841212-8494-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: Wed, 19 Feb 2014 20:20:46 -0000 + +We will re-use the customize option for format-tags for formattting +deleted tags to added tags in the next patch so split it into a +widget. There should be no functional change. +--- + emacs/notmuch-tag.el | 55 ++++++++++++++++++++++++++----------------------- + 1 files changed, 29 insertions(+), 26 deletions(-) + +diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el +index 47e0205..878aaf7 100644 +--- a/emacs/notmuch-tag.el ++++ b/emacs/notmuch-tag.el +@@ -40,6 +40,34 @@ + This must be called after changes to `notmuch-tag-formats'." + (clrhash notmuch-tag--format-cache)) + ++(define-widget 'notmuch-tag-format-type 'lazy ++ "Customize widget for notmuch-tag-format and friends" ++ :type '(alist :key-type (regexp :tag "Tag") ++ :extra-offset -3 ++ :value-type ++ (radio :format "%v" ++ (const :tag "Hidden" nil) ++ (set :tag "Modified" ++ (string :tag "Display as") ++ (list :tag "Face" :extra-offset -4 ++ (const :format "" :inline t ++ (propertize tag 'face)) ++ (list :format "%v" ++ (const :format "" quote) ++ custom-face-edit)) ++ (list :format "%v" :extra-offset -4 ++ (const :format "" :inline t ++ (notmuch-tag-format-image-data tag)) ++ (choice :tag "Image" ++ (const :tag "Star" ++ (notmuch-tag-star-icon)) ++ (const :tag "Empty star" ++ (notmuch-tag-star-empty-icon)) ++ (const :tag "Tag" ++ (notmuch-tag-tag-icon)) ++ (string :tag "Custom"))) ++ (sexp :tag "Custom"))))) ++ + (defcustom notmuch-tag-formats + '(("unread" (propertize tag 'face '(:foreground "red"))) + ("flagged" (propertize tag 'face '(:foreground "blue")) +@@ -69,34 +97,9 @@ of a tag to red, use the expression + + See also `notmuch-tag-format-image', which can help replace tags + with images." +- + :group 'notmuch-search + :group 'notmuch-show +- :type '(alist :key-type (regexp :tag "Tag") +- :extra-offset -3 +- :value-type +- (radio :format "%v" +- (const :tag "Hidden" nil) +- (set :tag "Modified" +- (string :tag "Display as") +- (list :tag "Face" :extra-offset -4 +- (const :format "" :inline t +- (propertize tag 'face)) +- (list :format "%v" +- (const :format "" quote) +- custom-face-edit)) +- (list :format "%v" :extra-offset -4 +- (const :format "" :inline t +- (notmuch-tag-format-image-data tag)) +- (choice :tag "Image" +- (const :tag "Star" +- (notmuch-tag-star-icon)) +- (const :tag "Empty star" +- (notmuch-tag-star-empty-icon)) +- (const :tag "Tag" +- (notmuch-tag-tag-icon)) +- (string :tag "Custom"))) +- (sexp :tag "Custom"))))) ++ :type 'notmuch-tag-format-type) + + (defun notmuch-tag-format-image-data (tag data) + "Replace TAG with image DATA, if available. +-- +1.7.9.1 + -- 2.26.2