[PATCH v6 3/3] emacs: add `notmuch-show-stash-mlarchive-link{, -and-go}'
authorPieter Praet <pieter@praet.org>
Sun, 19 Feb 2012 20:50:27 +0000 (21:50 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:44:43 +0000 (09:44 -0800)
3f/ebf81262520f4f669cf40b3e77be2851b937fd [new file with mode: 0644]

diff --git a/3f/ebf81262520f4f669cf40b3e77be2851b937fd b/3f/ebf81262520f4f669cf40b3e77be2851b937fd
new file mode 100644 (file)
index 0000000..628b771
--- /dev/null
@@ -0,0 +1,202 @@
+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 A0A8B431FC3\r
+       for <notmuch@notmuchmail.org>; Sun, 19 Feb 2012 12:52:57 -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 Q7sClJufgGbL for <notmuch@notmuchmail.org>;\r
+       Sun, 19 Feb 2012 12:52:55 -0800 (PST)\r
+Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com\r
+       [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 1C209431FC0\r
+       for <notmuch@notmuchmail.org>; Sun, 19 Feb 2012 12:52:48 -0800 (PST)\r
+Received: by mail-wi0-f181.google.com with SMTP id hi8so3111295wib.26\r
+       for <notmuch@notmuchmail.org>; Sun, 19 Feb 2012 12:52:48 -0800 (PST)\r
+Received-SPF: pass (google.com: domain of pieter@praet.org designates\r
+       10.180.92.73 as permitted sender) client-ip=10.180.92.73; \r
+Authentication-Results: mr.google.com;\r
+       spf=pass (google.com: domain of pieter@praet.org\r
+       designates 10.180.92.73 as permitted sender)\r
+       smtp.mail=pieter@praet.org\r
+Received: from mr.google.com ([10.180.92.73])\r
+       by 10.180.92.73 with SMTP id ck9mr12080115wib.2.1329684768752 (num_hops\r
+       = 1); Sun, 19 Feb 2012 12:52:48 -0800 (PST)\r
+MIME-Version: 1.0\r
+Received: by 10.180.92.73 with SMTP id ck9mr10059531wib.2.1329684768655;\r
+       Sun, 19 Feb 2012 12:52:48 -0800 (PST)\r
+Received: from localhost (104.218-242-81.adsl-dyn.isp.belgacom.be.\r
+       [81.242.218.104])\r
+       by mx.google.com with ESMTPS id p10sm11740033wic.0.2012.02.19.12.52.47\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Sun, 19 Feb 2012 12:52:48 -0800 (PST)\r
+From: Pieter Praet <pieter@praet.org>\r
+To: David Edmondson <dme@dme.org>\r
+Subject: [PATCH v6 3/3] emacs: add `notmuch-show-stash-mlarchive-link{,\r
+       -and-go}'\r
+Date: Sun, 19 Feb 2012 21:50:27 +0100\r
+Message-Id: <1329684627-10708-4-git-send-email-pieter@praet.org>\r
+X-Mailer: git-send-email 1.7.8.1\r
+In-Reply-To: <1329684627-10708-1-git-send-email-pieter@praet.org>\r
+References: <1327397873-20596-1-git-send-email-dme@dme.org>\r
+       <1329684627-10708-1-git-send-email-pieter@praet.org>\r
+X-Gm-Message-State:\r
+ ALoCoQnMic7p5NYXlGs6iGZQQDXm9f06hZCbRRItjQlk7aeU6ItIaimn9M32DdVwOeR64/8aicNi\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: Sun, 19 Feb 2012 20:52:57 -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
+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
+ emacs/notmuch-show.el |   61 +++++++++++++++++++++++++++++++++++++++++++++++++\r
+ test/emacs            |    1 -\r
+ 2 files changed, 61 insertions(+), 1 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index cefad11..6ced501 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -155,6 +155,35 @@ (defvar notmuch-show-indent-content t)\r
+ (make-variable-buffer-local 'notmuch-show-indent-content)\r
+ (put 'notmuch-show-indent-content 'permanent-local t)\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
++\r
++These URIs are concatenated with the current message's\r
++Message-Id in `notmuch-show-stash-mlarchive-link'."\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
+@@ -1145,6 +1174,8 @@ (defvar notmuch-show-stash-map\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
+@@ -1811,6 +1842,36 @@ (defun notmuch-show-stash-to ()\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
++                      "Mailing List 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
++         (notmuch-show-get-message-id t))))\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 1f213e3..c38233c 100755\r
+--- a/test/emacs\r
++++ b/test/emacs\r
+@@ -384,7 +384,6 @@ test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.\r
+ test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-hidden-messages\r
\r
+ test_begin_subtest "Stashing in notmuch-show"\r
+-test_subtest_known_broken\r
+ add_message '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' \\r
+     '[from]="Some One <someone@somewhere.org>"' \\r
+     '[to]="Some One Else <notsomeone@somewhere.org>"' \\r
+-- \r
+1.7.8.1\r
+\r