--- /dev/null
+Return-Path: <pieter@praet.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id E2FDD431FBF\r
+ for <notmuch@notmuchmail.org>; Fri, 27 Jan 2012 00:46:28 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.677\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.677 tagged_above=-999 required=5\r
+ tests=[HS_INDEX_PARAM=0.023, RCVD_IN_DNSWL_LOW=-0.7]\r
+ autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id YcmGs-1uMsNT for <notmuch@notmuchmail.org>;\r
+ Fri, 27 Jan 2012 00:46:27 -0800 (PST)\r
+Received: from mail-ww0-f41.google.com (mail-ww0-f41.google.com\r
+ [74.125.82.41]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client\r
+ certificate requested) by olra.theworths.org (Postfix) with ESMTPS id\r
+ 73D12431FAE for <notmuch@notmuchmail.org>; Fri, 27 Jan 2012 00:46:27 -0800\r
+ (PST)\r
+Received: by wgbdt11 with SMTP id dt11so850118wgb.2\r
+ for <notmuch@notmuchmail.org>; Fri, 27 Jan 2012 00:46:26 -0800 (PST)\r
+Received: by 10.180.100.228 with SMTP id fb4mr9396080wib.1.1327653986263;\r
+ Fri, 27 Jan 2012 00:46:26 -0800 (PST)\r
+Received: from localhost ([109.131.116.159])\r
+ by mx.google.com with ESMTPS id n5sm20913508wiw.7.2012.01.27.00.46.25\r
+ (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Fri, 27 Jan 2012 00:46:25 -0800 (PST)\r
+From: Pieter Praet <pieter@praet.org>\r
+To: David Edmondson <dme@dme.org>\r
+Subject: [PATCH v4?] emacs: add `notmuch-show-stash-mlarchive-link{,-and-go}'\r
+Date: Fri, 27 Jan 2012 09:44:26 +0100\r
+Message-Id: <1327653866-30084-1-git-send-email-pieter@praet.org>\r
+X-Mailer: git-send-email 1.7.8.1\r
+In-Reply-To: <878vkt35ao.fsf@praet.org>\r
+References: <878vkt35ao.fsf@praet.org>\r
+Cc: Notmuch Mail <notmuch@notmuchmail.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Fri, 27 Jan 2012 08:46:29 -0000\r
+\r
+* emacs/notmuch-show.el\r
+\r
+ (notmuch-show-stash-mlarchive-link-alist):\r
+ New defcustom of type `alist' (key = name, value = URI),\r
+ containing Mailing List Archive URI's for searching by Message-Id.\r
+\r
+ (notmuch-show-stash-mlarchive-link-default):\r
+ New defcustom, default MLA to use when `notmuch-show-stash-mlarchive-link'\r
+ received no user input whatsoever. Available choices are generated using\r
+ the contents of `notmuch-show-stash-mlarchive-link-alist'.\r
+\r
+ (notmuch-show-stash-map):\r
+ Added keybinds "l" and "L" for `notmuch-show-stash-mlarchive-link'\r
+ respectively `notmuch-show-stash-mlarchive-link-and-go'.\r
+\r
+ (notmuch-show-stash-mlarchive-link):\r
+ New function, stashes a URI pointing to the current message at one\r
+ of the MLAs configured in `notmuch-show-stash-mlarchive-link-alist'.\r
+ Prompts user with `completing-read' if not provided with an MLA key.\r
+\r
+ (notmuch-show-stash-mlarchive-link-and-go):\r
+ New function, uses `notmuch-show-stash-mlarchive-link' to\r
+ stash a URI, and then visits it using the browser configured\r
+ in `browse-url-browser-function'.\r
+\r
+* test/emacs\r
+\r
+ Expanded subtest "Stashing in notmuch-show" wrt new functions\r
+ `notmuch-show-stash-mlarchive-link{,-and-go}'.\r
+\r
+\r
+Based on original work [1] by David Edmondson <dme@dme.org>.\r
+\r
+[1] id:"1327397873-20596-1-git-send-email-dme@dme.org"\r
+\r
+---\r
+ emacs/notmuch-show.el | 58 +++++++++++++++++++++++++++++++++++++++++++++++++\r
+ test/emacs | 8 ++++++-\r
+ 2 files changed, 65 insertions(+), 1 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index c37479a..5a5d446 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -123,6 +123,32 @@ indentation."\r
+ (const :tag "View interactively"\r
+ notmuch-show-interactively-view-part)))\r
+ \r
++(defcustom notmuch-show-stash-mlarchive-link-alist\r
++ '(("Gmane" . "http://mid.gmane.org/")\r
++ ("MARC" . "http://marc.info/?i=")\r
++ ("Mail Archive, The" . "http://mail-archive.com/search?l=mid&q=")\r
++ ;; FIXME: can these services be searched by `Message-Id' ?\r
++ ;; ("MarkMail" . "http://markmail.org/")\r
++ ;; ("Nabble" . "http://nabble.com/")\r
++ ;; ("opensubscriber" . "http://opensubscriber.com/")\r
++ )\r
++ "List of Mailing List Archives to use when stashing links."\r
++ :type '(alist :key-type (string :tag "Name")\r
++ :value-type (string :tag "URL"))\r
++ :group 'notmuch-show)\r
++\r
++(defcustom notmuch-show-stash-mlarchive-link-default "Gmane"\r
++ "Default Mailing List Archive to use when stashing links.\r
++\r
++This is used when `notmuch-show-stash-mlarchive-link' isn't\r
++provided with an MLA argument nor `completing-read' input."\r
++ :type `(choice\r
++ ,@(mapcar\r
++ (lambda (mla)\r
++ (list 'const :tag (car mla) :value (car mla)))\r
++ notmuch-show-stash-mlarchive-link-alist))\r
++ :group 'notmuch-show)\r
++\r
+ (defmacro with-current-notmuch-show-message (&rest body)\r
+ "Evaluate body with current buffer set to the text of current message"\r
+ `(save-excursion\r
+@@ -1017,6 +1043,8 @@ thread id. If a prefix is given, crypto processing is toggled."\r
+ (define-key map "s" 'notmuch-show-stash-subject)\r
+ (define-key map "T" 'notmuch-show-stash-tags)\r
+ (define-key map "t" 'notmuch-show-stash-to)\r
++ (define-key map "l" 'notmuch-show-stash-mlarchive-link)\r
++ (define-key map "L" 'notmuch-show-stash-mlarchive-link-and-go)\r
+ map)\r
+ "Submap for stash commands")\r
+ (fset 'notmuch-show-stash-map notmuch-show-stash-map)\r
+@@ -1604,6 +1632,36 @@ buffer."\r
+ (interactive)\r
+ (notmuch-common-do-stash (notmuch-show-get-to)))\r
+ \r
++(defun notmuch-show-stash-mlarchive-link (&optional mla)\r
++ "Copy an ML Archive URI for the current message to the kill-ring.\r
++\r
++This presumes that the message is available at the selected Mailing List Archive.\r
++\r
++If optional argument MLA is non-nil, use the provided key instead of prompting\r
++the user (see `notmuch-show-stash-mlarchive-link-alist')."\r
++ (interactive)\r
++ (notmuch-common-do-stash\r
++ (concat (cdr (assoc\r
++ (or mla\r
++ (let ((completion-ignore-case t))\r
++ (completing-read\r
++ "Message archive: "\r
++ notmuch-show-stash-mlarchive-link-alist\r
++ nil t nil nil notmuch-show-stash-mlarchive-link-default)))\r
++ notmuch-show-stash-mlarchive-link-alist))\r
++ (substring (notmuch-show-get-message-id) 4 -1))))\r
++\r
++(defun notmuch-show-stash-mlarchive-link-and-go (&optional mla)\r
++ "Copy an ML Archive URI for the current message to the kill-ring and visit it.\r
++\r
++This presumes that the message is available at the selected Mailing List Archive.\r
++\r
++If optional argument MLA is non-nil, use the provided key instead of prompting\r
++the user (see `notmuch-show-stash-mlarchive-link-alist')."\r
++ (interactive)\r
++ (notmuch-show-stash-mlarchive-link mla)\r
++ (browse-url (current-kill 0 t)))\r
++\r
+ ;; Commands typically bound to buttons.\r
+ \r
+ (defun notmuch-show-part-button-default (&optional button)\r
+diff --git a/test/emacs b/test/emacs\r
+index f150d95..7d6a272 100755\r
+--- a/test/emacs\r
++++ b/test/emacs\r
+@@ -382,9 +382,12 @@ test_emacs '(notmuch-show "id:\"bought\"")\r
+ (notmuch-show-stash-message-id-stripped)\r
+ (notmuch-show-stash-tags)\r
+ (notmuch-show-stash-filename)\r
++ (notmuch-show-stash-mlarchive-link "Gmane")\r
++ (notmuch-show-stash-mlarchive-link "MARC")\r
++ (notmuch-show-stash-mlarchive-link "Mail Archive, The")\r
+ (switch-to-buffer\r
+ (generate-new-buffer "*test-stashing*"))\r
+- (dotimes (i 9)\r
++ (dotimes (i 12)\r
+ (yank)\r
+ (insert "\n")\r
+ (rotate-yank-pointer 1))\r
+@@ -400,6 +403,9 @@ id:"bought"\r
+ bought\r
+ inbox,stashtest\r
+ ${gen_msg_filename}\r
++http://mid.gmane.org/bought\r
++http://marc.info/?i=bought\r
++http://mail-archive.com/search?l=mid&q=bought\r
+ EOF\r
+ test_expect_equal_file OUTPUT EXPECTED\r
+ \r
+-- \r
+1.7.8.1\r
+\r