|
David Edmondson |
|
|
`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 _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
Pieter Praet |
|
|
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. 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"))) + (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 _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
David Edmondson |
|
|
On Wed, 25 Jan 2012 01:50:08 +0100, Pieter Praet <[hidden email]> 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"))) services? 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? > + > (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 > _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
Tomi Ollila-2 |
|
|
On Wed, 25 Jan 2012 06:31:43 +0000, David Edmondson <[hidden email]> wrote:
> > 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? Completing-read which has all choice url's expanded so user may even edit those (like fix -2- to -1- if the don't have cover letter ;) Tomi PS: even better this should have one level of indirection so that user can change completing-read to something else without needing to patch source (like I do in address completion interface)... well this is something I need to investigate further... _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
David Edmondson |
|
|
On Wed, 25 Jan 2012 12:18:22 +0200, Tomi Ollila <[hidden email]> wrote:
> On Wed, 25 Jan 2012 06:31:43 +0000, David Edmondson <[hidden email]> wrote: > > > > 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? > > Completing-read which has all choice url's expanded so user may even edit > those `completing-read' on the _names_ of the services, sure. I'm not sure that showing the URLs as a set of choices would be nice. > (like fix -2- to -1- if the don't have cover letter ;) Should a single patch need a cover letter? _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
Tomi Ollila-2 |
|
|
On Wed, 25 Jan 2012 10:41:26 +0000, David Edmondson <[hidden email]> wrote:
> On Wed, 25 Jan 2012 12:18:22 +0200, Tomi Ollila <[hidden email]> wrote: > > On Wed, 25 Jan 2012 06:31:43 +0000, David Edmondson <[hidden email]> wrote: > > > > > > 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? > > > > Completing-read which has all choice url's expanded so user may even edit > > those > > `completing-read' on the _names_ of the services, sure. I'm not sure > that showing the URLs as a set of choices would be nice. Hmm... yes. Editing is not important here. > > > (like fix -2- to -1- if the don't have cover letter ;) > > Should a single patch need a cover letter? Nope -- and forget this -- I thought this a bit wrong. So, 'completing-read' -- or something that does the same thing better (ymmv). Tomi _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
Pieter Praet |
|
|
On Wed, 25 Jan 2012 15:00:22 +0200, Tomi Ollila <[hidden email]> wrote:
> [...] > So, 'completing-read' -- or something that does the same thing better (ymmv). > Thanks for the suggestion, but `completing-read' will do just fine... ;D > Tomi Peace -- Pieter _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
Pieter Praet |
|
|
In reply to this post by David Edmondson
On Wed, 25 Jan 2012 06:31:43 +0000, David Edmondson <[hidden email]> wrote:
> On Wed, 25 Jan 2012 01:50:08 +0100, Pieter Praet <[hidden email]> 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 _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
Pieter Praet |
|
|
---
Depends on id:"[hidden email]" 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 _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
David Edmondson |
|
|
In general, I like this.
- I think that the stash function(s) should take an optional argument specifying the archive to use. That will make testing simpler and also allow people to produce preferred bindings more easily. - "Message archive: " feels better than "ML Archive: ", but I don't really care. - Don't base the patch on the thing that I posted, just on master from the repository - no need to make David's life harder. _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
Pieter Praet |
|
|
On Thu, 26 Jan 2012 14:40:26 +0000, David Edmondson <[hidden email]> wrote:
> In general, I like this. > > - I think that the stash function(s) should take an optional argument > specifying the archive to use. That will make testing simpler and also > allow people to produce preferred bindings more easily. > Agreed. In fact, apparently that last patch [1] of mine made the test suite hang @ emacs:"Stashing in notmuch-show" due to it waiting for `completing-read' to finish... Sorry for that. > - "Message archive: " feels better than "ML Archive: ", but I don't > really care. > Agreed. > - Don't base the patch on the thing that I posted, just on master from > the repository - no need to make David's life harder. Seeing as how it was only a minor improvement to your idea (and further discussion/correction was probably appropriate), I intended for you to squash it into your original patch. Anyways, patch (relative to master) follows... Peace -- Pieter [1] id:"[hidden email]" _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
Pieter Praet |
|
|
* emacs/notmuch-show.el
(notmuch-show-stash-mlarchive-link-alist): New defcustom of type `alist' (key = name, value = URI), containing Mailing List Archive URI's for searching by Message-Id. (notmuch-show-stash-mlarchive-link-default): New defcustom, default MLA to use when `notmuch-show-stash-mlarchive-link' received no user input whatsoever. Available choices are generated using the contents of `notmuch-show-stash-mlarchive-link-alist'. (notmuch-show-stash-map): Added keybinds "l" and "L" for `notmuch-show-stash-mlarchive-link' respectively `notmuch-show-stash-mlarchive-link-and-go'. (notmuch-show-stash-mlarchive-link): New function, stashes a URI pointing to the current message at one of the MLAs configured in `notmuch-show-stash-mlarchive-link-alist'. Prompts user with `completing-read' if not provided with an MLA key. (notmuch-show-stash-mlarchive-link-and-go): New function, uses `notmuch-show-stash-mlarchive-link' to stash a URI, and then visits it using the browser configured in `browse-url-browser-function'. * test/emacs Expanded subtest "Stashing in notmuch-show" wrt new functions `notmuch-show-stash-mlarchive-link{,-and-go}'. Based on original work [1] by David Edmondson <[hidden email]>. [1] id:"[hidden email]" --- emacs/notmuch-show.el | 58 +++++++++++++++++++++++++++++++++++++++++++++++++ test/emacs | 8 ++++++- 2 files changed, 65 insertions(+), 1 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index c37479a..5a5d446 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -123,6 +123,32 @@ 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://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/") + ) + "List of Mailing List Archives to use when stashing links." + :type '(alist :key-type (string :tag "Name") + :value-type (string :tag "URL")) + :group 'notmuch-show) + +(defcustom notmuch-show-stash-mlarchive-link-default "Gmane" + "Default Mailing List Archive to use when stashing links. + +This is used when `notmuch-show-stash-mlarchive-link' isn't +provided with an MLA argument nor `completing-read' input." + :type `(choice + ,@(mapcar + (lambda (mla) + (list 'const :tag (car mla) :value (car mla))) + notmuch-show-stash-mlarchive-link-alist)) + :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 @@ -1017,6 +1043,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 "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) @@ -1604,6 +1632,36 @@ buffer." (interactive) (notmuch-common-do-stash (notmuch-show-get-to))) +(defun notmuch-show-stash-mlarchive-link (&optional mla) + "Copy an ML Archive URI for the current message to the kill-ring. + +This presumes that the message is available at the selected Mailing List Archive. + +If optional argument MLA is non-nil, use the provided key instead of prompting +the user (see `notmuch-show-stash-mlarchive-link-alist')." + (interactive) + (notmuch-common-do-stash + (concat (cdr (assoc + (or mla + (let ((completion-ignore-case t)) + (completing-read + "Message archive: " + notmuch-show-stash-mlarchive-link-alist + nil t nil nil notmuch-show-stash-mlarchive-link-default))) + notmuch-show-stash-mlarchive-link-alist)) + (substring (notmuch-show-get-message-id) 4 -1)))) + +(defun notmuch-show-stash-mlarchive-link-and-go (&optional mla) + "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. + +If optional argument MLA is non-nil, use the provided key instead of prompting +the user (see `notmuch-show-stash-mlarchive-link-alist')." + (interactive) + (notmuch-show-stash-mlarchive-link mla) + (browse-url (current-kill 0 t))) + ;; Commands typically bound to buttons. (defun notmuch-show-part-button-default (&optional button) diff --git a/test/emacs b/test/emacs index f150d95..7d6a272 100755 --- a/test/emacs +++ b/test/emacs @@ -382,9 +382,12 @@ test_emacs '(notmuch-show "id:\"bought\"") (notmuch-show-stash-message-id-stripped) (notmuch-show-stash-tags) (notmuch-show-stash-filename) + (notmuch-show-stash-mlarchive-link "Gmane") + (notmuch-show-stash-mlarchive-link "MARC") + (notmuch-show-stash-mlarchive-link "Mail Archive, The") (switch-to-buffer (generate-new-buffer "*test-stashing*")) - (dotimes (i 9) + (dotimes (i 12) (yank) (insert "\n") (rotate-yank-pointer 1)) @@ -400,6 +403,9 @@ id:"bought" bought inbox,stashtest ${gen_msg_filename} +http://mid.gmane.org/bought +http://marc.info/?i=bought +http://mail-archive.com/search?l=mid&q=bought EOF test_expect_equal_file OUTPUT EXPECTED -- 1.7.8.1 _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
David Edmondson |
|
|
Much nicer :-)
On Fri, 27 Jan 2012 09:44:26 +0100, Pieter Praet <[hidden email]> wrote: > +(defcustom notmuch-show-stash-mlarchive-link-alist > + '(("Gmane" . "http://mid.gmane.org/") > + ("MARC" . "http://marc.info/?i=") > + ("Mail Archive, The" . "http://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/") > + ) > + "List of Mailing List Archives to use when stashing links." > + :type '(alist :key-type (string :tag "Name") > + :value-type (string :tag "URL")) > + :group 'notmuch-show) with the message id. If someone wants to do something more complicated they can submit another patch (maybe it should be an option to have the `cdr' be a function that is called with the message id as an argument?). > + (substring (notmuch-show-get-message-id) 4 -1)))) We should put this logic in one place and re-use it. _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
Dmitry Kurochkin |
|
|
In reply to this post by Pieter Praet
On Fri, 27 Jan 2012 09:42:23 +0100, Pieter Praet <[hidden email]> wrote:
> On Thu, 26 Jan 2012 14:40:26 +0000, David Edmondson <[hidden email]> wrote: > > In general, I like this. > > > > - I think that the stash function(s) should take an optional argument > > specifying the archive to use. That will make testing simpler and also > > allow people to produce preferred bindings more easily. > > > > Agreed. In fact, apparently that last patch [1] of mine made the test > suite hang @ emacs:"Stashing in notmuch-show" due to it waiting for > `completing-read' to finish... Sorry for that. > > > - "Message archive: " feels better than "ML Archive: ", but I don't > > really care. > > > > Agreed. > FWIW I believe "Mailing list archive" would be better. Regards, Dmitry > > - Don't base the patch on the thing that I posted, just on master from > > the repository - no need to make David's life harder. > > Seeing as how it was only a minor improvement to your idea (and further > discussion/correction was probably appropriate), I intended for you to > squash it into your original patch. > > Anyways, patch (relative to master) follows... > > > Peace > > -- > Pieter > > [1] id:"[hidden email]" > _______________________________________________ > notmuch mailing list > [hidden email] > http://notmuchmail.org/mailman/listinfo/notmuch notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
Pieter Praet |
|
|
In reply to this post by David Edmondson
* emacs/notmuch-show.el
(notmuch-show-get-message-id): Add optional arg BARE. When non-nil, return a Message-Id without quotes and prefix, thus obviating the need to strip them off again in various places. (notmuch-show-stash-message-id-stripped): Update wrt changes in `notmuch-show-get-message-id'. --- emacs/notmuch-show.el | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 84ac624..b13d088 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -1216,9 +1216,14 @@ Some useful entries are: (notmuch-show-get-message-properties)))) (plist-get props prop))) -(defun notmuch-show-get-message-id () - "Return the message id of the current message." - (concat "id:\"" (notmuch-show-get-prop :id) "\"")) +(defun notmuch-show-get-message-id (&optional bare) + "Return the Message-Id of the current message. + +If optional argument BARE is non-nil, return +the Message-Id without prefix and quotes." + (if bare + (notmuch-show-get-prop :id) + (concat "id:\"" (notmuch-show-get-prop :id) "\""))) ;; dme: Would it make sense to use a macro for many of these? @@ -1618,7 +1623,7 @@ buffer." (defun notmuch-show-stash-message-id-stripped () "Copy message ID of current message (sans `id:' prefix) to kill-ring." (interactive) - (notmuch-common-do-stash (substring (notmuch-show-get-message-id) 4 -1))) + (notmuch-common-do-stash (notmuch-show-get-message-id t))) (defun notmuch-show-stash-subject () "Copy Subject field of current message to kill-ring." -- 1.7.8.1 _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
Pieter Praet |
|
|
In reply to this post by David Edmondson
* emacs/notmuch-show.el
(notmuch-show-stash-mlarchive-link-alist): New defcustom of type `alist' (key = name, value = URI), containing Mailing List Archive URI's for searching by Message-Id. (notmuch-show-stash-mlarchive-link-default): New defcustom, default MLA to use when `notmuch-show-stash-mlarchive-link' received no user input whatsoever. Available choices are generated using the contents of `notmuch-show-stash-mlarchive-link-alist'. (notmuch-show-stash-map): Added keybinds "l" and "L" for `notmuch-show-stash-mlarchive-link' respectively `notmuch-show-stash-mlarchive-link-and-go'. (notmuch-show-stash-mlarchive-link): New function, stashes a URI pointing to the current message at one of the MLAs configured in `notmuch-show-stash-mlarchive-link-alist'. Prompts user with `completing-read' if not provided with an MLA key. (notmuch-show-stash-mlarchive-link-and-go): New function, uses `notmuch-show-stash-mlarchive-link' to stash a URI, and then visits it using the browser configured in `browse-url-browser-function'. * test/emacs Expanded subtest "Stashing in notmuch-show" wrt new functions `notmuch-show-stash-mlarchive-link{,-and-go}'. Based on original work [1] by David Edmondson <[hidden email]>. [1] id:"[hidden email]" --- Addressed comments by David Edmondson [2] and Dmitry Kurochkin [3]. [2] id:"[hidden email]" [3] id:"[hidden email]" emacs/notmuch-show.el | 61 +++++++++++++++++++++++++++++++++++++++++++++++++ test/emacs | 8 +++++- 2 files changed, 68 insertions(+), 1 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index b13d088..3d1312c 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -124,6 +124,35 @@ 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://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/") + ) + "List of Mailing List Archives to use when stashing links. + +These URIs are concatenated with the current message's +Message-Id in `notmuch-show-stash-mlarchive-link'." + :type '(alist :key-type (string :tag "Name") + :value-type (string :tag "URL")) + :group 'notmuch-show) + +(defcustom notmuch-show-stash-mlarchive-link-default "Gmane" + "Default Mailing List Archive to use when stashing links. + +This is used when `notmuch-show-stash-mlarchive-link' isn't +provided with an MLA argument nor `completing-read' input." + :type `(choice + ,@(mapcar + (lambda (mla) + (list 'const :tag (car mla) :value (car mla))) + notmuch-show-stash-mlarchive-link-alist)) + :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 @@ -1048,6 +1077,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 "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) @@ -1640,6 +1671,36 @@ buffer." (interactive) (notmuch-common-do-stash (notmuch-show-get-to))) +(defun notmuch-show-stash-mlarchive-link (&optional mla) + "Copy an ML Archive URI for the current message to the kill-ring. + +This presumes that the message is available at the selected Mailing List Archive. + +If optional argument MLA is non-nil, use the provided key instead of prompting +the user (see `notmuch-show-stash-mlarchive-link-alist')." + (interactive) + (notmuch-common-do-stash + (concat (cdr (assoc + (or mla + (let ((completion-ignore-case t)) + (completing-read + "Mailing List Archive: " + notmuch-show-stash-mlarchive-link-alist + nil t nil nil notmuch-show-stash-mlarchive-link-default))) + notmuch-show-stash-mlarchive-link-alist)) + (notmuch-show-get-message-id t)))) + +(defun notmuch-show-stash-mlarchive-link-and-go (&optional mla) + "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. + +If optional argument MLA is non-nil, use the provided key instead of prompting +the user (see `notmuch-show-stash-mlarchive-link-alist')." + (interactive) + (notmuch-show-stash-mlarchive-link mla) + (browse-url (current-kill 0 t))) + ;; Commands typically bound to buttons. (defun notmuch-show-part-button-default (&optional button) diff --git a/test/emacs b/test/emacs index 8ca4c8a..38df3a3 100755 --- a/test/emacs +++ b/test/emacs @@ -382,9 +382,12 @@ test_emacs '(notmuch-show "id:\"bought\"") (notmuch-show-stash-message-id-stripped) (notmuch-show-stash-tags) (notmuch-show-stash-filename) + (notmuch-show-stash-mlarchive-link "Gmane") + (notmuch-show-stash-mlarchive-link "MARC") + (notmuch-show-stash-mlarchive-link "Mail Archive, The") (switch-to-buffer (generate-new-buffer "*test-stashing*")) - (dotimes (i 9) + (dotimes (i 12) (yank) (insert "\n") (rotate-yank-pointer 1)) @@ -400,6 +403,9 @@ id:"bought" bought inbox,stashtest ${gen_msg_filename} +http://mid.gmane.org/bought +http://marc.info/?i=bought +http://mail-archive.com/search?l=mid&q=bought EOF test_expect_equal_file OUTPUT EXPECTED -- 1.7.8.1 _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
Pieter Praet |
|
|
In reply to this post by David Edmondson
On Fri, 27 Jan 2012 09:18:40 +0000, David Edmondson <[hidden email]> wrote:
> Much nicer :-) > > On Fri, 27 Jan 2012 09:44:26 +0100, Pieter Praet <[hidden email]> wrote: > > +(defcustom notmuch-show-stash-mlarchive-link-alist > > + '(("Gmane" . "http://mid.gmane.org/") > > + ("MARC" . "http://marc.info/?i=") > > + ("Mail Archive, The" . "http://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/") > > + ) > > + "List of Mailing List Archives to use when stashing links." > > + :type '(alist :key-type (string :tag "Name") > > + :value-type (string :tag "URL")) > > + :group 'notmuch-show) > > Add a comment saying that the URI is the result of concatenating this > with the message id. > Done. > If someone wants to do something more complicated they can submit > another patch (maybe it should be an option to have the `cdr' be a > function that is called with the message id as an argument?). > > > + (substring (notmuch-show-get-message-id) 4 -1)))) > > We should put this logic in one place and re-use it. Done. New patches here: id:"[hidden email]" id:"[hidden email]" For some reason, I've marked them as "v2". :/ Note to self: don't send patches while you're still half asleep... Peace -- Pieter _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
Pieter Praet |
|
|
In reply to this post by Dmitry Kurochkin
On Fri, 27 Jan 2012 20:36:40 +0400, Dmitry Kurochkin <[hidden email]> wrote:
> On Fri, 27 Jan 2012 09:42:23 +0100, Pieter Praet <[hidden email]> wrote: > > On Thu, 26 Jan 2012 14:40:26 +0000, David Edmondson <[hidden email]> wrote: > > > In general, I like this. > > > > > > - I think that the stash function(s) should take an optional argument > > > specifying the archive to use. That will make testing simpler and also > > > allow people to produce preferred bindings more easily. > > > > > > > Agreed. In fact, apparently that last patch [1] of mine made the test > > suite hang @ emacs:"Stashing in notmuch-show" due to it waiting for > > `completing-read' to finish... Sorry for that. > > > > > - "Message archive: " feels better than "ML Archive: ", but I don't > > > really care. > > > > > > > Agreed. > > > > FWIW I believe "Mailing list archive" would be better. > Agreed. > Regards, > Dmitry > > > > - Don't base the patch on the thing that I posted, just on master from > > > the repository - no need to make David's life harder. > > > > Seeing as how it was only a minor improvement to your idea (and further > > discussion/correction was probably appropriate), I intended for you to > > squash it into your original patch. > > > > Anyways, patch (relative to master) follows... > > > > > > Peace > > > > -- > > Pieter > > > > [1] id:"[hidden email]" > > _______________________________________________ > > notmuch mailing list > > [hidden email] > > http://notmuchmail.org/mailman/listinfo/notmuch Peace -- Pieter _______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
David Edmondson |
|
|
In reply to this post by Pieter Praet
Looks good.
_______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
|
David Edmondson |
|
|
In reply to this post by Pieter Praet
Looks good.
_______________________________________________ notmuch mailing list [hidden email] http://notmuchmail.org/mailman/listinfo/notmuch |
| Powered by Nabble | See how NAML generates this page |