[PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.
Pieter Praet
pieter at praet.org
Thu Jan 26 05:07:44 PST 2012
On Wed, 25 Jan 2012 06:31:43 +0000, David Edmondson <dme at dme.org> wrote:
> On Wed, 25 Jan 2012 01:50:08 +0100, Pieter Praet <pieter at praet.org> wrote:
> > In a perfect world, everyone would be using Notmuch and have a local
> > copy of every message ever sent to any ML. While we're waiting for
> > Atlantis to resurface, we'll need an interim solution.
> >
> > +1 for the idea, but Gmane doesn't archive *all* MLs, so we should leave
> > the user some legroom. Since I've already made the necessary changes,
> > I'll just send the patch instead of wasting your time with suggestions.
> > Feel free to merge it into yours.
>
> This is definitely a good idea, but...
>
> > Peace
> >
> > ---
> > emacs/notmuch-show.el | 40 ++++++++++++++++++++++++++++++----------
> > test/emacs | 2 +-
> > 2 files changed, 31 insertions(+), 11 deletions(-)
> >
> > diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> > index c4d45e7..7f209cd 100644
> > --- a/emacs/notmuch-show.el
> > +++ b/emacs/notmuch-show.el
> > @@ -123,6 +123,24 @@ indentation."
> > (const :tag "View interactively"
> > notmuch-show-interactively-view-part)))
> >
> > +(defcustom notmuch-show-stash-mlarchive-link-pref "http://mid.gmane.org/"
> > + "Default Mailing List Archive to use when stashing links."
> > + :group 'notmuch-show
> > + ;; TODO: find a working `Message-Id' search arg for all options.
> > + :type '(choice (const :tag "Gmane"
> > + "http://mid.gmane.org/")
> > + ;; (const :tag "MARC"
> > + ;; "http://marc.info/")
> > + (const :tag "Mail Archive, The"
> > + "http://www.mail-archive.com/search?l=mid&q=")
> > + ;; (const :tag "MarkMail"
> > + ;; "http://markmail.org/")
> > + ;; (const :tag "opensubscriber"
> > + ;; "http://opensubscriber.com/")
> > + ;; (const :tag "Nabble"
> > + ;; "http://nabble.com/")
> > + (string :tag "Custom URI")))
>
> ...do we not now how to reference messages by message-id on these other
> services?
>
I've found the missing Message-Id search URI for 'marc.info', but as
for the remaining services: if they provide search by Message-Id,
they're pretty damn good at hiding it...
> Your point about Gmane not having everything applies equally to any
> service, suggesting that perhaps the user should also have an option to
> choose which service to use at stash time. Thoughts?
>
Definitely.
Patch follows.
> > +
> > (defmacro with-current-notmuch-show-message (&rest body)
> > "Evaluate body with current buffer set to the text of current message"
> > `(save-excursion
> > @@ -1016,8 +1034,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,20 +1623,22 @@ 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."
> > +This presumes that the message is available at the Mailing List Archive
> > +configured in `notmuch-show-stash-mlarchive-link-pref'."
> > (interactive)
> > - (notmuch-common-do-stash (concat "http://mid.gmane.org/"
> > + (notmuch-common-do-stash (concat notmuch-show-stash-mlarchive-link-pref
> > (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.
> > +(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 Gmane."
> > +This presumes that the message is available at the Mailing List Archive
> > +configured in `notmuch-show-stash-mlarchive-link-pref'."
> > (interactive)
> > - (let ((uri (concat "http://mid.gmane.org/"
> > + (let ((uri (concat notmuch-show-stash-mlarchive-link-pref
> > (substring (notmuch-show-get-message-id) 4 -1))))
> > (notmuch-common-do-stash uri)
> > (browse-url uri)))
> > 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
> >
Peace
--
Pieter
More information about the notmuch
mailing list