--- 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