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 E2FDD431FBF
\r
6 for <notmuch@notmuchmail.org>; Fri, 27 Jan 2012 00:46:28 -0800 (PST)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-0.677 tagged_above=-999 required=5
\r
12 tests=[HS_INDEX_PARAM=0.023, RCVD_IN_DNSWL_LOW=-0.7]
\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 YcmGs-1uMsNT for <notmuch@notmuchmail.org>;
\r
17 Fri, 27 Jan 2012 00:46:27 -0800 (PST)
\r
18 Received: from mail-ww0-f41.google.com (mail-ww0-f41.google.com
\r
19 [74.125.82.41]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
20 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
21 73D12431FAE for <notmuch@notmuchmail.org>; Fri, 27 Jan 2012 00:46:27 -0800
\r
23 Received: by wgbdt11 with SMTP id dt11so850118wgb.2
\r
24 for <notmuch@notmuchmail.org>; Fri, 27 Jan 2012 00:46:26 -0800 (PST)
\r
25 Received: by 10.180.100.228 with SMTP id fb4mr9396080wib.1.1327653986263;
\r
26 Fri, 27 Jan 2012 00:46:26 -0800 (PST)
\r
27 Received: from localhost ([109.131.116.159])
\r
28 by mx.google.com with ESMTPS id n5sm20913508wiw.7.2012.01.27.00.46.25
\r
29 (version=TLSv1/SSLv3 cipher=OTHER);
\r
30 Fri, 27 Jan 2012 00:46:25 -0800 (PST)
\r
31 From: Pieter Praet <pieter@praet.org>
\r
32 To: David Edmondson <dme@dme.org>
\r
33 Subject: [PATCH v4?] emacs: add `notmuch-show-stash-mlarchive-link{,-and-go}'
\r
34 Date: Fri, 27 Jan 2012 09:44:26 +0100
\r
35 Message-Id: <1327653866-30084-1-git-send-email-pieter@praet.org>
\r
36 X-Mailer: git-send-email 1.7.8.1
\r
37 In-Reply-To: <878vkt35ao.fsf@praet.org>
\r
38 References: <878vkt35ao.fsf@praet.org>
\r
39 Cc: Notmuch Mail <notmuch@notmuchmail.org>
\r
40 X-BeenThere: notmuch@notmuchmail.org
\r
41 X-Mailman-Version: 2.1.13
\r
43 List-Id: "Use and development of the notmuch mail system."
\r
44 <notmuch.notmuchmail.org>
\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
46 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
48 List-Post: <mailto:notmuch@notmuchmail.org>
\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
51 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
52 X-List-Received-Date: Fri, 27 Jan 2012 08:46:29 -0000
\r
54 * emacs/notmuch-show.el
\r
56 (notmuch-show-stash-mlarchive-link-alist):
\r
57 New defcustom of type `alist' (key = name, value = URI),
\r
58 containing Mailing List Archive URI's for searching by Message-Id.
\r
60 (notmuch-show-stash-mlarchive-link-default):
\r
61 New defcustom, default MLA to use when `notmuch-show-stash-mlarchive-link'
\r
62 received no user input whatsoever. Available choices are generated using
\r
63 the contents of `notmuch-show-stash-mlarchive-link-alist'.
\r
65 (notmuch-show-stash-map):
\r
66 Added keybinds "l" and "L" for `notmuch-show-stash-mlarchive-link'
\r
67 respectively `notmuch-show-stash-mlarchive-link-and-go'.
\r
69 (notmuch-show-stash-mlarchive-link):
\r
70 New function, stashes a URI pointing to the current message at one
\r
71 of the MLAs configured in `notmuch-show-stash-mlarchive-link-alist'.
\r
72 Prompts user with `completing-read' if not provided with an MLA key.
\r
74 (notmuch-show-stash-mlarchive-link-and-go):
\r
75 New function, uses `notmuch-show-stash-mlarchive-link' to
\r
76 stash a URI, and then visits it using the browser configured
\r
77 in `browse-url-browser-function'.
\r
81 Expanded subtest "Stashing in notmuch-show" wrt new functions
\r
82 `notmuch-show-stash-mlarchive-link{,-and-go}'.
\r
85 Based on original work [1] by David Edmondson <dme@dme.org>.
\r
87 [1] id:"1327397873-20596-1-git-send-email-dme@dme.org"
\r
90 emacs/notmuch-show.el | 58 +++++++++++++++++++++++++++++++++++++++++++++++++
\r
91 test/emacs | 8 ++++++-
\r
92 2 files changed, 65 insertions(+), 1 deletions(-)
\r
94 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
95 index c37479a..5a5d446 100644
\r
96 --- a/emacs/notmuch-show.el
\r
97 +++ b/emacs/notmuch-show.el
\r
98 @@ -123,6 +123,32 @@ indentation."
\r
99 (const :tag "View interactively"
\r
100 notmuch-show-interactively-view-part)))
\r
102 +(defcustom notmuch-show-stash-mlarchive-link-alist
\r
103 + '(("Gmane" . "http://mid.gmane.org/")
\r
104 + ("MARC" . "http://marc.info/?i=")
\r
105 + ("Mail Archive, The" . "http://mail-archive.com/search?l=mid&q=")
\r
106 + ;; FIXME: can these services be searched by `Message-Id' ?
\r
107 + ;; ("MarkMail" . "http://markmail.org/")
\r
108 + ;; ("Nabble" . "http://nabble.com/")
\r
109 + ;; ("opensubscriber" . "http://opensubscriber.com/")
\r
111 + "List of Mailing List Archives to use when stashing links."
\r
112 + :type '(alist :key-type (string :tag "Name")
\r
113 + :value-type (string :tag "URL"))
\r
114 + :group 'notmuch-show)
\r
116 +(defcustom notmuch-show-stash-mlarchive-link-default "Gmane"
\r
117 + "Default Mailing List Archive to use when stashing links.
\r
119 +This is used when `notmuch-show-stash-mlarchive-link' isn't
\r
120 +provided with an MLA argument nor `completing-read' input."
\r
124 + (list 'const :tag (car mla) :value (car mla)))
\r
125 + notmuch-show-stash-mlarchive-link-alist))
\r
126 + :group 'notmuch-show)
\r
128 (defmacro with-current-notmuch-show-message (&rest body)
\r
129 "Evaluate body with current buffer set to the text of current message"
\r
131 @@ -1017,6 +1043,8 @@ thread id. If a prefix is given, crypto processing is toggled."
\r
132 (define-key map "s" 'notmuch-show-stash-subject)
\r
133 (define-key map "T" 'notmuch-show-stash-tags)
\r
134 (define-key map "t" 'notmuch-show-stash-to)
\r
135 + (define-key map "l" 'notmuch-show-stash-mlarchive-link)
\r
136 + (define-key map "L" 'notmuch-show-stash-mlarchive-link-and-go)
\r
138 "Submap for stash commands")
\r
139 (fset 'notmuch-show-stash-map notmuch-show-stash-map)
\r
140 @@ -1604,6 +1632,36 @@ buffer."
\r
142 (notmuch-common-do-stash (notmuch-show-get-to)))
\r
144 +(defun notmuch-show-stash-mlarchive-link (&optional mla)
\r
145 + "Copy an ML Archive URI for the current message to the kill-ring.
\r
147 +This presumes that the message is available at the selected Mailing List Archive.
\r
149 +If optional argument MLA is non-nil, use the provided key instead of prompting
\r
150 +the user (see `notmuch-show-stash-mlarchive-link-alist')."
\r
152 + (notmuch-common-do-stash
\r
153 + (concat (cdr (assoc
\r
155 + (let ((completion-ignore-case t))
\r
157 + "Message archive: "
\r
158 + notmuch-show-stash-mlarchive-link-alist
\r
159 + nil t nil nil notmuch-show-stash-mlarchive-link-default)))
\r
160 + notmuch-show-stash-mlarchive-link-alist))
\r
161 + (substring (notmuch-show-get-message-id) 4 -1))))
\r
163 +(defun notmuch-show-stash-mlarchive-link-and-go (&optional mla)
\r
164 + "Copy an ML Archive URI for the current message to the kill-ring and visit it.
\r
166 +This presumes that the message is available at the selected Mailing List Archive.
\r
168 +If optional argument MLA is non-nil, use the provided key instead of prompting
\r
169 +the user (see `notmuch-show-stash-mlarchive-link-alist')."
\r
171 + (notmuch-show-stash-mlarchive-link mla)
\r
172 + (browse-url (current-kill 0 t)))
\r
174 ;; Commands typically bound to buttons.
\r
176 (defun notmuch-show-part-button-default (&optional button)
\r
177 diff --git a/test/emacs b/test/emacs
\r
178 index f150d95..7d6a272 100755
\r
181 @@ -382,9 +382,12 @@ test_emacs '(notmuch-show "id:\"bought\"")
\r
182 (notmuch-show-stash-message-id-stripped)
\r
183 (notmuch-show-stash-tags)
\r
184 (notmuch-show-stash-filename)
\r
185 + (notmuch-show-stash-mlarchive-link "Gmane")
\r
186 + (notmuch-show-stash-mlarchive-link "MARC")
\r
187 + (notmuch-show-stash-mlarchive-link "Mail Archive, The")
\r
189 (generate-new-buffer "*test-stashing*"))
\r
194 (rotate-yank-pointer 1))
\r
195 @@ -400,6 +403,9 @@ id:"bought"
\r
198 ${gen_msg_filename}
\r
199 +http://mid.gmane.org/bought
\r
200 +http://marc.info/?i=bought
\r
201 +http://mail-archive.com/search?l=mid&q=bought
\r
203 test_expect_equal_file OUTPUT EXPECTED
\r