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 95F3A42117E
\r
6 for <notmuch@notmuchmail.org>; Sun, 29 Jan 2012 23:15:11 -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 VMzreRimSV0J for <notmuch@notmuchmail.org>;
\r
17 Sun, 29 Jan 2012 23:15:08 -0800 (PST)
\r
18 Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com
\r
19 [209.85.212.181]) (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 AD707429E4E
\r
22 for <notmuch@notmuchmail.org>; Sun, 29 Jan 2012 23:15:04 -0800 (PST)
\r
23 Received: by mail-wi0-f181.google.com with SMTP id hi8so3322964wib.26
\r
24 for <notmuch@notmuchmail.org>; Sun, 29 Jan 2012 23:15:04 -0800 (PST)
\r
25 Received: by 10.180.93.194 with SMTP id cw2mr8490259wib.0.1327907704403;
\r
26 Sun, 29 Jan 2012 23:15:04 -0800 (PST)
\r
27 Received: from localhost ([109.131.39.11])
\r
28 by mx.google.com with ESMTPS id eq5sm49621542wib.2.2012.01.29.23.15.03
\r
29 (version=TLSv1/SSLv3 cipher=OTHER);
\r
30 Sun, 29 Jan 2012 23:15:04 -0800 (PST)
\r
31 From: Pieter Praet <pieter@praet.org>
\r
32 To: David Edmondson <dme@dme.org>
\r
33 Subject: [PATCH v2 2/2] emacs: add `notmuch-show-stash-mlarchive-link{,
\r
35 Date: Mon, 30 Jan 2012 08:12:54 +0100
\r
36 Message-Id: <1327907574-12760-2-git-send-email-pieter@praet.org>
\r
37 X-Mailer: git-send-email 1.7.8.1
\r
38 In-Reply-To: <1327397873-20596-1-git-send-email-dme@dme.org>
\r
39 References: <1327397873-20596-1-git-send-email-dme@dme.org>
\r
40 Cc: Notmuch Mail <notmuch@notmuchmail.org>
\r
41 X-BeenThere: notmuch@notmuchmail.org
\r
42 X-Mailman-Version: 2.1.13
\r
44 List-Id: "Use and development of the notmuch mail system."
\r
45 <notmuch.notmuchmail.org>
\r
46 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
47 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
48 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
49 List-Post: <mailto:notmuch@notmuchmail.org>
\r
50 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
51 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
52 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
53 X-List-Received-Date: Mon, 30 Jan 2012 07:15:11 -0000
\r
55 * emacs/notmuch-show.el
\r
57 (notmuch-show-stash-mlarchive-link-alist):
\r
58 New defcustom of type `alist' (key = name, value = URI),
\r
59 containing Mailing List Archive URI's for searching by Message-Id.
\r
61 (notmuch-show-stash-mlarchive-link-default):
\r
62 New defcustom, default MLA to use when `notmuch-show-stash-mlarchive-link'
\r
63 received no user input whatsoever. Available choices are generated using
\r
64 the contents of `notmuch-show-stash-mlarchive-link-alist'.
\r
66 (notmuch-show-stash-map):
\r
67 Added keybinds "l" and "L" for `notmuch-show-stash-mlarchive-link'
\r
68 respectively `notmuch-show-stash-mlarchive-link-and-go'.
\r
70 (notmuch-show-stash-mlarchive-link):
\r
71 New function, stashes a URI pointing to the current message at one
\r
72 of the MLAs configured in `notmuch-show-stash-mlarchive-link-alist'.
\r
73 Prompts user with `completing-read' if not provided with an MLA key.
\r
75 (notmuch-show-stash-mlarchive-link-and-go):
\r
76 New function, uses `notmuch-show-stash-mlarchive-link' to
\r
77 stash a URI, and then visits it using the browser configured
\r
78 in `browse-url-browser-function'.
\r
82 Expanded subtest "Stashing in notmuch-show" wrt new functions
\r
83 `notmuch-show-stash-mlarchive-link{,-and-go}'.
\r
86 Based on original work [1] by David Edmondson <dme@dme.org>.
\r
88 [1] id:"1327397873-20596-1-git-send-email-dme@dme.org"
\r
92 Addressed comments by David Edmondson [2] and Dmitry Kurochkin [3].
\r
94 [2] id:"cunsjj1jyfj.fsf@hotblack-desiato.hh.sledj.net"
\r
95 [3] id:"87zkd9je5j.fsf@gmail.com"
\r
97 emacs/notmuch-show.el | 61 +++++++++++++++++++++++++++++++++++++++++++++++++
\r
98 test/emacs | 8 +++++-
\r
99 2 files changed, 68 insertions(+), 1 deletions(-)
\r
101 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
102 index b13d088..3d1312c 100644
\r
103 --- a/emacs/notmuch-show.el
\r
104 +++ b/emacs/notmuch-show.el
\r
105 @@ -124,6 +124,35 @@ indentation."
\r
106 (const :tag "View interactively"
\r
107 notmuch-show-interactively-view-part)))
\r
109 +(defcustom notmuch-show-stash-mlarchive-link-alist
\r
110 + '(("Gmane" . "http://mid.gmane.org/")
\r
111 + ("MARC" . "http://marc.info/?i=")
\r
112 + ("Mail Archive, The" . "http://mail-archive.com/search?l=mid&q=")
\r
113 + ;; FIXME: can these services be searched by `Message-Id' ?
\r
114 + ;; ("MarkMail" . "http://markmail.org/")
\r
115 + ;; ("Nabble" . "http://nabble.com/")
\r
116 + ;; ("opensubscriber" . "http://opensubscriber.com/")
\r
118 + "List of Mailing List Archives to use when stashing links.
\r
120 +These URIs are concatenated with the current message's
\r
121 +Message-Id in `notmuch-show-stash-mlarchive-link'."
\r
122 + :type '(alist :key-type (string :tag "Name")
\r
123 + :value-type (string :tag "URL"))
\r
124 + :group 'notmuch-show)
\r
126 +(defcustom notmuch-show-stash-mlarchive-link-default "Gmane"
\r
127 + "Default Mailing List Archive to use when stashing links.
\r
129 +This is used when `notmuch-show-stash-mlarchive-link' isn't
\r
130 +provided with an MLA argument nor `completing-read' input."
\r
134 + (list 'const :tag (car mla) :value (car mla)))
\r
135 + notmuch-show-stash-mlarchive-link-alist))
\r
136 + :group 'notmuch-show)
\r
138 (defmacro with-current-notmuch-show-message (&rest body)
\r
139 "Evaluate body with current buffer set to the text of current message"
\r
141 @@ -1048,6 +1077,8 @@ thread id. If a prefix is given, crypto processing is toggled."
\r
142 (define-key map "s" 'notmuch-show-stash-subject)
\r
143 (define-key map "T" 'notmuch-show-stash-tags)
\r
144 (define-key map "t" 'notmuch-show-stash-to)
\r
145 + (define-key map "l" 'notmuch-show-stash-mlarchive-link)
\r
146 + (define-key map "L" 'notmuch-show-stash-mlarchive-link-and-go)
\r
148 "Submap for stash commands")
\r
149 (fset 'notmuch-show-stash-map notmuch-show-stash-map)
\r
150 @@ -1640,6 +1671,36 @@ buffer."
\r
152 (notmuch-common-do-stash (notmuch-show-get-to)))
\r
154 +(defun notmuch-show-stash-mlarchive-link (&optional mla)
\r
155 + "Copy an ML Archive URI for the current message to the kill-ring.
\r
157 +This presumes that the message is available at the selected Mailing List Archive.
\r
159 +If optional argument MLA is non-nil, use the provided key instead of prompting
\r
160 +the user (see `notmuch-show-stash-mlarchive-link-alist')."
\r
162 + (notmuch-common-do-stash
\r
163 + (concat (cdr (assoc
\r
165 + (let ((completion-ignore-case t))
\r
167 + "Mailing List Archive: "
\r
168 + notmuch-show-stash-mlarchive-link-alist
\r
169 + nil t nil nil notmuch-show-stash-mlarchive-link-default)))
\r
170 + notmuch-show-stash-mlarchive-link-alist))
\r
171 + (notmuch-show-get-message-id t))))
\r
173 +(defun notmuch-show-stash-mlarchive-link-and-go (&optional mla)
\r
174 + "Copy an ML Archive URI for the current message to the kill-ring and visit it.
\r
176 +This presumes that the message is available at the selected Mailing List Archive.
\r
178 +If optional argument MLA is non-nil, use the provided key instead of prompting
\r
179 +the user (see `notmuch-show-stash-mlarchive-link-alist')."
\r
181 + (notmuch-show-stash-mlarchive-link mla)
\r
182 + (browse-url (current-kill 0 t)))
\r
184 ;; Commands typically bound to buttons.
\r
186 (defun notmuch-show-part-button-default (&optional button)
\r
187 diff --git a/test/emacs b/test/emacs
\r
188 index 8ca4c8a..38df3a3 100755
\r
191 @@ -382,9 +382,12 @@ test_emacs '(notmuch-show "id:\"bought\"")
\r
192 (notmuch-show-stash-message-id-stripped)
\r
193 (notmuch-show-stash-tags)
\r
194 (notmuch-show-stash-filename)
\r
195 + (notmuch-show-stash-mlarchive-link "Gmane")
\r
196 + (notmuch-show-stash-mlarchive-link "MARC")
\r
197 + (notmuch-show-stash-mlarchive-link "Mail Archive, The")
\r
199 (generate-new-buffer "*test-stashing*"))
\r
204 (rotate-yank-pointer 1))
\r
205 @@ -400,6 +403,9 @@ id:"bought"
\r
208 ${gen_msg_filename}
\r
209 +http://mid.gmane.org/bought
\r
210 +http://marc.info/?i=bought
\r
211 +http://mail-archive.com/search?l=mid&q=bought
\r
213 test_expect_equal_file OUTPUT EXPECTED
\r