Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 1958A429E54 for ; Tue, 24 Jan 2012 01:38:04 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id orDz--5gnttA for ; Tue, 24 Jan 2012 01:38:00 -0800 (PST) Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id BC9BD429E21 for ; Tue, 24 Jan 2012 01:37:59 -0800 (PST) Received: by wibhi8 with SMTP id hi8so1387190wib.26 for ; Tue, 24 Jan 2012 01:37:58 -0800 (PST) MIME-Version: 1.0 Received: by 10.180.93.132 with SMTP id cu4mr2173527wib.9.1327397878432; Tue, 24 Jan 2012 01:37:58 -0800 (PST) Received: from hotblack-desiato.hh.sledj.net (host81-149-164-25.in-addr.btopenworld.com. [81.149.164.25]) by mx.google.com with ESMTPS id l8sm50516409wiy.5.2012.01.24.01.37.56 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 24 Jan 2012 01:37:57 -0800 (PST) Received: by hotblack-desiato.hh.sledj.net (Postfix, from userid 30000) id 8EFC8A06F6; Tue, 24 Jan 2012 09:37:55 +0000 (GMT) From: David Edmondson To: notmuch@notmuchmail.org Subject: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'. Date: Tue, 24 Jan 2012 09:37:53 +0000 Message-Id: <1327397873-20596-1-git-send-email-dme@dme.org> X-Mailer: git-send-email 1.7.8.3 X-Gm-Message-State: ALoCoQkOAJQsYIwSdhfWtRSEgUOkLl1vSdRhkEFNdOA4FQnpDX3VPnH5Otrr3xnu+AuxOvdSzj/x X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Jan 2012 09:38:04 -0000 `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