* [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.
@ 2012-01-24 9:37 David Edmondson
2012-01-25 0:50 ` Pieter Praet
` (3 more replies)
0 siblings, 4 replies; 28+ messages in thread
From: David Edmondson @ 2012-01-24 9:37 UTC (permalink / raw)
To: notmuch
`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
^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.
2012-01-24 9:37 [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go' David Edmondson
@ 2012-01-25 0:50 ` Pieter Praet
2012-01-25 6:31 ` David Edmondson
2012-01-30 7:12 ` [PATCH v2 1/2] emacs: `notmuch-show-get-message-id': optionally return Message-Id sans prefix Pieter Praet
` (2 subsequent siblings)
3 siblings, 1 reply; 28+ messages in thread
From: Pieter Praet @ 2012-01-25 0:50 UTC (permalink / raw)
To: David Edmondson; +Cc: Notmuch Mail
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
^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.
2012-01-25 0:50 ` Pieter Praet
@ 2012-01-25 6:31 ` David Edmondson
2012-01-25 10:18 ` Tomi Ollila
2012-01-26 13:07 ` Pieter Praet
0 siblings, 2 replies; 28+ messages in thread
From: David Edmondson @ 2012-01-25 6:31 UTC (permalink / raw)
To: Pieter Praet; +Cc: Notmuch Mail
[-- Attachment #1: Type: text/plain, Size: 4815 bytes --]
On Wed, 25 Jan 2012 01:50:08 +0100, Pieter Praet <pieter@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?
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
>
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.
2012-01-25 6:31 ` David Edmondson
@ 2012-01-25 10:18 ` Tomi Ollila
2012-01-25 10:41 ` David Edmondson
2012-01-26 13:07 ` Pieter Praet
1 sibling, 1 reply; 28+ messages in thread
From: Tomi Ollila @ 2012-01-25 10:18 UTC (permalink / raw)
To: David Edmondson, Pieter Praet; +Cc: Notmuch Mail
On Wed, 25 Jan 2012 06:31:43 +0000, David Edmondson <dme@dme.org> 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...
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.
2012-01-25 10:18 ` Tomi Ollila
@ 2012-01-25 10:41 ` David Edmondson
2012-01-25 13:00 ` Tomi Ollila
0 siblings, 1 reply; 28+ messages in thread
From: David Edmondson @ 2012-01-25 10:41 UTC (permalink / raw)
To: Tomi Ollila, Pieter Praet; +Cc: Notmuch Mail
[-- Attachment #1: Type: text/plain, Size: 693 bytes --]
On Wed, 25 Jan 2012 12:18:22 +0200, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> On Wed, 25 Jan 2012 06:31:43 +0000, David Edmondson <dme@dme.org> 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?
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.
2012-01-25 10:41 ` David Edmondson
@ 2012-01-25 13:00 ` Tomi Ollila
2012-01-26 13:05 ` Pieter Praet
0 siblings, 1 reply; 28+ messages in thread
From: Tomi Ollila @ 2012-01-25 13:00 UTC (permalink / raw)
To: David Edmondson, Pieter Praet; +Cc: Notmuch Mail
On Wed, 25 Jan 2012 10:41:26 +0000, David Edmondson <dme@dme.org> wrote:
> On Wed, 25 Jan 2012 12:18:22 +0200, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> > On Wed, 25 Jan 2012 06:31:43 +0000, David Edmondson <dme@dme.org> 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
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.
2012-01-25 13:00 ` Tomi Ollila
@ 2012-01-26 13:05 ` Pieter Praet
0 siblings, 0 replies; 28+ messages in thread
From: Pieter Praet @ 2012-01-26 13:05 UTC (permalink / raw)
To: Tomi Ollila, David Edmondson; +Cc: Notmuch Mail
On Wed, 25 Jan 2012 15:00:22 +0200, Tomi Ollila <tomi.ollila@iki.fi> 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
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.
2012-01-25 6:31 ` David Edmondson
2012-01-25 10:18 ` Tomi Ollila
@ 2012-01-26 13:07 ` Pieter Praet
2012-01-26 13:13 ` [RFC] " Pieter Praet
1 sibling, 1 reply; 28+ messages in thread
From: Pieter Praet @ 2012-01-26 13:07 UTC (permalink / raw)
To: David Edmondson; +Cc: Notmuch Mail
On Wed, 25 Jan 2012 06:31:43 +0000, David Edmondson <dme@dme.org> wrote:
> On Wed, 25 Jan 2012 01:50:08 +0100, Pieter Praet <pieter@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
^ permalink raw reply [flat|nested] 28+ messages in thread
* [RFC] Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.
2012-01-26 13:07 ` Pieter Praet
@ 2012-01-26 13:13 ` Pieter Praet
2012-01-26 14:40 ` David Edmondson
0 siblings, 1 reply; 28+ messages in thread
From: Pieter Praet @ 2012-01-26 13:13 UTC (permalink / raw)
To: David Edmondson; +Cc: Notmuch Mail
---
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
^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [RFC] Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.
2012-01-26 13:13 ` [RFC] " Pieter Praet
@ 2012-01-26 14:40 ` David Edmondson
2012-01-27 8:42 ` Pieter Praet
0 siblings, 1 reply; 28+ messages in thread
From: David Edmondson @ 2012-01-26 14:40 UTC (permalink / raw)
To: Pieter Praet; +Cc: Notmuch Mail
[-- Attachment #1: Type: text/plain, Size: 439 bytes --]
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.
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [RFC] Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.
2012-01-26 14:40 ` David Edmondson
@ 2012-01-27 8:42 ` Pieter Praet
2012-01-27 8:44 ` [PATCH v4?] emacs: add `notmuch-show-stash-mlarchive-link{,-and-go}' Pieter Praet
2012-01-27 16:36 ` [RFC] Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go' Dmitry Kurochkin
0 siblings, 2 replies; 28+ messages in thread
From: Pieter Praet @ 2012-01-27 8:42 UTC (permalink / raw)
To: David Edmondson; +Cc: Notmuch Mail
On Thu, 26 Jan 2012 14:40:26 +0000, David Edmondson <dme@dme.org> 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:"1327583610-30085-1-git-send-email-pieter@praet.org"
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v4?] emacs: add `notmuch-show-stash-mlarchive-link{,-and-go}'
2012-01-27 8:42 ` Pieter Praet
@ 2012-01-27 8:44 ` Pieter Praet
2012-01-27 9:18 ` [PATCH v4?] emacs: add `notmuch-show-stash-mlarchive-link{, -and-go}' David Edmondson
2012-01-27 16:36 ` [RFC] Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go' Dmitry Kurochkin
1 sibling, 1 reply; 28+ messages in thread
From: Pieter Praet @ 2012-01-27 8:44 UTC (permalink / raw)
To: David Edmondson; +Cc: Notmuch Mail
* 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 <dme@dme.org>.
[1] id:"1327397873-20596-1-git-send-email-dme@dme.org"
---
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
^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [PATCH v4?] emacs: add `notmuch-show-stash-mlarchive-link{, -and-go}'
2012-01-27 8:44 ` [PATCH v4?] emacs: add `notmuch-show-stash-mlarchive-link{,-and-go}' Pieter Praet
@ 2012-01-27 9:18 ` David Edmondson
2012-01-30 7:18 ` Pieter Praet
0 siblings, 1 reply; 28+ messages in thread
From: David Edmondson @ 2012-01-27 9:18 UTC (permalink / raw)
To: Pieter Praet; +Cc: Notmuch Mail
[-- Attachment #1: Type: text/plain, Size: 1109 bytes --]
Much nicer :-)
On Fri, 27 Jan 2012 09:44:26 +0100, Pieter Praet <pieter@praet.org> 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.
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.
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [RFC] Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.
2012-01-27 8:42 ` Pieter Praet
2012-01-27 8:44 ` [PATCH v4?] emacs: add `notmuch-show-stash-mlarchive-link{,-and-go}' Pieter Praet
@ 2012-01-27 16:36 ` Dmitry Kurochkin
2012-01-30 7:19 ` Pieter Praet
1 sibling, 1 reply; 28+ messages in thread
From: Dmitry Kurochkin @ 2012-01-27 16:36 UTC (permalink / raw)
To: Pieter Praet, David Edmondson; +Cc: Notmuch Mail
On Fri, 27 Jan 2012 09:42:23 +0100, Pieter Praet <pieter@praet.org> wrote:
> On Thu, 26 Jan 2012 14:40:26 +0000, David Edmondson <dme@dme.org> 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:"1327583610-30085-1-git-send-email-pieter@praet.org"
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v2 1/2] emacs: `notmuch-show-get-message-id': optionally return Message-Id sans prefix
2012-01-24 9:37 [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go' David Edmondson
2012-01-25 0:50 ` Pieter Praet
@ 2012-01-30 7:12 ` Pieter Praet
2012-01-30 8:29 ` David Edmondson
2012-01-30 7:12 ` [PATCH v2 2/2] emacs: add `notmuch-show-stash-mlarchive-link{, -and-go}' Pieter Praet
2012-02-19 20:50 ` [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go' Pieter Praet
3 siblings, 1 reply; 28+ messages in thread
From: Pieter Praet @ 2012-01-30 7:12 UTC (permalink / raw)
To: David Edmondson; +Cc: Notmuch Mail
* 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
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v2 2/2] emacs: add `notmuch-show-stash-mlarchive-link{, -and-go}'
2012-01-24 9:37 [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go' David Edmondson
2012-01-25 0:50 ` Pieter Praet
2012-01-30 7:12 ` [PATCH v2 1/2] emacs: `notmuch-show-get-message-id': optionally return Message-Id sans prefix Pieter Praet
@ 2012-01-30 7:12 ` Pieter Praet
2012-01-30 8:30 ` David Edmondson
2012-02-19 20:50 ` [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go' Pieter Praet
3 siblings, 1 reply; 28+ messages in thread
From: Pieter Praet @ 2012-01-30 7:12 UTC (permalink / raw)
To: David Edmondson; +Cc: Notmuch Mail
* 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 <dme@dme.org>.
[1] id:"1327397873-20596-1-git-send-email-dme@dme.org"
---
Addressed comments by David Edmondson [2] and Dmitry Kurochkin [3].
[2] id:"cunsjj1jyfj.fsf@hotblack-desiato.hh.sledj.net"
[3] id:"87zkd9je5j.fsf@gmail.com"
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
^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [PATCH v4?] emacs: add `notmuch-show-stash-mlarchive-link{, -and-go}'
2012-01-27 9:18 ` [PATCH v4?] emacs: add `notmuch-show-stash-mlarchive-link{, -and-go}' David Edmondson
@ 2012-01-30 7:18 ` Pieter Praet
0 siblings, 0 replies; 28+ messages in thread
From: Pieter Praet @ 2012-01-30 7:18 UTC (permalink / raw)
To: David Edmondson; +Cc: Notmuch Mail
On Fri, 27 Jan 2012 09:18:40 +0000, David Edmondson <dme@dme.org> wrote:
> Much nicer :-)
>
> On Fri, 27 Jan 2012 09:44:26 +0100, Pieter Praet <pieter@praet.org> 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:"1327907574-12760-1-git-send-email-pieter@praet.org"
id:"1327907574-12760-2-git-send-email-pieter@praet.org"
For some reason, I've marked them as "v2". :/
Note to self: don't send patches while you're still half asleep...
Peace
--
Pieter
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [RFC] Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.
2012-01-27 16:36 ` [RFC] Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go' Dmitry Kurochkin
@ 2012-01-30 7:19 ` Pieter Praet
0 siblings, 0 replies; 28+ messages in thread
From: Pieter Praet @ 2012-01-30 7:19 UTC (permalink / raw)
To: Dmitry Kurochkin, David Edmondson; +Cc: Notmuch Mail
On Fri, 27 Jan 2012 20:36:40 +0400, Dmitry Kurochkin <dmitry.kurochkin@gmail.com> wrote:
> On Fri, 27 Jan 2012 09:42:23 +0100, Pieter Praet <pieter@praet.org> wrote:
> > On Thu, 26 Jan 2012 14:40:26 +0000, David Edmondson <dme@dme.org> 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:"1327583610-30085-1-git-send-email-pieter@praet.org"
> > _______________________________________________
> > notmuch mailing list
> > notmuch@notmuchmail.org
> > http://notmuchmail.org/mailman/listinfo/notmuch
Peace
--
Pieter
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v2 1/2] emacs: `notmuch-show-get-message-id': optionally return Message-Id sans prefix
2012-01-30 7:12 ` [PATCH v2 1/2] emacs: `notmuch-show-get-message-id': optionally return Message-Id sans prefix Pieter Praet
@ 2012-01-30 8:29 ` David Edmondson
0 siblings, 0 replies; 28+ messages in thread
From: David Edmondson @ 2012-01-30 8:29 UTC (permalink / raw)
To: Pieter Praet; +Cc: Notmuch Mail
[-- Attachment #1: Type: text/plain, Size: 12 bytes --]
Looks good.
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v2 2/2] emacs: add `notmuch-show-stash-mlarchive-link{, -and-go}'
2012-01-30 7:12 ` [PATCH v2 2/2] emacs: add `notmuch-show-stash-mlarchive-link{, -and-go}' Pieter Praet
@ 2012-01-30 8:30 ` David Edmondson
0 siblings, 0 replies; 28+ messages in thread
From: David Edmondson @ 2012-01-30 8:30 UTC (permalink / raw)
To: Pieter Praet; +Cc: Notmuch Mail
[-- Attachment #1: Type: text/plain, Size: 12 bytes --]
Looks good.
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.
2012-01-24 9:37 [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go' David Edmondson
` (2 preceding siblings ...)
2012-01-30 7:12 ` [PATCH v2 2/2] emacs: add `notmuch-show-stash-mlarchive-link{, -and-go}' Pieter Praet
@ 2012-02-19 20:50 ` Pieter Praet
2012-02-19 20:50 ` [PATCH v6 1/3] emacs: `notmuch-show-get-message-id': optionally return Message-Id sans prefix Pieter Praet
` (2 more replies)
3 siblings, 3 replies; 28+ messages in thread
From: Pieter Praet @ 2012-02-19 20:50 UTC (permalink / raw)
To: David Edmondson; +Cc: Notmuch Mail
v6:
- Rebased to current master (be851ad3).
- Broke test out into a separate commit.
v5:
- id:"1327907574-12760-1-git-send-email-pieter@praet.org"
- id:"1327907574-12760-2-git-send-email-pieter@praet.org"
v4:
- id:"1327653866-30084-1-git-send-email-pieter@praet.org"
v3:
- id:"1327583610-30085-1-git-send-email-pieter@praet.org"
v2:
- id:"1327452608-8247-1-git-send-email-pieter@praet.org"
v1: (dme)
- id:"1327397873-20596-1-git-send-email-dme@dme.org"
Peace
^ permalink raw reply [flat|nested] 28+ messages in thread
* [PATCH v6 1/3] emacs: `notmuch-show-get-message-id': optionally return Message-Id sans prefix
2012-02-19 20:50 ` [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go' Pieter Praet
@ 2012-02-19 20:50 ` Pieter Praet
2012-02-25 14:40 ` David Bremner
2012-02-19 20:50 ` [PATCH v6 2/3] test: emacs: expand subtest "Stashing in notmuch-show" wrt stashing Mailing List Archive URIs Pieter Praet
2012-02-19 20:50 ` [PATCH v6 3/3] emacs: add `notmuch-show-stash-mlarchive-link{, -and-go}' Pieter Praet
2 siblings, 1 reply; 28+ messages in thread
From: Pieter Praet @ 2012-02-19 20:50 UTC (permalink / raw)
To: David Edmondson; +Cc: Notmuch Mail
* 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 aa9ccee..cefad11 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1329,9 +1329,14 @@ (defun notmuch-show-get-prop (prop &optional props)
(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) "\"")))
(defun notmuch-show-get-messages-ids ()
"Return all message ids of messages in the current thread."
@@ -1789,7 +1794,7 @@ (defun notmuch-show-stash-message-id ()
(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
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v6 2/3] test: emacs: expand subtest "Stashing in notmuch-show" wrt stashing Mailing List Archive URIs
2012-02-19 20:50 ` [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go' Pieter Praet
2012-02-19 20:50 ` [PATCH v6 1/3] emacs: `notmuch-show-get-message-id': optionally return Message-Id sans prefix Pieter Praet
@ 2012-02-19 20:50 ` Pieter Praet
2012-02-19 20:50 ` [PATCH v6 3/3] emacs: add `notmuch-show-stash-mlarchive-link{, -and-go}' Pieter Praet
2 siblings, 0 replies; 28+ messages in thread
From: Pieter Praet @ 2012-02-19 20:50 UTC (permalink / raw)
To: David Edmondson; +Cc: Notmuch Mail
`notmuch-show-stash-mlarchive-link' stashes a URI pointing to the current message
at one of the MLAs configured in `notmuch-show-stash-mlarchive-link-alist'.
Marked as "broken": fixed in next commit.
---
test/emacs | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/test/emacs b/test/emacs
index b74cfa9..1f213e3 100755
--- a/test/emacs
+++ b/test/emacs
@@ -384,6 +384,7 @@ test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.
test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-hidden-messages
test_begin_subtest "Stashing in notmuch-show"
+test_subtest_known_broken
add_message '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' \
'[from]="Some One <someone@somewhere.org>"' \
'[to]="Some One Else <notsomeone@somewhere.org>"' \
@@ -402,9 +403,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))
@@ -420,6 +424,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
^ permalink raw reply related [flat|nested] 28+ messages in thread
* [PATCH v6 3/3] emacs: add `notmuch-show-stash-mlarchive-link{, -and-go}'
2012-02-19 20:50 ` [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go' Pieter Praet
2012-02-19 20:50 ` [PATCH v6 1/3] emacs: `notmuch-show-get-message-id': optionally return Message-Id sans prefix Pieter Praet
2012-02-19 20:50 ` [PATCH v6 2/3] test: emacs: expand subtest "Stashing in notmuch-show" wrt stashing Mailing List Archive URIs Pieter Praet
@ 2012-02-19 20:50 ` Pieter Praet
2 siblings, 0 replies; 28+ messages in thread
From: Pieter Praet @ 2012-02-19 20:50 UTC (permalink / raw)
To: David Edmondson; +Cc: Notmuch Mail
* 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'.
Based on original work [1] by David Edmondson <dme@dme.org>.
[1] id:"1327397873-20596-1-git-send-email-dme@dme.org"
---
emacs/notmuch-show.el | 61 +++++++++++++++++++++++++++++++++++++++++++++++++
test/emacs | 1 -
2 files changed, 61 insertions(+), 1 deletions(-)
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index cefad11..6ced501 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -155,6 +155,35 @@ (defvar notmuch-show-indent-content t)
(make-variable-buffer-local 'notmuch-show-indent-content)
(put 'notmuch-show-indent-content 'permanent-local t)
+(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
@@ -1145,6 +1174,8 @@ (defvar notmuch-show-stash-map
(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)
@@ -1811,6 +1842,36 @@ (defun notmuch-show-stash-to ()
(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 1f213e3..c38233c 100755
--- a/test/emacs
+++ b/test/emacs
@@ -384,7 +384,6 @@ test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.
test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-hidden-messages
test_begin_subtest "Stashing in notmuch-show"
-test_subtest_known_broken
add_message '[date]="Sat, 01 Jan 2000 12:00:00 -0000"' \
'[from]="Some One <someone@somewhere.org>"' \
'[to]="Some One Else <notsomeone@somewhere.org>"' \
--
1.7.8.1
^ permalink raw reply related [flat|nested] 28+ messages in thread
* Re: [PATCH v6 1/3] emacs: `notmuch-show-get-message-id': optionally return Message-Id sans prefix
2012-02-19 20:50 ` [PATCH v6 1/3] emacs: `notmuch-show-get-message-id': optionally return Message-Id sans prefix Pieter Praet
@ 2012-02-25 14:40 ` David Bremner
2012-02-28 18:40 ` Pieter Praet
0 siblings, 1 reply; 28+ messages in thread
From: David Bremner @ 2012-02-25 14:40 UTC (permalink / raw)
To: Pieter Praet; +Cc: Notmuch Mail
On Sun, 19 Feb 2012 21:50:25 +0100, Pieter Praet <pieter@praet.org> wrote:
> * 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.
Pushed all three.
d
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v6 1/3] emacs: `notmuch-show-get-message-id': optionally return Message-Id sans prefix
2012-02-25 14:40 ` David Bremner
@ 2012-02-28 18:40 ` Pieter Praet
2012-02-29 12:19 ` David Bremner
0 siblings, 1 reply; 28+ messages in thread
From: Pieter Praet @ 2012-02-28 18:40 UTC (permalink / raw)
To: David Bremner; +Cc: Notmuch Mail
On Sat, 25 Feb 2012 10:40:25 -0400, David Bremner <david@tethera.net> wrote:
> On Sun, 19 Feb 2012 21:50:25 +0100, Pieter Praet <pieter@praet.org> wrote:
> > * 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.
>
> Pushed all three.
>
Thanks!
Though I couldn't help but notice (it's a curse...) that patch #3
seems to have gained an extra space in its commit message subject:
Original (id:"1329684627-10708-4-git-send-email-pieter@praet.org"):
emacs: add `notmuch-show-stash-mlarchive-link{,-and-go}'
^
Pushed (commit 2f86290a):
emacs: add `notmuch-show-stash-mlarchive-link{, -and-go}'
^
Don't know whether or not this was accidental, but it's happened
before, with a similar commit message subject:
Original (id:"1327292557-7701-1-git-send-email-pieter@praet.org"):
search: rename auto_exclude_tags to {search,}exclude_tags
^
Pushed (commit 649a9f5f):
search: rename auto_exclude_tags to {search, }exclude_tags
^
Perhaps you're calling uncrustify(1) or something similar
from your '.git/hooks/applypatch-msg' ?
> d
Peace
--
Pieter
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v6 1/3] emacs: `notmuch-show-get-message-id': optionally return Message-Id sans prefix
2012-02-28 18:40 ` Pieter Praet
@ 2012-02-29 12:19 ` David Bremner
2012-03-01 17:12 ` Pieter Praet
0 siblings, 1 reply; 28+ messages in thread
From: David Bremner @ 2012-02-29 12:19 UTC (permalink / raw)
To: Pieter Praet; +Cc: Notmuch Mail
On Tue, 28 Feb 2012 19:40:04 +0100, Pieter Praet <pieter@praet.org> wrote:
>
> Though I couldn't help but notice (it's a curse...) that patch #3
> seems to have gained an extra space in its commit message subject:
>
> Original (id:"1329684627-10708-4-git-send-email-pieter@praet.org"):
> emacs: add `notmuch-show-stash-mlarchive-link{,-and-go}'
> ^
I don't have any applypatch-msg hook. I am using
"notmuch show --format=raw $messageid | git am -" to
apply the patch.
I looked at the file on disk, and something is wrapping the subject
there. Perhaps somebody's unwrapping code is buggy? I'm not sure what's
at fault here; maybe you could experiment with applying the the patches
from the list and let me know if e.g. going from files is better than
using "notmuch show --format=raw".
d
^ permalink raw reply [flat|nested] 28+ messages in thread
* Re: [PATCH v6 1/3] emacs: `notmuch-show-get-message-id': optionally return Message-Id sans prefix
2012-02-29 12:19 ` David Bremner
@ 2012-03-01 17:12 ` Pieter Praet
0 siblings, 0 replies; 28+ messages in thread
From: Pieter Praet @ 2012-03-01 17:12 UTC (permalink / raw)
To: David Bremner; +Cc: Notmuch Mail
On Wed, 29 Feb 2012 08:19:34 -0400, David Bremner <david@tethera.net> wrote:
> On Tue, 28 Feb 2012 19:40:04 +0100, Pieter Praet <pieter@praet.org> wrote:
> >
> > Though I couldn't help but notice (it's a curse...) that patch #3
> > seems to have gained an extra space in its commit message subject:
> >
> > Original (id:"1329684627-10708-4-git-send-email-pieter@praet.org"):
> > emacs: add `notmuch-show-stash-mlarchive-link{,-and-go}'
> > ^
>
> I don't have any applypatch-msg hook. I am using
> "notmuch show --format=raw $messageid | git am -" to
> apply the patch.
>
> I looked at the file on disk, and something is wrapping the subject
> there. Perhaps somebody's unwrapping code is buggy? I'm not sure what's
> at fault here; [...]
TL;DR: Doesn't seem like there's much we can do about it...
According to RFC 2822 section 2.2.3 [1], header fields should be folded
by inserting a CRLF right before the last whitespace char before the
line exceeds 78 characters, and when a field contains comma-separated
values (which is somewhat applicable in this case), it should be folded
by inserting a CRLF right after a comma.
Now, the issue is that unfolding is accomplished by simply removing any
CRLF that is immediately followed by a whitespace char:
If the subject headers of those patches were folded by simply inserting
a CRLF, they couldn't possibly be unfolded again as there wouldn't be a
whitespace char right after the CRLF, so Mailman seems to have helpfully
inserted a tab...
Here's one of those patches at a number of archives:
- http://notmuchmail.org/pipermail/notmuch/2012/009575.html
- http://mid.gmane.org/1329684627-10708-4-git-send-email-pieter@praet.org
- http://mail-archive.com/search?l=mid&q=1329684627-10708-4-git-send-email-pieter@praet.org
As you can see (in the source of those pages), both Pipermail and Gmane
unfold the subject header by simply removing the line break, and at The
Mail Archive, the tab is also replaced by a space. I assume the latter
also happens in gmime ?
So, I guess I'll just have to learn to live with it... :)
> [...] maybe you could experiment with applying the the patches
> from the list and let me know if e.g. going from files is better than
> using "notmuch show --format=raw".
>
Based on my (admittedly very superficial) analysis of the problem,
that won't do us any good wrt this issue, unfortunately...
But it *would* buy us a (slight) performance increase, so if/when my
patch to `notmuch-show-mapc' [2] goes in, we might want to consider
making `notmuch-show-pipe-message' use `notmuch-show-get-filename'
instead of `notmuch-show-get-message-{id,ids-for-open-messages}'.
> d
>
>
Peace
--
Pieter
[1] http://tools.ietf.org/html/rfc2822.html#section-2.2.3
[2] id:"1330122640-18895-5-git-send-email-pieter@praet.org"
^ permalink raw reply [flat|nested] 28+ messages in thread
end of thread, other threads:[~2012-03-01 17:14 UTC | newest]
Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-24 9:37 [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go' David Edmondson
2012-01-25 0:50 ` Pieter Praet
2012-01-25 6:31 ` David Edmondson
2012-01-25 10:18 ` Tomi Ollila
2012-01-25 10:41 ` David Edmondson
2012-01-25 13:00 ` Tomi Ollila
2012-01-26 13:05 ` Pieter Praet
2012-01-26 13:07 ` Pieter Praet
2012-01-26 13:13 ` [RFC] " Pieter Praet
2012-01-26 14:40 ` David Edmondson
2012-01-27 8:42 ` Pieter Praet
2012-01-27 8:44 ` [PATCH v4?] emacs: add `notmuch-show-stash-mlarchive-link{,-and-go}' Pieter Praet
2012-01-27 9:18 ` [PATCH v4?] emacs: add `notmuch-show-stash-mlarchive-link{, -and-go}' David Edmondson
2012-01-30 7:18 ` Pieter Praet
2012-01-27 16:36 ` [RFC] Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go' Dmitry Kurochkin
2012-01-30 7:19 ` Pieter Praet
2012-01-30 7:12 ` [PATCH v2 1/2] emacs: `notmuch-show-get-message-id': optionally return Message-Id sans prefix Pieter Praet
2012-01-30 8:29 ` David Edmondson
2012-01-30 7:12 ` [PATCH v2 2/2] emacs: add `notmuch-show-stash-mlarchive-link{, -and-go}' Pieter Praet
2012-01-30 8:30 ` David Edmondson
2012-02-19 20:50 ` [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go' Pieter Praet
2012-02-19 20:50 ` [PATCH v6 1/3] emacs: `notmuch-show-get-message-id': optionally return Message-Id sans prefix Pieter Praet
2012-02-25 14:40 ` David Bremner
2012-02-28 18:40 ` Pieter Praet
2012-02-29 12:19 ` David Bremner
2012-03-01 17:12 ` Pieter Praet
2012-02-19 20:50 ` [PATCH v6 2/3] test: emacs: expand subtest "Stashing in notmuch-show" wrt stashing Mailing List Archive URIs Pieter Praet
2012-02-19 20:50 ` [PATCH v6 3/3] emacs: add `notmuch-show-stash-mlarchive-link{, -and-go}' Pieter Praet
Code repositories for project(s) associated with this public inbox
https://yhetil.org/notmuch.git/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).