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 4736D431FAF
\r
6 for <notmuch@notmuchmail.org>; Sat, 10 Nov 2012 20:46:28 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\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 rTlO0hGBdfEr for <notmuch@notmuchmail.org>;
\r
16 Sat, 10 Nov 2012 20:46:27 -0800 (PST)
\r
17 Received: from dmz-mailsec-scanner-3.mit.edu (DMZ-MAILSEC-SCANNER-3.MIT.EDU
\r
19 by olra.theworths.org (Postfix) with ESMTP id 095B0431FBD
\r
20 for <notmuch@notmuchmail.org>; Sat, 10 Nov 2012 20:46:26 -0800 (PST)
\r
21 X-AuditID: 1209190e-b7f756d000000904-88-509f2da23010
\r
22 Received: from mailhub-auth-4.mit.edu ( [18.7.62.39])
\r
23 by dmz-mailsec-scanner-3.mit.edu (Symantec Messaging Gateway) with SMTP
\r
24 id 9D.98.02308.2AD2F905; Sat, 10 Nov 2012 23:46:26 -0500 (EST)
\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])
\r
26 by mailhub-auth-4.mit.edu (8.13.8/8.9.2) with ESMTP id qAB4kOLG025911;
\r
27 Sat, 10 Nov 2012 23:46:24 -0500
\r
28 Received: from drake.dyndns.org
\r
29 (209-6-116-242.c3-0.arl-ubr1.sbo-arl.ma.cable.rcn.com
\r
30 [209.6.116.242]) (authenticated bits=0)
\r
31 (User authenticated as amdragon@ATHENA.MIT.EDU)
\r
32 by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id qAB4kJc5001919
\r
33 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);
\r
34 Sat, 10 Nov 2012 23:46:21 -0500 (EST)
\r
35 Received: from amthrax by drake.dyndns.org with local (Exim 4.77)
\r
36 (envelope-from <amdragon@mit.edu>)
\r
37 id 1TXPR5-0003a7-Or; Sat, 10 Nov 2012 23:46:19 -0500
\r
38 From: Austin Clements <amdragon@MIT.EDU>
\r
39 To: notmuch@notmuchmail.org
\r
40 Subject: [PATCH v2 3/3] emacs: Buttonize mid: links
\r
41 Date: Sat, 10 Nov 2012 23:46:15 -0500
\r
42 Message-Id: <1352609175-12790-4-git-send-email-amdragon@mit.edu>
\r
43 X-Mailer: git-send-email 1.7.10.4
\r
44 In-Reply-To: <1352609175-12790-1-git-send-email-amdragon@mit.edu>
\r
45 References: <1352609175-12790-1-git-send-email-amdragon@mit.edu>
\r
46 X-Brightmail-Tracker:
\r
47 H4sIAAAAAAAAA+NgFjrGIsWRmVeSWpSXmKPExsUixG6nrrtId36AweUJUhZN050trt+cyWzR
\r
48 2veUxYHZ49b91+wez1bdYvbY+PcHSwBzFJdNSmpOZllqkb5dAlfGprntbAX7pCqW757M1sC4
\r
49 WrSLkZNDQsBE4vHKxewQtpjEhXvr2boYuTiEBPYxSjw4eZMFwtnAKLF1zl9mCOcRk8TmO8+g
\r
50 yuYySmw/sJEZpJ9NQENi2/7ljCC2iIC0xM67s1lBbGaBVInVOzvAaoQFjCW27gCp5+BgEVCV
\r
51 6N6iAxLmFXCQuNl0mhniDEWJ7mcT2EBsTgFHif4Zf8BGCgHVnPnxnnkCI/8CRoZVjLIpuVW6
\r
52 uYmZOcWpybrFyYl5ealFusZ6uZkleqkppZsYQcHFKcm3g/HrQaVDjAIcjEo8vDfezAsQYk0s
\r
53 K67MPcQoycGkJMqbrDM/QIgvKT+lMiOxOCO+qDQntfgQowQHs5IIb+0OoHLelMTKqtSifJiU
\r
54 NAeLkjjvlZSb/kIC6YklqdmpqQWpRTBZGQ4OJQne6SBDBYtS01Mr0jJzShDSTBycIMN5gIY/
\r
55 0gKq4S0uSMwtzkyHyJ9iVJQS5+XQBkoIgCQySvPgemHR/4pRHOgVYd6TICt4gIkDrvsV0GAm
\r
56 oMGNR+aADC5JREhJNTC6tFUym64/+MjYqC+lP/ryL7+FKvP+mF/9+7rgaZyG+C7mbe0nPspH
\r
57 JB0+4cpskKrVOO87v5HcFivBf57qLnpfL1f9MZ/n63Et+TNH556nb5/HXzWJV9M2UD8h/VTm
\r
58 ptvB1RVHjSYceTb53+6Px9TKJd9n1tm4Fm7Y7/Vfe0q6Widr1mShIwFKLMUZiYZazEXFiQCY
\r
60 Cc: sascha-ml-reply-to-2012-4@silbe.org
\r
61 X-BeenThere: notmuch@notmuchmail.org
\r
62 X-Mailman-Version: 2.1.13
\r
64 List-Id: "Use and development of the notmuch mail system."
\r
65 <notmuch.notmuchmail.org>
\r
66 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
67 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
68 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
69 List-Post: <mailto:notmuch@notmuchmail.org>
\r
70 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
71 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
72 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
73 X-List-Received-Date: Sun, 11 Nov 2012 04:46:28 -0000
\r
75 This adds support for RFC 2392 mid: message ID links.
\r
77 emacs/notmuch-show.el | 45 +++++++++++++++++++++++++++++++++------------
\r
78 test/emacs-show | 8 +++++++-
\r
79 2 files changed, 40 insertions(+), 13 deletions(-)
\r
81 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
82 index 49961fb..5b3e70e 100644
\r
83 --- a/emacs/notmuch-show.el
\r
84 +++ b/emacs/notmuch-show.el
\r
85 @@ -1014,23 +1014,44 @@ message at DEPTH in the current thread."
\r
87 "The regexp used to match id: links in messages.")
\r
89 +(defvar notmuch-mid-regexp
\r
90 + ;; goto-address-url-regexp matched cid: links, which have the same
\r
91 + ;; grammar as the message ID part of a mid: link. Construct the
\r
92 + ;; regexp using the same technique as goto-address-url-regexp.
\r
93 + (concat "\\<mid:\\(" thing-at-point-url-path-regexp "\\)")
\r
94 + "The regexp used to match mid: links in messages.
\r
98 (defun notmuch-show-buttonise-links (start end)
\r
99 "Buttonise URLs and mail addresses between START and END.
\r
101 -This also turns id:\"<message id>\"-parts into buttons for
\r
102 -a corresponding notmuch search."
\r
103 +This also turns id:\"<message id>\"-parts and mid: links into
\r
104 +buttons for a corresponding notmuch search."
\r
105 (goto-address-fontify-region start end)
\r
107 - (goto-char start)
\r
108 - (while (re-search-forward notmuch-id-regexp end t)
\r
109 - ;; remove the overlay created by goto-address-mode
\r
110 - (remove-overlays (match-beginning 0) (match-end 0) 'goto-address t)
\r
111 - (make-text-button (match-beginning 0) (match-end 0)
\r
112 - 'action `(lambda (arg)
\r
113 - (notmuch-show ,(match-string-no-properties 0)))
\r
115 - 'help-echo "Mouse-1, RET: search for this message"
\r
116 - 'face goto-address-mail-face))))
\r
118 + (goto-char start)
\r
119 + (while (re-search-forward notmuch-id-regexp end t)
\r
120 + (push (list (match-beginning 0) (match-end 0)
\r
121 + (match-string-no-properties 0)) links))
\r
122 + (goto-char start)
\r
123 + (while (re-search-forward notmuch-mid-regexp end t)
\r
124 + (let* ((mid-cid (match-string-no-properties 1))
\r
125 + (mid (save-match-data
\r
126 + (string-match "^[^/]*" mid-cid)
\r
127 + (url-unhex-string (match-string 0 mid-cid)))))
\r
128 + (push (list (match-beginning 0) (match-end 0)
\r
129 + (notmuch-id-to-query mid)) links)))
\r
130 + (dolist (link links)
\r
131 + ;; Remove the overlay created by goto-address-mode
\r
132 + (remove-overlays (first link) (second link) 'goto-address t)
\r
133 + (make-text-button (first link) (second link)
\r
134 + 'action `(lambda (arg)
\r
135 + (notmuch-show ,(third link)))
\r
137 + 'help-echo "Mouse-1, RET: search for this message"
\r
138 + 'face goto-address-mail-face)))))
\r
141 (defun notmuch-show (thread-id &optional parent-buffer query-context buffer-name)
\r
142 diff --git a/test/emacs-show b/test/emacs-show
\r
143 index 8944e73..91706ea 100755
\r
144 --- a/test/emacs-show
\r
145 +++ b/test/emacs-show
\r
146 @@ -125,7 +125,10 @@ id:\"abc
\r
152 +mid:abc mid:abc/def
\r
154 +mid:abc. mid:abc, mid:abc;"'
\r
155 test_emacs '(notmuch-show "id:'$gen_msg_id'")
\r
156 (notmuch-test-mark-links)
\r
157 (test-visible-output)'
\r
158 @@ -153,6 +156,9 @@ id:"abc
\r
162 +<<mid:abc>> <<mid:abc/def>>
\r
164 +<<mid:abc>>. <<mid:abc>>, <<mid:abc>>;
\r
166 test_expect_equal_file EXPECTED OUTPUT
\r