Re: [PATCH] Omit User-Agent: header by default
[notmuch-archives.git] / 3f / ebf81262520f4f669cf40b3e77be2851b937fd
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 A0A8B431FC3\r
6         for <notmuch@notmuchmail.org>; Sun, 19 Feb 2012 12:52:57 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.677\r
10 X-Spam-Level: \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
13         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 Q7sClJufgGbL for <notmuch@notmuchmail.org>;\r
17         Sun, 19 Feb 2012 12:52:55 -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 1C209431FC0\r
22         for <notmuch@notmuchmail.org>; Sun, 19 Feb 2012 12:52:48 -0800 (PST)\r
23 Received: by mail-wi0-f181.google.com with SMTP id hi8so3111295wib.26\r
24         for <notmuch@notmuchmail.org>; Sun, 19 Feb 2012 12:52:48 -0800 (PST)\r
25 Received-SPF: pass (google.com: domain of pieter@praet.org designates\r
26         10.180.92.73 as permitted sender) client-ip=10.180.92.73; \r
27 Authentication-Results: mr.google.com;\r
28         spf=pass (google.com: domain of pieter@praet.org\r
29         designates 10.180.92.73 as permitted sender)\r
30         smtp.mail=pieter@praet.org\r
31 Received: from mr.google.com ([10.180.92.73])\r
32         by 10.180.92.73 with SMTP id ck9mr12080115wib.2.1329684768752 (num_hops\r
33         = 1); Sun, 19 Feb 2012 12:52:48 -0800 (PST)\r
34 MIME-Version: 1.0\r
35 Received: by 10.180.92.73 with SMTP id ck9mr10059531wib.2.1329684768655;\r
36         Sun, 19 Feb 2012 12:52:48 -0800 (PST)\r
37 Received: from localhost (104.218-242-81.adsl-dyn.isp.belgacom.be.\r
38         [81.242.218.104])\r
39         by mx.google.com with ESMTPS id p10sm11740033wic.0.2012.02.19.12.52.47\r
40         (version=TLSv1/SSLv3 cipher=OTHER);\r
41         Sun, 19 Feb 2012 12:52:48 -0800 (PST)\r
42 From: Pieter Praet <pieter@praet.org>\r
43 To: David Edmondson <dme@dme.org>\r
44 Subject: [PATCH v6 3/3] emacs: add `notmuch-show-stash-mlarchive-link{,\r
45         -and-go}'\r
46 Date: Sun, 19 Feb 2012 21:50:27 +0100\r
47 Message-Id: <1329684627-10708-4-git-send-email-pieter@praet.org>\r
48 X-Mailer: git-send-email 1.7.8.1\r
49 In-Reply-To: <1329684627-10708-1-git-send-email-pieter@praet.org>\r
50 References: <1327397873-20596-1-git-send-email-dme@dme.org>\r
51         <1329684627-10708-1-git-send-email-pieter@praet.org>\r
52 X-Gm-Message-State:\r
53  ALoCoQnMic7p5NYXlGs6iGZQQDXm9f06hZCbRRItjQlk7aeU6ItIaimn9M32DdVwOeR64/8aicNi\r
54 Cc: Notmuch Mail <notmuch@notmuchmail.org>\r
55 X-BeenThere: notmuch@notmuchmail.org\r
56 X-Mailman-Version: 2.1.13\r
57 Precedence: list\r
58 List-Id: "Use and development of the notmuch mail system."\r
59         <notmuch.notmuchmail.org>\r
60 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
61         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
62 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
63 List-Post: <mailto:notmuch@notmuchmail.org>\r
64 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
65 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
66         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
67 X-List-Received-Date: Sun, 19 Feb 2012 20:52:57 -0000\r
68 \r
69 * emacs/notmuch-show.el\r
70 \r
71   (notmuch-show-stash-mlarchive-link-alist):\r
72     New defcustom of type `alist' (key = name, value = URI),\r
73     containing Mailing List Archive URI's for searching by Message-Id.\r
74 \r
75   (notmuch-show-stash-mlarchive-link-default):\r
76     New defcustom, default MLA to use when `notmuch-show-stash-mlarchive-link'\r
77     received no user input whatsoever.  Available choices are generated using\r
78     the contents of `notmuch-show-stash-mlarchive-link-alist'.\r
79 \r
80   (notmuch-show-stash-map):\r
81     Added keybinds "l" and "L" for `notmuch-show-stash-mlarchive-link'\r
82     respectively `notmuch-show-stash-mlarchive-link-and-go'.\r
83 \r
84   (notmuch-show-stash-mlarchive-link):\r
85     New function, stashes a URI pointing to the current message at one\r
86     of the MLAs configured in `notmuch-show-stash-mlarchive-link-alist'.\r
87     Prompts user with `completing-read' if not provided with an MLA key.\r
88 \r
89   (notmuch-show-stash-mlarchive-link-and-go):\r
90     New function, uses `notmuch-show-stash-mlarchive-link' to\r
91     stash a URI, and then visits it using the browser configured\r
92     in `browse-url-browser-function'.\r
93 \r
94 Based on original work [1] by David Edmondson <dme@dme.org>.\r
95 \r
96 [1] id:"1327397873-20596-1-git-send-email-dme@dme.org"\r
97 ---\r
98  emacs/notmuch-show.el |   61 +++++++++++++++++++++++++++++++++++++++++++++++++\r
99  test/emacs            |    1 -\r
100  2 files changed, 61 insertions(+), 1 deletions(-)\r
101 \r
102 diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
103 index cefad11..6ced501 100644\r
104 --- a/emacs/notmuch-show.el\r
105 +++ b/emacs/notmuch-show.el\r
106 @@ -155,6 +155,35 @@ (defvar notmuch-show-indent-content t)\r
107  (make-variable-buffer-local 'notmuch-show-indent-content)\r
108  (put 'notmuch-show-indent-content 'permanent-local t)\r
109  \r
110 +(defcustom notmuch-show-stash-mlarchive-link-alist\r
111 +  '(("Gmane" . "http://mid.gmane.org/")\r
112 +    ("MARC" . "http://marc.info/?i=")\r
113 +    ("Mail Archive, The" . "http://mail-archive.com/search?l=mid&q=")\r
114 +    ;; FIXME: can these services be searched by `Message-Id' ?\r
115 +    ;; ("MarkMail" . "http://markmail.org/")\r
116 +    ;; ("Nabble" . "http://nabble.com/")\r
117 +    ;; ("opensubscriber" . "http://opensubscriber.com/")\r
118 +    )\r
119 +  "List of Mailing List Archives to use when stashing links.\r
120 +\r
121 +These URIs are concatenated with the current message's\r
122 +Message-Id in `notmuch-show-stash-mlarchive-link'."\r
123 +  :type '(alist :key-type (string :tag "Name")\r
124 +               :value-type (string :tag "URL"))\r
125 +  :group 'notmuch-show)\r
126 +\r
127 +(defcustom notmuch-show-stash-mlarchive-link-default "Gmane"\r
128 +  "Default Mailing List Archive to use when stashing links.\r
129 +\r
130 +This is used when `notmuch-show-stash-mlarchive-link' isn't\r
131 +provided with an MLA argument nor `completing-read' input."\r
132 +  :type `(choice\r
133 +         ,@(mapcar\r
134 +            (lambda (mla)\r
135 +              (list 'const :tag (car mla) :value (car mla)))\r
136 +            notmuch-show-stash-mlarchive-link-alist))\r
137 +  :group 'notmuch-show)\r
138 +\r
139  (defmacro with-current-notmuch-show-message (&rest body)\r
140    "Evaluate body with current buffer set to the text of current message"\r
141    `(save-excursion\r
142 @@ -1145,6 +1174,8 @@ (defvar notmuch-show-stash-map\r
143      (define-key map "s" 'notmuch-show-stash-subject)\r
144      (define-key map "T" 'notmuch-show-stash-tags)\r
145      (define-key map "t" 'notmuch-show-stash-to)\r
146 +    (define-key map "l" 'notmuch-show-stash-mlarchive-link)\r
147 +    (define-key map "L" 'notmuch-show-stash-mlarchive-link-and-go)\r
148      map)\r
149    "Submap for stash commands")\r
150  (fset 'notmuch-show-stash-map notmuch-show-stash-map)\r
151 @@ -1811,6 +1842,36 @@ (defun notmuch-show-stash-to ()\r
152    (interactive)\r
153    (notmuch-common-do-stash (notmuch-show-get-to)))\r
154  \r
155 +(defun notmuch-show-stash-mlarchive-link (&optional mla)\r
156 +  "Copy an ML Archive URI for the current message to the kill-ring.\r
157 +\r
158 +This presumes that the message is available at the selected Mailing List Archive.\r
159 +\r
160 +If optional argument MLA is non-nil, use the provided key instead of prompting\r
161 +the user (see `notmuch-show-stash-mlarchive-link-alist')."\r
162 +  (interactive)\r
163 +  (notmuch-common-do-stash\r
164 +   (concat (cdr (assoc\r
165 +                (or mla\r
166 +                    (let ((completion-ignore-case t))\r
167 +                      (completing-read\r
168 +                       "Mailing List Archive: "\r
169 +                       notmuch-show-stash-mlarchive-link-alist\r
170 +                       nil t nil nil notmuch-show-stash-mlarchive-link-default)))\r
171 +                notmuch-show-stash-mlarchive-link-alist))\r
172 +          (notmuch-show-get-message-id t))))\r
173 +\r
174 +(defun notmuch-show-stash-mlarchive-link-and-go (&optional mla)\r
175 +  "Copy an ML Archive URI for the current message to the kill-ring and visit it.\r
176 +\r
177 +This presumes that the message is available at the selected Mailing List Archive.\r
178 +\r
179 +If optional argument MLA is non-nil, use the provided key instead of prompting\r
180 +the user (see `notmuch-show-stash-mlarchive-link-alist')."\r
181 +  (interactive)\r
182 +  (notmuch-show-stash-mlarchive-link mla)\r
183 +  (browse-url (current-kill 0 t)))\r
184 +\r
185  ;; Commands typically bound to buttons.\r
186  \r
187  (defun notmuch-show-part-button-default (&optional button)\r
188 diff --git a/test/emacs b/test/emacs\r
189 index 1f213e3..c38233c 100755\r
190 --- a/test/emacs\r
191 +++ b/test/emacs\r
192 @@ -384,7 +384,6 @@ test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.\r
193  test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-hidden-messages\r
194  \r
195  test_begin_subtest "Stashing in notmuch-show"\r
196 -test_subtest_known_broken\r
197  add_message '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' \\r
198      '[from]="Some One <someone@somewhere.org>"' \\r
199      '[to]="Some One Else <notsomeone@somewhere.org>"' \\r
200 -- \r
201 1.7.8.1\r
202 \r