Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 73 / cda62f4170459a9c93c3ad445f65469abb13d2
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 A6B8E431FD4\r
6         for <notmuch@notmuchmail.org>; Mon, 19 Nov 2012 21:32:21 -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 SBjQ5qZr9bbq for <notmuch@notmuchmail.org>;\r
16         Mon, 19 Nov 2012 21:32:20 -0800 (PST)\r
17 Received: from dmz-mailsec-scanner-5.mit.edu (DMZ-MAILSEC-SCANNER-5.MIT.EDU\r
18         [18.7.68.34])\r
19         by olra.theworths.org (Postfix) with ESMTP id 997CB431E64\r
20         for <notmuch@notmuchmail.org>; Mon, 19 Nov 2012 21:32:19 -0800 (PST)\r
21 X-AuditID: 12074422-b7f746d0000008cc-82-50ab15e390eb\r
22 Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
23         by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id C5.CF.02252.3E51BA05; Tue, 20 Nov 2012 00:32:19 -0500 (EST)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id qAK5WIiP010654; \r
27         Tue, 20 Nov 2012 00:32:19 -0500\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
29         (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id qAK5WHKk001271\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Tue, 20 Nov 2012 00:32:18 -0500 (EST)\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
35         (envelope-from <amdragon@mit.edu>)\r
36         id 1TagRU-0000Kh-Rq; Tue, 20 Nov 2012 00:32:16 -0500\r
37 Date: Tue, 20 Nov 2012 00:32:16 -0500\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: Damien Cassou <damien.cassou@gmail.com>\r
40 Subject: Re: [PATCH 3/4] emacs: Make tags that appear in `notmuch-show'\r
41         clickable\r
42 Message-ID: <20121120053216.GG22284@mit.edu>\r
43 References: <1353266322-20318-1-git-send-email-damien.cassou@gmail.com>\r
44         <1353266322-20318-4-git-send-email-damien.cassou@gmail.com>\r
45 MIME-Version: 1.0\r
46 Content-Type: text/plain; charset=us-ascii\r
47 Content-Disposition: inline\r
48 In-Reply-To: <1353266322-20318-4-git-send-email-damien.cassou@gmail.com>\r
49 User-Agent: Mutt/1.5.21 (2010-09-15)\r
50 X-Brightmail-Tracker:\r
51  H4sIAAAAAAAAA+NgFmplleLIzCtJLcpLzFFi42IRYrdT0X0sujrAYMoDLotdd7cyWVy/OZPZ\r
52         gclj56y77B7PVt1iDmCK4rJJSc3JLEst0rdL4MqY9OsSe8EE+YrDE/awNDAel+hi5OSQEDCR\r
53         +LjnKhOELSZx4d56ti5GLg4hgX2MEkt3bGCBcDYwSlxsmc0K4ZxkkuiY9pYZwlnCKDH9QRMb\r
54         SD+LgKrEzQkLmEFsNgENiW37lzOC2CIC2hJvlnawgtjMAkYS93dMB6sRFgiW+Hu7hwXE5hXQ\r
55         kbi0bR47xNBWRomPd7awQSQEJU7OfMIC0awlcePfS6BjOYBsaYnl/zhAwpwCHhJ9i96B/SAq\r
56         oCIx5eQ2tgmMQrOQdM9C0j0LoXsBI/MqRtmU3Crd3MTMnOLUZN3i5MS8vNQiXVO93MwSvdSU\r
57         0k2M4NB2UdrB+POg0iFGAQ5GJR7eBwmrAoRYE8uKK3MPMUpyMCmJ8m4QXh0gxJeUn1KZkVic\r
58         EV9UmpNafIhRgoNZSYS3qRyonDclsbIqtSgfJiXNwaIkznst5aa/kEB6YklqdmpqQWoRTFaG\r
59         g0NJgne3CNBQwaLU9NSKtMycEoQ0EwcnyHAeoOGnQGp4iwsSc4sz0yHypxgVpcR5H4AkBEAS\r
60         GaV5cL2w1POKURzoFWHeryBVPMC0Bdf9CmgwE9DgawHLQQaXJCKkpBoYZU46yuVZPNk7T+Oj\r
61         3aHf9gqqzjpSK7bWyL9TPqXGaFh4pF26z+rWfNMvT+7XqkVzP7j+Wlpm0r7Tjv+qmq4dfr94\r
62         4ev9iwIW8Hgkp55Kn+l3J/+4oFADs0oHw16T4xX7Y39Jv9sjPXOP4+Zpx05lbjWRPvqCqZj9\r
63         5UxLJrXJ3989lZ02eY7SeSWW4oxEQy3mouJEAEU3EvIYAwAA\r
64 Cc: notmuch mailing list <notmuch@notmuchmail.org>\r
65 X-BeenThere: notmuch@notmuchmail.org\r
66 X-Mailman-Version: 2.1.13\r
67 Precedence: list\r
68 List-Id: "Use and development of the notmuch mail system."\r
69         <notmuch.notmuchmail.org>\r
70 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
71         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
72 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
73 List-Post: <mailto:notmuch@notmuchmail.org>\r
74 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
75 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
76         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
77 X-List-Received-Date: Tue, 20 Nov 2012 05:32:22 -0000\r
78 \r
79 Quoth Damien Cassou on Nov 18 at  8:18 pm:\r
80 > Signed-off-by: Damien Cassou <damien.cassou@gmail.com>\r
81 > ---\r
82 >  emacs/notmuch-show.el   |    9 +++++----\r
83 >  emacs/notmuch-tagger.el |   33 +++++++++++++++++++++++++++++++++\r
84 >  2 files changed, 38 insertions(+), 4 deletions(-)\r
85\r
86 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
87 > index 988e27c..379c8cd 100644\r
88 > --- a/emacs/notmuch-show.el\r
89 > +++ b/emacs/notmuch-show.el\r
90 > @@ -431,10 +431,11 @@ message at DEPTH in the current thread."\r
91 >           (notmuch-show-clean-address (plist-get headers :From))\r
92 >           " ("\r
93 >           date\r
94 > -         ") ("\r
95 > -         (propertize (mapconcat 'identity tags " ")\r
96 > -                     'face 'notmuch-tag-face)\r
97 > -         ")\n")\r
98 > +         ") "\r
99 > +         (propertize\r
100 > +          (format-mode-line (notmuch-tagger-present-tags tags))\r
101 > +          'face 'notmuch-tag-face)\r
102 > +         "\n")\r
103 >      (overlay-put (make-overlay start (point)) 'face 'notmuch-message-summary-face)))\r
104 >  \r
105 >  (defun notmuch-show-insert-header (header header-value)\r
106 > diff --git a/emacs/notmuch-tagger.el b/emacs/notmuch-tagger.el\r
107 > index 19a6c7e..379a905 100644\r
108 > --- a/emacs/notmuch-tagger.el\r
109 > +++ b/emacs/notmuch-tagger.el\r
110 > @@ -53,12 +53,21 @@ test if the library is present before calling this function."\r
111 >    (let ((tag (header-button-get button 'notmuch-tagger-tag)))\r
112 >      (notmuch-tagger-goto-target tag)))\r
113 >  \r
114 > +(defun notmuch-tagger-body-button-action (button)\r
115 > +  "Open `notmuch-search' for the tag referenced by BUTTON."\r
116 > +  (let ((tag (button-get button 'notmuch-tagger-tag)))\r
117 > +    (notmuch-tagger-goto-target tag)))\r
118 > +\r
119 >  (eval-after-load "header-button"\r
120 >    '(define-button-type 'notmuch-tagger-header-button-type\r
121 >       'supertype 'header\r
122 >       'action    #'notmuch-tagger-header-button-action\r
123 >       'follow-link t))\r
124 >  \r
125 > +(define-button-type 'notmuch-tagger-body-button-type\r
126 > +  'action    #'notmuch-tagger-body-button-action\r
127 > +  'follow-link t)\r
128 > +\r
129 >  (defun notmuch-tagger-really-make-header-link (tag)\r
130 >     "Return a property list that presents a link to TAG.\r
131 >  \r
132 > @@ -82,6 +91,19 @@ if not."\r
133 >        (notmuch-tagger-really-make-header-link tag)\r
134 >      tag))\r
135 >  \r
136 > +(defun notmuch-tagger-make-body-link (tag)\r
137 > +  "Return a property list that presents a link to TAG.\r
138 > +The returned property list will work everywhere except in the\r
139 > +header-line. For a link that works on the header-line, prefer\r
140 > +`notmuch-tagger-make-header-link'."\r
141 > +  (let ((button (copy-sequence tag)))\r
142 > +    (make-text-button\r
143 > +     button nil\r
144 > +     'type 'notmuch-tagger-body-button-type\r
145 > +     'notmuch-tagger-tag tag\r
146 > +     'help-echo (format "%s: Search other messages like this" tag))\r
147 > +    button))\r
148 > +\r
149 >  (defun notmuch-tagger-present-tags-header-line (tags)\r
150 >    "Return a property list to present TAGS in emacs header-line."\r
151 >    (list\r
152 > @@ -91,6 +113,17 @@ if not."\r
153 >              " ")\r
154 >     ")"))\r
155 >  \r
156 > +(defun notmuch-tagger-present-tags (tags)\r
157 \r
158 notmuch-tagger-format-tags?\r
159 \r
160 > +  "Return a property list to present TAGS in emacs.\r
161 \r
162 Same comment about the comment as in patch 1.\r
163 \r
164 Though is this really the right interface?  Is it useful to return a\r
165 mode-line-format template from this, given that it can't be used in\r
166 the mode-line or header-line since the buttons won't work?  Should\r
167 this just return a string that can be inserted into a buffer?\r
168 Something like (untested),\r
169 \r
170 (defun notmuch-tagger-format-tags (tags)\r
171   "Format TAGS as a string suitable for insertion in a buffer."\r
172   (concat "(" (mapconcat #'notmuch-tagger-make-body-link tags " ") ")"))\r
173 \r
174 > +If tags the result of this function is to be used within the\r
175 > +header-line, prefer `notmuch-tagger-present-tags-header-line'\r
176 > +instead of this function."\r
177 > +  (list\r
178 > +   "("\r
179 > +   (notmuch-tagger-separate-elems\r
180 > +    (mapcar #'notmuch-tagger-make-body-link tags)\r
181 > +            " ")\r
182 > +   ")"))\r
183 >  \r
184 >  (provide 'notmuch-tagger)\r
185 >  ;;; notmuch-tagger.el ends here\r