[PATCH v2 2/7] emacs: tag split customise option for format-tags into a widget
[notmuch-archives.git] / cf / 4982602d4555e5ce25a4968cd366ba1c1b18d6
1 Return-Path: <markwalters1009@gmail.com>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 3C8A9431FDB\r
6         for <notmuch@notmuchmail.org>; Wed, 19 Feb 2014 12:20:46 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: 0.201\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0.201 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_ENVFROM_END_DIGIT=1, FREEMAIL_FROM=0.001,\r
14         RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
15 Received: from olra.theworths.org ([127.0.0.1])\r
16         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
17         with ESMTP id wfkSTnPjjwx6 for <notmuch@notmuchmail.org>;\r
18         Wed, 19 Feb 2014 12:20:40 -0800 (PST)\r
19 Received: from mail-we0-f175.google.com (mail-we0-f175.google.com\r
20         [74.125.82.175]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
21         (No client certificate requested)\r
22         by olra.theworths.org (Postfix) with ESMTPS id A2BD8431FC0\r
23         for <notmuch@notmuchmail.org>; Wed, 19 Feb 2014 12:20:37 -0800 (PST)\r
24 Received: by mail-we0-f175.google.com with SMTP id q59so768293wes.34\r
25         for <notmuch@notmuchmail.org>; Wed, 19 Feb 2014 12:20:35 -0800 (PST)\r
26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;\r
27         h=from:to:cc:subject:date:message-id:in-reply-to:references;\r
28         bh=4LzwHar1hpoICTcNkClFjIR6jB6LwIxFvo6/UMygL54=;\r
29         b=mUL5tzOqb1ZnDBB0LQHxJJAx4P9VAJz98FyH2KIbCI44bJ1Ptzm8mq4N31gceuGdK9\r
30         lpFufBFmcQTkX16F4s/zcBsR+4x8cdz+IM7VPNBorlRTnU5eDzgTKZo3+lkOx5Qfx3ch\r
31         W37vfyYTHasGj3rLcsNUVs413cxjUAxDA6DETmaMQF/pgmMfNBCAcnPdwJK3iaHkf3YF\r
32         bVHgTyHs28m9q9B70yaKtxpImhgjaEwkcCHz/coIzLljGa/of31yIL0hVz2D3VpqYlvM\r
33         cIH7SYzurcsS+f9WrILL0/gSRfeVJdAoDYLfbQaQlVTwGf230UuZappvo7HrnaROT5vv\r
34         K4pw==\r
35 X-Received: by 10.180.35.36 with SMTP id e4mr3444839wij.8.1392841235117;\r
36         Wed, 19 Feb 2014 12:20:35 -0800 (PST)\r
37 Received: from localhost (93-97-24-31.zone5.bethere.co.uk. [93.97.24.31])\r
38         by mx.google.com with ESMTPSA id d6sm4702686wiz.4.2014.02.19.12.20.33\r
39         for <multiple recipients>\r
40         (version=TLSv1.2 cipher=RC4-SHA bits=128/128);\r
41         Wed, 19 Feb 2014 12:20:34 -0800 (PST)\r
42 From: Mark Walters <markwalters1009@gmail.com>\r
43 To: notmuch@notmuchmail.org\r
44 Subject: [PATCH v2 2/7] emacs: tag split customise option for format-tags into\r
45         a widget\r
46 Date: Wed, 19 Feb 2014 20:20:07 +0000\r
47 Message-Id: <1392841212-8494-3-git-send-email-markwalters1009@gmail.com>\r
48 X-Mailer: git-send-email 1.7.9.1\r
49 In-Reply-To: <1392841212-8494-1-git-send-email-markwalters1009@gmail.com>\r
50 References: <1392841212-8494-1-git-send-email-markwalters1009@gmail.com>\r
51 X-BeenThere: notmuch@notmuchmail.org\r
52 X-Mailman-Version: 2.1.13\r
53 Precedence: list\r
54 List-Id: "Use and development of the notmuch mail system."\r
55         <notmuch.notmuchmail.org>\r
56 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
57         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
58 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
59 List-Post: <mailto:notmuch@notmuchmail.org>\r
60 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
61 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
62         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
63 X-List-Received-Date: Wed, 19 Feb 2014 20:20:46 -0000\r
64 \r
65 We will re-use the customize option for format-tags for formattting\r
66 deleted tags to added tags in the next patch so split it into a\r
67 widget. There should be no functional change.\r
68 ---\r
69  emacs/notmuch-tag.el |   55 ++++++++++++++++++++++++++-----------------------\r
70  1 files changed, 29 insertions(+), 26 deletions(-)\r
71 \r
72 diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el\r
73 index 47e0205..878aaf7 100644\r
74 --- a/emacs/notmuch-tag.el\r
75 +++ b/emacs/notmuch-tag.el\r
76 @@ -40,6 +40,34 @@\r
77  This must be called after changes to `notmuch-tag-formats'."\r
78    (clrhash notmuch-tag--format-cache))\r
79  \r
80 +(define-widget 'notmuch-tag-format-type 'lazy\r
81 +  "Customize widget for notmuch-tag-format and friends"\r
82 +  :type '(alist :key-type (regexp :tag "Tag")\r
83 +               :extra-offset -3\r
84 +               :value-type\r
85 +               (radio :format "%v"\r
86 +                      (const :tag "Hidden" nil)\r
87 +                      (set :tag "Modified"\r
88 +                           (string :tag "Display as")\r
89 +                           (list :tag "Face" :extra-offset -4\r
90 +                                 (const :format "" :inline t\r
91 +                                        (propertize tag 'face))\r
92 +                                 (list :format "%v"\r
93 +                                       (const :format "" quote)\r
94 +                                       custom-face-edit))\r
95 +                           (list :format "%v" :extra-offset -4\r
96 +                                 (const :format "" :inline t\r
97 +                                        (notmuch-tag-format-image-data tag))\r
98 +                                 (choice :tag "Image"\r
99 +                                         (const :tag "Star"\r
100 +                                                (notmuch-tag-star-icon))\r
101 +                                         (const :tag "Empty star"\r
102 +                                                (notmuch-tag-star-empty-icon))\r
103 +                                         (const :tag "Tag"\r
104 +                                                (notmuch-tag-tag-icon))\r
105 +                                         (string :tag "Custom")))\r
106 +                           (sexp :tag "Custom")))))\r
107 +\r
108  (defcustom notmuch-tag-formats\r
109    '(("unread" (propertize tag 'face '(:foreground "red")))\r
110      ("flagged" (propertize tag 'face '(:foreground "blue"))\r
111 @@ -69,34 +97,9 @@ of a tag to red, use the expression\r
112  \r
113  See also `notmuch-tag-format-image', which can help replace tags\r
114  with images."\r
115 -\r
116    :group 'notmuch-search\r
117    :group 'notmuch-show\r
118 -  :type '(alist :key-type (regexp :tag "Tag")\r
119 -               :extra-offset -3\r
120 -               :value-type\r
121 -               (radio :format "%v"\r
122 -                      (const :tag "Hidden" nil)\r
123 -                      (set :tag "Modified"\r
124 -                           (string :tag "Display as")\r
125 -                           (list :tag "Face" :extra-offset -4\r
126 -                                 (const :format "" :inline t\r
127 -                                        (propertize tag 'face))\r
128 -                                 (list :format "%v"\r
129 -                                       (const :format "" quote)\r
130 -                                       custom-face-edit))\r
131 -                           (list :format "%v" :extra-offset -4\r
132 -                                 (const :format "" :inline t\r
133 -                                        (notmuch-tag-format-image-data tag))\r
134 -                                 (choice :tag "Image"\r
135 -                                         (const :tag "Star"\r
136 -                                                (notmuch-tag-star-icon))\r
137 -                                         (const :tag "Empty star"\r
138 -                                                (notmuch-tag-star-empty-icon))\r
139 -                                         (const :tag "Tag"\r
140 -                                                (notmuch-tag-tag-icon))\r
141 -                                         (string :tag "Custom")))\r
142 -                           (sexp :tag "Custom")))))\r
143 +  :type 'notmuch-tag-format-type)\r
144  \r
145  (defun notmuch-tag-format-image-data (tag data)\r
146    "Replace TAG with image DATA, if available.\r
147 -- \r
148 1.7.9.1\r
149 \r