Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / 2c / 6cabc6207bb406056d9c395848b67a4271dea6
1 Return-Path: <pieter@praet.org>\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 1377B431FD0\r
6         for <notmuch@notmuchmail.org>; Thu,  7 Jul 2011 01:07:06 -0700 (PDT)\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 uLdYuC+EiAYn for <notmuch@notmuchmail.org>;\r
16         Thu,  7 Jul 2011 01:07:05 -0700 (PDT)\r
17 Received: from mail-wy0-f181.google.com (mail-wy0-f181.google.com\r
18         [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id 2696E431FB6\r
21         for <notmuch@notmuchmail.org>; Thu,  7 Jul 2011 01:07:05 -0700 (PDT)\r
22 Received: by wyh22 with SMTP id 22so507904wyh.26\r
23         for <notmuch@notmuchmail.org>; Thu, 07 Jul 2011 01:07:03 -0700 (PDT)\r
24 Received: by 10.227.207.207 with SMTP id fz15mr426974wbb.76.1310026023751;\r
25         Thu, 07 Jul 2011 01:07:03 -0700 (PDT)\r
26 Received: from localhost ([109.131.160.107])\r
27         by mx.google.com with ESMTPS id b13sm6673393wbh.58.2011.07.07.01.07.02\r
28         (version=TLSv1/SSLv3 cipher=OTHER);\r
29         Thu, 07 Jul 2011 01:07:02 -0700 (PDT)\r
30 From: Pieter Praet <pieter@praet.org>\r
31 To: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>,\r
32         Daniel Schoepe <daniel.schoepe@googlemail.com>, notmuch@notmuchmail.org\r
33 Subject: Re: [PATCH v2] emacs: Turn id:"<message-id>" elements into buttons\r
34         for notmuch searches\r
35 In-Reply-To: <87r5624l3g.fsf@gmail.com>\r
36 References: <1309896760-378-1-git-send-email-daniel.schoepe@googlemail.com>\r
37         <1309961881-28333-1-git-send-email-daniel.schoepe@googlemail.com>\r
38         <1309961881-28333-2-git-send-email-daniel.schoepe@googlemail.com>\r
39         <87r5624l3g.fsf@gmail.com>\r
40 User-Agent: Notmuch/0.5-331-g04cf689 (http://notmuchmail.org) Emacs/23.1.50.1\r
41         (x86_64-pc-linux-gnu)\r
42 Date: Thu, 07 Jul 2011 10:07:00 +0200\r
43 Message-ID: <87sjqifra3.fsf@praet.org>\r
44 MIME-Version: 1.0\r
45 Content-Type: text/plain; charset=us-ascii\r
46 X-BeenThere: notmuch@notmuchmail.org\r
47 X-Mailman-Version: 2.1.13\r
48 Precedence: list\r
49 List-Id: "Use and development of the notmuch mail system."\r
50         <notmuch.notmuchmail.org>\r
51 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
53 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
54 List-Post: <mailto:notmuch@notmuchmail.org>\r
55 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
56 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
57         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
58 X-List-Received-Date: Thu, 07 Jul 2011 08:07:06 -0000\r
59 \r
60 On Thu, 07 Jul 2011 11:16:03 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:\r
61 > Hi Daniel.\r
62\r
63 > On Wed,  6 Jul 2011 16:18:01 +0200, Daniel Schoepe <daniel.schoepe@googlemail.com> wrote:\r
64 > > This fixes the minor annoyance that message ids were parsed as mail\r
65 > > addresses by goto-address-mode in notmuch-show buffers.\r
66\r
67 > I did not try it yet but it looks like a nice feature.  Though I have\r
68 > some questions on the code below.\r
69\r
70 > > ---\r
71 > >  emacs/notmuch-show.el |   24 +++++++++++++++++++++---\r
72 > >  1 files changed, 21 insertions(+), 3 deletions(-)\r
73 > > \r
74 > > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
75 > > index f96743b..f924d17 100644\r
76 > > --- a/emacs/notmuch-show.el\r
77 > > +++ b/emacs/notmuch-show.el\r
78 > > @@ -27,6 +27,7 @@\r
79 > >  (require 'mm-decode)\r
80 > >  (require 'mailcap)\r
81 > >  (require 'icalendar)\r
82 > > +(require 'goto-addr)\r
83 > >  \r
84 > >  (require 'notmuch-lib)\r
85 > >  (require 'notmuch-query)\r
86 > > @@ -778,6 +779,24 @@ current buffer, if possible."\r
87 > >  (defvar notmuch-show-parent-buffer nil)\r
88 > >  (make-variable-buffer-local 'notmuch-show-parent-buffer)\r
89 > >  \r
90 > > +(defun notmuch-show-buttonise-links (start end)\r
91 > > +  "Buttonise URLs and mail addresses between START and END.\r
92 > > +\r
93 > > +This also turns id:\"<message id>\"-parts into buttons for\r
94 > > +a corresponding notmuch search."\r
95 > > +  (goto-address-fontify-region start end)\r
96 > > +  (save-excursion\r
97 > > +    (goto-char start)\r
98 > > +    (while (re-search-forward "id:\"[^ ]+\"" end t)\r
99 > > +      ;; remove the overlay created by goto-address-mode\r
100 > > +      (remove-overlays (match-beginning 0) (match-end 0) 'goto-address t)\r
101\r
102 > Why do we need to remove `goto-address-mode' overlays if it is not\r
103 > enabled ((goto-address-mode t) is below is removed)?\r
104 \r
105 Because those overlays got added by `goto-address-fontify-region'.\r
106 \r
107 In fact, all `goto-address-mode' does, essentially, is call\r
108   (jit-lock-register #'goto-address-fontify-region)\r
109 \r
110 > > +      (make-text-button (match-beginning 0) (match-end 0)\r
111 > > +                   'action `(lambda (arg)\r
112 > > +                              (notmuch-search ,(match-string-no-properties 0)))\r
113 > > +                   'follow-link t\r
114 > > +                   'help-echo "Mouse-1, RET: search for this message"\r
115 > > +                   'face goto-address-mail-face))))\r
116 > > +\r
117 > >  ;;;###autoload\r
118 > >  (defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name crypto-switch)\r
119 > >    "Run \"notmuch show\" with the given thread ID and display results.\r
120 > > @@ -822,9 +841,8 @@ function is used. "\r
121 > >       (notmuch-show-insert-forest\r
122 > >        (notmuch-query-get-threads basic-args))))\r
123 > >  \r
124 > > -      ;; Enable buttonisation of URLs and email addresses in the\r
125 > > -      ;; buffer.\r
126 > > -      (goto-address-mode t)\r
127\r
128 > `goto-address-mode' creates buttons not only for email addresses but\r
129 > also for URLs.  Do we loose it now?\r
130 \r
131 Nope, everything remains functional.\r
132 \r
133 > Regards,\r
134 >   Dmitry\r
135\r
136 > > +      (jit-lock-register #'notmuch-show-buttonise-links)\r
137 > > +\r
138 > >        ;; Act on visual lines rather than logical lines.\r
139 > >        (visual-line-mode t)\r
140 > >  \r
141 > > -- \r
142 > > 1.7.5.4\r
143 > > \r
144 > > _______________________________________________\r
145 > > notmuch mailing list\r
146 > > notmuch@notmuchmail.org\r
147 > > http://notmuchmail.org/mailman/listinfo/notmuch\r
148 > _______________________________________________\r
149 > notmuch mailing list\r
150 > notmuch@notmuchmail.org\r
151 > http://notmuchmail.org/mailman/listinfo/notmuch\r
152 \r
153 \r
154 Peace\r
155 \r
156 -- \r
157 Pieter\r