1 Return-Path: <jani@nikula.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 37CAC431FAE
\r
6 for <notmuch@notmuchmail.org>; Thu, 1 May 2014 05:35:23 -0700 (PDT)
\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 kx-hfv-iA-wU for <notmuch@notmuchmail.org>;
\r
16 Thu, 1 May 2014 05:35:17 -0700 (PDT)
\r
17 Received: from mail-ee0-f52.google.com (mail-ee0-f52.google.com
\r
18 [74.125.83.52]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client
\r
19 certificate requested) by olra.theworths.org (Postfix) with ESMTPS id
\r
20 85A09431FBD for <notmuch@notmuchmail.org>; Thu, 1 May 2014 05:35:17 -0700
\r
22 Received: by mail-ee0-f52.google.com with SMTP id e53so2212396eek.11
\r
23 for <notmuch@notmuchmail.org>; Thu, 01 May 2014 05:35:15 -0700 (PDT)
\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
\r
25 d=1e100.net; s=20130820;
\r
26 h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to
\r
28 bh=hn63RtN4ksbbIq6maaVEV9iWTw98tBIkU+7OaGeeQZU=;
\r
29 b=V17SxbsS1csZcpKYPx151bGys5Mc9ypvfnXNwpOjt2598tpBLEgTcMthK/bBC43b4y
\r
30 F6wleZH3rKH3+NF9fiE+12RYF2DJt4eCdTl02ese9pmoiAYNb4X6cjGeKgvrNM/CyWGZ
\r
31 4L9+ObZz2wVqNh2THPEnjncvSNTf5VCR1WHJIBnJOj0e4tAuT52EULlGtrAW0xdRrYvY
\r
32 YLft9S0ZF+7spqIfgyVz4sTHJKJtPW3v6VcqGndv2BtUAaRFBKG/GEljFt3C1SWVNvPB
\r
33 +p7MUkHefqtSXrAORbB4WPE2CDcr/h8hBWrvGMBIVedKx2P20XWT/Lwa4smAxVoDTCMf
\r
36 ALoCoQmxOjddCDnGqe74n/TtEfPkV5qK8jN+Mfisuk+SzTzDU4/tgO2+qLHKn8GpbAd8nhmEnUUK
\r
37 X-Received: by 10.15.42.138 with SMTP id u10mr9670761eev.7.1398947713934;
\r
38 Thu, 01 May 2014 05:35:13 -0700 (PDT)
\r
39 Received: from localhost (dsl-hkibrasgw2-58c36f-91.dhcp.inet.fi.
\r
41 by mx.google.com with ESMTPSA id y7sm76035412eev.5.2014.05.01.05.35.12
\r
42 for <multiple recipients>
\r
43 (version=TLSv1.2 cipher=RC4-SHA bits=128/128);
\r
44 Thu, 01 May 2014 05:35:12 -0700 (PDT)
\r
45 From: Jani Nikula <jani@nikula.org>
\r
46 To: notmuch@notmuchmail.org
\r
47 Subject: [PATCH v2] emacs: allow functions in
\r
48 notmuch-show-stash-mlarchive-link-alist
\r
49 Date: Thu, 1 May 2014 15:35:11 +0300
\r
50 Message-Id: <1398947711-12658-1-git-send-email-jani@nikula.org>
\r
51 X-Mailer: git-send-email 1.9.2
\r
52 In-Reply-To: <874n1cbfyi.fsf@qmul.ac.uk>
\r
53 References: <874n1cbfyi.fsf@qmul.ac.uk>
\r
54 X-BeenThere: notmuch@notmuchmail.org
\r
55 X-Mailman-Version: 2.1.13
\r
57 List-Id: "Use and development of the notmuch mail system."
\r
58 <notmuch.notmuchmail.org>
\r
59 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
60 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
61 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
62 List-Post: <mailto:notmuch@notmuchmail.org>
\r
63 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
64 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
65 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
66 X-List-Received-Date: Thu, 01 May 2014 12:35:23 -0000
\r
68 Some archives may use a more complicated scheme for referring to
\r
69 messages than just concatenated url and message-id. In particular,
\r
70 patchwork requires a query to translate message-id to a patchwork
\r
71 patch id. Allow functions in notmuch-show-stash-mlarchive-link-alist
\r
74 For example, one could use something like this for patchwork.
\r
76 (lambda (message-id)
\r
78 "http://patchwork.example.com/patch/"
\r
81 (car (last (process-lines "pwclient" "search" "-n" "1"
\r
82 "-m" (concat "<" message-id ">"))))))))
\r
84 emacs/notmuch-show.el | 40 +++++++++++++++++++++++++++-------------
\r
85 1 file changed, 27 insertions(+), 13 deletions(-)
\r
87 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
\r
88 index df10d4bad93b..10fc872141dc 100644
\r
89 --- a/emacs/notmuch-show.el
\r
90 +++ b/emacs/notmuch-show.el
\r
91 @@ -180,10 +180,21 @@ each attachment handler is logged in buffers with names beginning
\r
93 "List of Mailing List Archives to use when stashing links.
\r
95 -These URIs are concatenated with the current message's
\r
96 -Message-Id in `notmuch-show-stash-mlarchive-link'."
\r
97 +This list is used for generating a Mailing List Archive reference
\r
98 +URI with the current message's Message-Id in
\r
99 +`notmuch-show-stash-mlarchive-link'.
\r
101 +If the cdr of the alist element is not a function, the cdr is
\r
102 +expected to contain a URI that is concatenated with the current
\r
103 +message's Message-Id to create a ML archive reference URI.
\r
105 +If the cdr is a function, the function is called with the
\r
106 +Message-Id as the argument, and the function is expected to
\r
107 +return the ML archive reference URI."
\r
108 :type '(alist :key-type (string :tag "Name")
\r
109 - :value-type (string :tag "URL"))
\r
110 + :value-type (choice
\r
111 + (string :tag "URL")
\r
112 + (function :tag "Function returning the URL")))
\r
113 :group 'notmuch-show)
\r
115 (defcustom notmuch-show-stash-mlarchive-link-default "Gmane"
\r
116 @@ -2055,16 +2066,19 @@ This presumes that the message is available at the selected Mailing List Archive
\r
117 If optional argument MLA is non-nil, use the provided key instead of prompting
\r
118 the user (see `notmuch-show-stash-mlarchive-link-alist')."
\r
120 - (notmuch-common-do-stash
\r
121 - (concat (cdr (assoc
\r
123 - (let ((completion-ignore-case t))
\r
125 - "Mailing List Archive: "
\r
126 - notmuch-show-stash-mlarchive-link-alist
\r
127 - nil t nil nil notmuch-show-stash-mlarchive-link-default)))
\r
128 - notmuch-show-stash-mlarchive-link-alist))
\r
129 - (notmuch-show-get-message-id t))))
\r
130 + (let ((url (cdr (assoc
\r
132 + (let ((completion-ignore-case t))
\r
134 + "Mailing List Archive: "
\r
135 + notmuch-show-stash-mlarchive-link-alist
\r
137 + notmuch-show-stash-mlarchive-link-default)))
\r
138 + notmuch-show-stash-mlarchive-link-alist))))
\r
139 + (notmuch-common-do-stash
\r
140 + (if (functionp url)
\r
141 + (funcall url (notmuch-show-get-message-id t))
\r
142 + (concat url (notmuch-show-get-message-id t))))))
\r
144 (defun notmuch-show-stash-mlarchive-link-and-go (&optional mla)
\r
145 "Copy an ML Archive URI for the current message to the kill-ring and visit it.
\r