Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 4f / edd00524dbdd533b95d203cef45ff2840e3bbf
1 Return-Path: <amdragon@mit.edu>\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 1E3F3431FBD\r
6         for <notmuch@notmuchmail.org>; Mon, 10 Feb 2014 10:19:16 -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.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id Jo8m2eLcuR4x for <notmuch@notmuchmail.org>;\r
16         Mon, 10 Feb 2014 10:19:08 -0800 (PST)\r
17 Received: from dmz-mailsec-scanner-2.mit.edu (dmz-mailsec-scanner-2.mit.edu\r
18         [18.9.25.13])\r
19         (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 7EFEB431FAF\r
22         for <notmuch@notmuchmail.org>; Mon, 10 Feb 2014 10:19:08 -0800 (PST)\r
23 X-AuditID: 1209190d-f79776d000000ce9-98-52f9181aea65\r
24 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
25         (using TLS with cipher AES256-SHA (256/256 bits))\r
26         (Client did not present a certificate)\r
27         by dmz-mailsec-scanner-2.mit.edu (Symantec Messaging Gateway) with SMTP\r
28         id 47.FD.03305.A1819F25; Mon, 10 Feb 2014 13:19:06 -0500 (EST)\r
29 Received: from outgoing.mit.edu (outgoing-auth-1.mit.edu [18.9.28.11])\r
30         by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id s1AIJ52i020796; \r
31         Mon, 10 Feb 2014 13:19:06 -0500\r
32 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
33         (authenticated bits=0)\r
34         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
35         by outgoing.mit.edu (8.13.8/8.12.4) with ESMTP id s1AIJ3Sp013979\r
36         (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT);\r
37         Mon, 10 Feb 2014 13:19:04 -0500\r
38 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.80)\r
39         (envelope-from <amdragon@mit.edu>)\r
40         id 1WCvRe-00025b-3v; Mon, 10 Feb 2014 13:19:02 -0500\r
41 From: Austin Clements <amdragon@MIT.EDU>\r
42 To: Mark Walters <markwalters1009@gmail.com>, notmuch@notmuchmail.org\r
43 Subject: Re: [PATCH 2/7] emacs: tag: allow default case in notmuch-tag-formats\r
44 In-Reply-To: <1390087855-26194-3-git-send-email-markwalters1009@gmail.com>\r
45 References: <1390087855-26194-1-git-send-email-markwalters1009@gmail.com>\r
46         <1390087855-26194-3-git-send-email-markwalters1009@gmail.com>\r
47 User-Agent: Notmuch/0.17~rc2+14~g06f47e0 (http://notmuchmail.org) Emacs/23.4.1\r
48         (i486-pc-linux-gnu)\r
49 Date: Mon, 10 Feb 2014 13:19:01 -0500\r
50 Message-ID: <87txc6n84q.fsf@awakening.csail.mit.edu>\r
51 MIME-Version: 1.0\r
52 Content-Type: text/plain; charset=us-ascii\r
53 X-Brightmail-Tracker:\r
54  H4sIAAAAAAAAA+NgFnrIIsWRmVeSWpSXmKPExsUixG6noisl8TPI4OtnTYvVc3ksrt+cyezA\r
55         5LFz1l12j2erbjEHMEVx2aSk5mSWpRbp2yVwZcxa/o21YJ5cxbSvV1kaGOdLdDFycEgImEi8\r
56         uCbZxcgJZIpJXLi3nq2LkYtDSGA2k0TfiU/MEM5GRok7u6ZBZU4zSfya94EFwlnCKPFr61Mm\r
57         kH42AQ2JbfuXM4LYIgKuEk+/fWYGsYUF/CSWbd7IDmJzCnhJXDjUxA7R3M4o0bj8EViDqECS\r
58         xOmpv1lBbBYBVYkTE6eANfAC3bf91zRWCFtQ4uTMJywgNrOAlsSNfy+ZJjAKzEKSmoUktYCR\r
59         aRWjbEpulW5uYmZOcWqybnFyYl5eapGukV5uZoleakrpJkZQSHJK8u5gfHdQ6RCjAAejEg+v\r
60         xtcfQUKsiWXFlbmHGCU5mJREeXWFfwYJ8SXlp1RmJBZnxBeV5qQWH2KU4GBWEuGd+RKonDcl\r
61         sbIqtSgfJiXNwaIkzps4402QkEB6YklqdmpqQWoRTFaGg0NJgtdMHGioYFFqempFWmZOCUKa\r
62         iYMTZDgP0PB6kBre4oLE3OLMdIj8KUZFKXHeADGghABIIqM0D64XljJeMYoDvSLM6wnSzgNM\r
63         N3Ddr4AGMwENPtoEcnVxSSJCSqqBUeN1wpxn39k8FPpvGzxjsLid57M35E2kTOJXTT/pg15a\r
64         W7Rt8sx530gruZdG3Ky2+i5t7xCz7rbv/e2enC8T02KsA6axRUYsv984zUHk7OuL63vj/75+\r
65         tfqY1jb3Ekb+lOWKomvKZaPy1U5l+IuYT5zazV63cNmDP+FshivWPF5ek7RL9LWBEktxRqKh\r
66         FnNRcSIABITrH/QCAAA=\r
67 X-BeenThere: notmuch@notmuchmail.org\r
68 X-Mailman-Version: 2.1.13\r
69 Precedence: list\r
70 List-Id: "Use and development of the notmuch mail system."\r
71         <notmuch.notmuchmail.org>\r
72 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
73         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
74 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
75 List-Post: <mailto:notmuch@notmuchmail.org>\r
76 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
77 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
78         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
79 X-List-Received-Date: Mon, 10 Feb 2014 18:19:16 -0000\r
80 \r
81 On Sat, 18 Jan 2014, Mark Walters <markwalters1009@gmail.com> wrote:\r
82 > Allow an empty string in notmuch-tag-formats which matches all tags\r
83 > except those matched explicitly matched. This allows the user to tell\r
84 \r
85 Typo.\r
86 \r
87 > notmuch to hide all tags except those specified.\r
88 >\r
89 > This will be useful once formatting for deleted/added tags is added\r
90 > later in the series: a user might want to hide all deleted tags for\r
91 > example.\r
92 > ---\r
93 >  emacs/notmuch-tag.el |   20 +++++++++++---------\r
94 >  1 files changed, 11 insertions(+), 9 deletions(-)\r
95 >\r
96 > diff --git a/emacs/notmuch-tag.el b/emacs/notmuch-tag.el\r
97 > index 2153068..92c1249 100644\r
98 > --- a/emacs/notmuch-tag.el\r
99 > +++ b/emacs/notmuch-tag.el\r
100 > @@ -65,14 +65,15 @@\r
101 >  This gives a list that maps from tag names to lists of formatting\r
102 >  expressions.  The car of each element gives a tag name and the\r
103 >  cdr gives a list of Elisp expressions that modify the tag.  If\r
104 > -the list is empty, the tag will simply be hidden.  Otherwise,\r
105 > -each expression will be evaluated in order: for the first\r
106 > -expression, the variable `tag' will be bound to the tag name; for\r
107 > -each later expression, the variable `tag' will be bound to the\r
108 > -result of the previous expression.  In this way, each expression\r
109 > -can build on the formatting performed by the previous expression.\r
110 > -The result of the last expression will displayed in place of the\r
111 > -tag.\r
112 > +the car is an empty string it matches all tags that do not have\r
113 > +an explicit match.  If the list is empty, the tag will simply be\r
114 \r
115 Hmm.  I'm not sure I like overloading of the meanings of strings.  Could\r
116 we instead use a symbol to represent this case?  For example, `t' would\r
117 parallel the fall-through case of `cond' and `case', or `_' would\r
118 parallel `pcase' [1].  Or even a separate variable like\r
119 notmuch-tag-default-format?\r
120 \r
121 The former would require some tweaking of the customize widget, but that\r
122 should probably happen anyway to support this special case.\r
123 Unfortunately, we may need a custom alist widget variant to do that.  (I\r
124 tried and failed to tweak it in a way that both worked and looked\r
125 decent.)  Hence my suggestion of a separate variable, which would only\r
126 require pulling out the :value-type into its own define-widget.\r
127 \r
128 I'm also slightly bothered that this would introduce a second way to\r
129 control the default formatting of tags in addition to notmuch-tag-face,\r
130 but only slightly.\r
131 \r
132 [1] It's unfortunate that pcase wasn't introduced until Emacs 24.  I've\r
133 been tempted to backport it for notmuch multiple times now.  Then we\r
134 could just treat notmuch-tag-formats as a list of pcase conditions.\r
135 \r
136 > +hidden.  Otherwise, each expression will be evaluated in order:\r
137 > +for the first expression, the variable `tag' will be bound to the\r
138 > +tag name; for each later expression, the variable `tag' will be\r
139 > +bound to the result of the previous expression.  In this way,\r
140 > +each expression can build on the formatting performed by the\r
141 > +previous expression.  The result of the last expression will\r
142 > +displayed in place of the tag.\r
143 >  \r
144 >  For example, to replace a tag with another string, simply use\r
145 >  that string as a formatting expression.  To change the foreground\r
146 > @@ -140,7 +141,8 @@ This can be used with `notmuch-tag-format-image-data'."\r
147 >  \r
148 >  (defun notmuch-tag-format-tag (tag)\r
149 >    "Format TAG by looking into `notmuch-tag-formats'."\r
150 > -  (let ((formats (assoc tag notmuch-tag-formats)))\r
151 > +  (let ((formats (or (assoc tag notmuch-tag-formats)\r
152 > +                  (assoc "" notmuch-tag-formats))))\r
153 >      (cond\r
154 >       ((null formats)         ;; - Tag not in `notmuch-tag-formats',\r
155 >        tag)                   ;;   the format is the tag itself.\r
156 > -- \r
157 > 1.7.9.1\r
158 >\r
159 > _______________________________________________\r
160 > notmuch mailing list\r
161 > notmuch@notmuchmail.org\r
162 > http://notmuchmail.org/mailman/listinfo/notmuch\r