Re: [feature request] emacs: use `notmuch insert` for FCC
[notmuch-archives.git] / 4f / e4e6ed575225573c54ac7810be06a33697e872
1 Return-Path: <dmitry.kurochkin@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 B5E97431FD0\r
6         for <notmuch@notmuchmail.org>; Thu,  7 Jul 2011 00:16:13 -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.799\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5\r
12         tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,\r
13         FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
14 Received: from olra.theworths.org ([127.0.0.1])\r
15         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
16         with ESMTP id 5PBJ+8X-tGqS for <notmuch@notmuchmail.org>;\r
17         Thu,  7 Jul 2011 00:16:12 -0700 (PDT)\r
18 Received: from mail-bw0-f53.google.com (mail-bw0-f53.google.com\r
19         [209.85.214.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
20         (No client certificate requested)\r
21         by olra.theworths.org (Postfix) with ESMTPS id 5B5E7431FB6\r
22         for <notmuch@notmuchmail.org>; Thu,  7 Jul 2011 00:16:12 -0700 (PDT)\r
23 Received: by bwg12 with SMTP id 12so715996bwg.26\r
24         for <notmuch@notmuchmail.org>; Thu, 07 Jul 2011 00:16:11 -0700 (PDT)\r
25 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
26         h=from:to:subject:in-reply-to:references:user-agent:date:message-id\r
27         :mime-version:content-type;\r
28         bh=FmyWoFla9w4G0ks13DxYKt9EN4p7rwUHjK/M7OO5bFk=;\r
29         b=udivSsn7EJ4qgOiGOtUNmz/1LnFkrN/ng51yXKvPG/VbPLN98z+ki6+0am/dt//O/m\r
30         i0NHg9gs1rQ9LegpOAgiO8xvfVXaIud+0ZybQtuSfMrhii9wj/PsZb93+xzVGzCWXKWP\r
31         5Pt3wz5I6XtPKxPgPpgnp8AlrnRUvGvZyXgdY=\r
32 Received: by 10.205.65.4 with SMTP id xk4mr431227bkb.21.1310022970880;\r
33         Thu, 07 Jul 2011 00:16:10 -0700 (PDT)\r
34 Received: from localhost ([91.144.186.21])\r
35         by mx.google.com with ESMTPS id lb15sm2079454bkb.1.2011.07.07.00.16.08\r
36         (version=TLSv1/SSLv3 cipher=OTHER);\r
37         Thu, 07 Jul 2011 00:16:08 -0700 (PDT)\r
38 From: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>\r
39 To: Daniel Schoepe <daniel.schoepe@googlemail.com>, notmuch@notmuchmail.org\r
40 Subject: Re: [PATCH v2] emacs: Turn id:"<message-id>" elements into buttons\r
41         for notmuch searches\r
42 In-Reply-To: <1309961881-28333-2-git-send-email-daniel.schoepe@googlemail.com>\r
43 References: <1309896760-378-1-git-send-email-daniel.schoepe@googlemail.com>\r
44         <1309961881-28333-1-git-send-email-daniel.schoepe@googlemail.com>\r
45         <1309961881-28333-2-git-send-email-daniel.schoepe@googlemail.com>\r
46 User-Agent: Notmuch/0.5-321-g41686e2 (http://notmuchmail.org) Emacs/23.3.1\r
47         (x86_64-pc-linux-gnu)\r
48 Date: Thu, 07 Jul 2011 11:16:03 +0400\r
49 Message-ID: <87r5624l3g.fsf@gmail.com>\r
50 MIME-Version: 1.0\r
51 Content-Type: text/plain; charset=us-ascii\r
52 X-BeenThere: notmuch@notmuchmail.org\r
53 X-Mailman-Version: 2.1.13\r
54 Precedence: list\r
55 List-Id: "Use and development of the notmuch mail system."\r
56         <notmuch.notmuchmail.org>\r
57 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
58         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
59 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
60 List-Post: <mailto:notmuch@notmuchmail.org>\r
61 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
62 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
63         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
64 X-List-Received-Date: Thu, 07 Jul 2011 07:16:13 -0000\r
65 \r
66 Hi Daniel.\r
67 \r
68 On Wed,  6 Jul 2011 16:18:01 +0200, Daniel Schoepe <daniel.schoepe@googlemail.com> wrote:\r
69 > This fixes the minor annoyance that message ids were parsed as mail\r
70 > addresses by goto-address-mode in notmuch-show buffers.\r
71 \r
72 I did not try it yet but it looks like a nice feature.  Though I have\r
73 some questions on the code below.\r
74 \r
75 > ---\r
76 >  emacs/notmuch-show.el |   24 +++++++++++++++++++++---\r
77 >  1 files changed, 21 insertions(+), 3 deletions(-)\r
78\r
79 > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
80 > index f96743b..f924d17 100644\r
81 > --- a/emacs/notmuch-show.el\r
82 > +++ b/emacs/notmuch-show.el\r
83 > @@ -27,6 +27,7 @@\r
84 >  (require 'mm-decode)\r
85 >  (require 'mailcap)\r
86 >  (require 'icalendar)\r
87 > +(require 'goto-addr)\r
88 >  \r
89 >  (require 'notmuch-lib)\r
90 >  (require 'notmuch-query)\r
91 > @@ -778,6 +779,24 @@ current buffer, if possible."\r
92 >  (defvar notmuch-show-parent-buffer nil)\r
93 >  (make-variable-buffer-local 'notmuch-show-parent-buffer)\r
94 >  \r
95 > +(defun notmuch-show-buttonise-links (start end)\r
96 > +  "Buttonise URLs and mail addresses between START and END.\r
97 > +\r
98 > +This also turns id:\"<message id>\"-parts into buttons for\r
99 > +a corresponding notmuch search."\r
100 > +  (goto-address-fontify-region start end)\r
101 > +  (save-excursion\r
102 > +    (goto-char start)\r
103 > +    (while (re-search-forward "id:\"[^ ]+\"" end t)\r
104 > +      ;; remove the overlay created by goto-address-mode\r
105 > +      (remove-overlays (match-beginning 0) (match-end 0) 'goto-address t)\r
106 \r
107 Why do we need to remove `goto-address-mode' overlays if it is not\r
108 enabled ((goto-address-mode t) is below is removed)?\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 Regards,\r
132   Dmitry\r
133 \r
134 > +      (jit-lock-register #'notmuch-show-buttonise-links)\r
135 > +\r
136 >        ;; Act on visual lines rather than logical lines.\r
137 >        (visual-line-mode t)\r
138 >  \r
139 > -- \r
140 > 1.7.5.4\r
141\r
142 > _______________________________________________\r
143 > notmuch mailing list\r
144 > notmuch@notmuchmail.org\r
145 > http://notmuchmail.org/mailman/listinfo/notmuch\r