unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.
@ 2012-01-24  9:37 David Edmondson
  2012-01-25  0:50 ` Pieter Praet
                   ` (3 more replies)
  0 siblings, 4 replies; 28+ messages in thread
From: David Edmondson @ 2012-01-24  9:37 UTC (permalink / raw)
  To: notmuch

`notmuch-show-stash-gmane' stashes a URI for the current message at
Gmane, presuming that Gmane has a copy of the message with the same
Message-Id.

`notmuch-show-stash-gmane-and-go' both stashes the message and opens
the relevant page in the configured browser.

Add the relevant test for `notmuch-show-stash-gmane'.
---
 emacs/notmuch-show.el |   20 ++++++++++++++++++++
 test/emacs            |    4 +++-
 2 files changed, 23 insertions(+), 1 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index e6a5b31..c4d45e7 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1016,6 +1016,8 @@ thread id.  If a prefix is given, crypto processing is toggled."
     (define-key map "s" 'notmuch-show-stash-subject)
     (define-key map "T" 'notmuch-show-stash-tags)
     (define-key map "t" 'notmuch-show-stash-to)
+    (define-key map "g" 'notmuch-show-stash-gmane)
+    (define-key map "G" 'notmuch-show-stash-gmane-and-go)
     map)
   "Submap for stash commands")
 (fset 'notmuch-show-stash-map notmuch-show-stash-map)
@@ -1603,6 +1605,24 @@ buffer."
   (interactive)
   (notmuch-common-do-stash (notmuch-show-get-to)))
 
+(defun notmuch-show-stash-gmane ()
+  "Copy a Gmane URI for the current message to the kill-ring.
+
+This presumes that the message is available at Gmane."
+  (interactive)
+  (notmuch-common-do-stash (concat "http://mid.gmane.org/"
+				   (substring (notmuch-show-get-message-id) 4 -1))))
+
+(defun notmuch-show-stash-gmane-and-go ()
+  "Copy a Gmane URI for the current message to the kill-ring and visit it.
+
+This presumes that the message is available at Gmane."
+  (interactive)
+  (let ((uri (concat "http://mid.gmane.org/"
+		     (substring (notmuch-show-get-message-id) 4 -1))))
+    (notmuch-common-do-stash uri)
+    (browse-url uri)))
+
 ;; Commands typically bound to buttons.
 
 (defun notmuch-show-part-button-default (&optional button)
diff --git a/test/emacs b/test/emacs
index f150d95..5f7467d 100755
--- a/test/emacs
+++ b/test/emacs
@@ -382,9 +382,10 @@ test_emacs '(notmuch-show "id:\"bought\"")
 	(notmuch-show-stash-message-id-stripped)
 	(notmuch-show-stash-tags)
 	(notmuch-show-stash-filename)
+	(notmuch-show-stash-gmane)
 	(switch-to-buffer
 	  (generate-new-buffer "*test-stashing*"))
-	(dotimes (i 9)
+	(dotimes (i 10)
 	  (yank)
 	  (insert "\n")
 	  (rotate-yank-pointer 1))
@@ -400,6 +401,7 @@ id:"bought"
 bought
 inbox,stashtest
 ${gen_msg_filename}
+http://mid.gmane.org/bought
 EOF
 test_expect_equal_file OUTPUT EXPECTED
 
-- 
1.7.8.3

^ permalink raw reply related	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2012-03-01 17:14 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-24  9:37 [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go' David Edmondson
2012-01-25  0:50 ` Pieter Praet
2012-01-25  6:31   ` David Edmondson
2012-01-25 10:18     ` Tomi Ollila
2012-01-25 10:41       ` David Edmondson
2012-01-25 13:00         ` Tomi Ollila
2012-01-26 13:05           ` Pieter Praet
2012-01-26 13:07     ` Pieter Praet
2012-01-26 13:13       ` [RFC] " Pieter Praet
2012-01-26 14:40         ` David Edmondson
2012-01-27  8:42           ` Pieter Praet
2012-01-27  8:44             ` [PATCH v4?] emacs: add `notmuch-show-stash-mlarchive-link{,-and-go}' Pieter Praet
2012-01-27  9:18               ` [PATCH v4?] emacs: add `notmuch-show-stash-mlarchive-link{, -and-go}' David Edmondson
2012-01-30  7:18                 ` Pieter Praet
2012-01-27 16:36             ` [RFC] Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go' Dmitry Kurochkin
2012-01-30  7:19               ` Pieter Praet
2012-01-30  7:12 ` [PATCH v2 1/2] emacs: `notmuch-show-get-message-id': optionally return Message-Id sans prefix Pieter Praet
2012-01-30  8:29   ` David Edmondson
2012-01-30  7:12 ` [PATCH v2 2/2] emacs: add `notmuch-show-stash-mlarchive-link{, -and-go}' Pieter Praet
2012-01-30  8:30   ` David Edmondson
2012-02-19 20:50 ` [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go' Pieter Praet
2012-02-19 20:50   ` [PATCH v6 1/3] emacs: `notmuch-show-get-message-id': optionally return Message-Id sans prefix Pieter Praet
2012-02-25 14:40     ` David Bremner
2012-02-28 18:40       ` Pieter Praet
2012-02-29 12:19         ` David Bremner
2012-03-01 17:12           ` Pieter Praet
2012-02-19 20:50   ` [PATCH v6 2/3] test: emacs: expand subtest "Stashing in notmuch-show" wrt stashing Mailing List Archive URIs Pieter Praet
2012-02-19 20:50   ` [PATCH v6 3/3] emacs: add `notmuch-show-stash-mlarchive-link{, -and-go}' Pieter Praet

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).