[PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-02-19 Thread Pieter Praet
v6:
- Rebased to current master (be851ad3).
- Broke test out into a separate commit.

v5:
- id:"1327907574-12760-1-git-send-email-pieter at praet.org"
- id:"1327907574-12760-2-git-send-email-pieter at praet.org"

v4:
- id:"1327653866-30084-1-git-send-email-pieter at praet.org"

v3:
- id:"1327583610-30085-1-git-send-email-pieter at praet.org"

v2:
- id:"1327452608-8247-1-git-send-email-pieter at praet.org"

v1: (dme)
- id:"1327397873-20596-1-git-send-email-dme at dme.org"


Peace



Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-02-19 Thread Pieter Praet
v6:
- Rebased to current master (be851ad3).
- Broke test out into a separate commit.

v5:
- id:1327907574-12760-1-git-send-email-pie...@praet.org
- id:1327907574-12760-2-git-send-email-pie...@praet.org

v4:
- id:1327653866-30084-1-git-send-email-pie...@praet.org

v3:
- id:1327583610-30085-1-git-send-email-pie...@praet.org

v2:
- id:1327452608-8247-1-git-send-email-pie...@praet.org

v1: (dme)
- id:1327397873-20596-1-git-send-email-...@dme.org


Peace

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[RFC] Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-30 Thread Pieter Praet
On Fri, 27 Jan 2012 20:36:40 +0400, Dmitry Kurochkin  wrote:
> On Fri, 27 Jan 2012 09:42:23 +0100, Pieter Praet  wrote:
> > On Thu, 26 Jan 2012 14:40:26 +, David Edmondson  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 at praet.org"
> > ___
> > notmuch mailing list
> > notmuch at notmuchmail.org
> > http://notmuchmail.org/mailman/listinfo/notmuch


Peace

-- 
Pieter


Re: [RFC] Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-29 Thread Pieter Praet
On Fri, 27 Jan 2012 20:36:40 +0400, Dmitry Kurochkin 
dmitry.kuroch...@gmail.com wrote:
 On Fri, 27 Jan 2012 09:42:23 +0100, Pieter Praet pie...@praet.org wrote:
  On Thu, 26 Jan 2012 14:40:26 +, David Edmondson d...@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-pie...@praet.org
  ___
  notmuch mailing list
  notmuch@notmuchmail.org
  http://notmuchmail.org/mailman/listinfo/notmuch


Peace

-- 
Pieter
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[RFC] Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-27 Thread Dmitry Kurochkin
On Fri, 27 Jan 2012 09:42:23 +0100, Pieter Praet  wrote:
> On Thu, 26 Jan 2012 14:40:26 +, David Edmondson  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 at praet.org"
> ___
> notmuch mailing list
> notmuch at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


[RFC] Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-27 Thread Pieter Praet
On Thu, 26 Jan 2012 14:40:26 +, David Edmondson  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 at praet.org"


Re: [RFC] Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-27 Thread Pieter Praet
On Thu, 26 Jan 2012 14:40:26 +, David Edmondson d...@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-pie...@praet.org
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[RFC] Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-26 Thread 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.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 



[RFC] Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-26 Thread Pieter Praet
---

Depends on id:"1327397873-20596-1-git-send-email-dme at 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=;)
+;; 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 ( 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



[PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-26 Thread Pieter Praet
On Wed, 25 Jan 2012 06:31:43 +, David Edmondson  wrote:
> On Wed, 25 Jan 2012 01:50:08 +0100, Pieter Praet  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=;)
> > +;; (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 ( 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
> > +++ 

[PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-26 Thread Pieter Praet
On Wed, 25 Jan 2012 15:00:22 +0200, Tomi Ollila  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


Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-26 Thread Pieter Praet
On Wed, 25 Jan 2012 15:00:22 +0200, Tomi Ollila tomi.oll...@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
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-26 Thread Pieter Praet
On Wed, 25 Jan 2012 06:31:43 +, David Edmondson d...@dme.org wrote:
 On Wed, 25 Jan 2012 01:50:08 +0100, Pieter Praet pie...@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=midq=;)
  +;; (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)
  +   

[RFC] Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-26 Thread Pieter Praet
---

Depends on id:1327397873-20596-1-git-send-email-...@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=midq=;)
+;; 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
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [RFC] Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-26 Thread 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.


pgpTvAwM48KcB.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-25 Thread Tomi Ollila
On Wed, 25 Jan 2012 10:41:26 +, David Edmondson  wrote:
> On Wed, 25 Jan 2012 12:18:22 +0200, Tomi Ollila  wrote:
> > On Wed, 25 Jan 2012 06:31:43 +, David Edmondson  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


[PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-25 Thread Tomi Ollila
On Wed, 25 Jan 2012 06:31:43 +, David Edmondson  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...



[PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-25 Thread David Edmondson
On Wed, 25 Jan 2012 12:18:22 +0200, Tomi Ollila  wrote:
> On Wed, 25 Jan 2012 06:31:43 +, David Edmondson  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?
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 



[PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-25 Thread David Edmondson
On Wed, 25 Jan 2012 01:50:08 +0100, Pieter Praet  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=;)
> +  ;; (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 ( 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
> 
-- next part --
A non-text 

[PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-25 Thread 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=;)
+;; (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 ( 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



Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-25 Thread Tomi Ollila
On Wed, 25 Jan 2012 06:31:43 +, David Edmondson d...@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...

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-25 Thread David Edmondson
On Wed, 25 Jan 2012 12:18:22 +0200, Tomi Ollila tomi.oll...@iki.fi wrote:
 On Wed, 25 Jan 2012 06:31:43 +, David Edmondson d...@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?


pgpJdOhue2FOu.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-25 Thread Tomi Ollila
On Wed, 25 Jan 2012 10:41:26 +, David Edmondson d...@dme.org wrote:
 On Wed, 25 Jan 2012 12:18:22 +0200, Tomi Ollila tomi.oll...@iki.fi wrote:
  On Wed, 25 Jan 2012 06:31:43 +, David Edmondson d...@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
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-24 Thread 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 ( 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



[PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-24 Thread 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
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] emacs: Add `notmuch-show-stash-gmane' and `notmuch-show-stash-gmane-and-go'.

2012-01-24 Thread David Edmondson
On Wed, 25 Jan 2012 01:50:08 +0100, Pieter Praet pie...@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=midq=;)
 +  ;; (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
 


pgpAlslsAefDv.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch