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 0FA73431FB6 for ; Thu, 26 Jan 2012 05:15:32 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.677 X-Spam-Level: X-Spam-Status: No, score=-0.677 tagged_above=-999 required=5 tests=[HS_INDEX_PARAM=0.023, 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 zXjSQkMJJ519 for ; Thu, 26 Jan 2012 05:15:31 -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 0A0EB431FAE for ; Thu, 26 Jan 2012 05:15:30 -0800 (PST) Received: by wibhi8 with SMTP id hi8so411116wib.26 for ; Thu, 26 Jan 2012 05:15:29 -0800 (PST) Received: by 10.180.88.169 with SMTP id bh9mr4022597wib.20.1327583729871; Thu, 26 Jan 2012 05:15:29 -0800 (PST) Received: from localhost ([109.131.116.159]) by mx.google.com with ESMTPS id bu13sm12486538wib.6.2012.01.26.05.15.29 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 26 Jan 2012 05:15:29 -0800 (PST) From: Pieter Praet To: David Edmondson Subject: [RFC] Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'. Date: Thu, 26 Jan 2012 14:13:30 +0100 Message-Id: <1327583610-30085-1-git-send-email-pieter@praet.org> X-Mailer: git-send-email 1.7.8.1 In-Reply-To: <87pqe6vcgv.fsf@praet.org> References: <87pqe6vcgv.fsf@praet.org> Cc: Notmuch Mail 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: Thu, 26 Jan 2012 13:15:32 -0000 --- Depends on id:"1327397873-20596-1-git-send-email-dme@dme.org" emacs/notmuch-show.el | 55 ++++++++++++++++++++++++++++++++++-------------- test/emacs | 2 +- 2 files changed, 40 insertions(+), 17 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index c4d45e7..0acc4cf 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -123,6 +123,20 @@ indentation." (const :tag "View interactively" notmuch-show-interactively-view-part))) +(defcustom notmuch-show-stash-mlarchive-link-alist + '(("Gmane" . "http://mid.gmane.org/") + ("MARC" . "http://marc.info/?i=") + ("Mail Archive, The" . "http://www.mail-archive.com/search?l=mid&q=") + ;; FIXME: can these services be searched by `Message-Id' ? + ;; ("MarkMail" . "http://markmail.org/") + ;; ("Nabble" . "http://nabble.com/") + ;; ("opensubscriber" . "http://opensubscriber.com/") + ) + "Default Mailing List Archive to use when stashing links." + :type '(alist :key-type (string :tag "Name") + :value-type (string :tag "URL")) + :group 'notmuch-show) + (defmacro with-current-notmuch-show-message (&rest body) "Evaluate body with current buffer set to the text of current message" `(save-excursion @@ -1016,8 +1030,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) + (define-key map "l" 'notmuch-show-stash-mlarchive-link) + (define-key map "L" 'notmuch-show-stash-mlarchive-link-and-go) map) "Submap for stash commands") (fset 'notmuch-show-stash-map notmuch-show-stash-map) @@ -1605,23 +1619,32 @@ 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. +(defun notmuch-show-stash-mlarchive-link () + "Copy an ML Archive 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)))) +This presumes that the message is available at the selected Mailing List Archive. -(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." +Also see `notmuch-show-stash-mlarchive-link-alist'." + (interactive) + (notmuch-common-do-stash + (concat (cdr (assoc + (let ((completion-ignore-case t)) + (completing-read + "ML Archive: " + notmuch-show-stash-mlarchive-link-alist + nil t nil nil "Gmane")) + notmuch-show-stash-mlarchive-link-alist)) + (substring (notmuch-show-get-message-id) 4 -1)))) + +(defun notmuch-show-stash-mlarchive-link-and-go () + "Copy an ML Archive URI for the current message to the kill-ring and visit it. + +This presumes that the message is available at the selected Mailing List Archive. + +Also see `notmuch-show-stash-mlarchive-link-alist'." (interactive) - (let ((uri (concat "http://mid.gmane.org/" - (substring (notmuch-show-get-message-id) 4 -1)))) - (notmuch-common-do-stash uri) - (browse-url uri))) + (notmuch-show-stash-mlarchive-link) + (browse-url (current-kill 0 t))) ;; Commands typically bound to buttons. diff --git a/test/emacs b/test/emacs index 5f7467d..4e08726 100755 --- a/test/emacs +++ b/test/emacs @@ -382,7 +382,7 @@ test_emacs '(notmuch-show "id:\"bought\"") (notmuch-show-stash-message-id-stripped) (notmuch-show-stash-tags) (notmuch-show-stash-filename) - (notmuch-show-stash-gmane) + (notmuch-show-stash-mlarchive-link) (switch-to-buffer (generate-new-buffer "*test-stashing*")) (dotimes (i 10) -- 1.7.8.1