[PATCH 2/2] emacs: new mua mailto: URI handler

2012-04-15 Thread Jani Nikula
Jameson Graef Rollins  writes:

> On Sat, Apr 14 2012, Jani Nikula  wrote:
>> I was doing this purely based on whether the patches apply or not.
>
> I'm so sorry, Jani.  You are correct that this patch requires a small
> rebase fix to apply to master.  I'm not sure how I missed it previously.

No problem. Thanks for checking again; I was worried we might have a bug
somewhere. :)

Jani.


[PATCH 2/2] emacs: new mua mailto: URI handler

2012-04-15 Thread Jani Nikula
Jameson Graef Rollins  writes:

> On Sat, Apr 14 2012, Jani Nikula  wrote:
>> I'm going through the review queue right now, tagging notmuch::stale any
>> patches that don't apply on master. I was just about to nmbug push stale
>> on this one (2/2). Is that in error? Care to verify?
>
> Yes, it is an error.  This patch applies to master.  Did you in fact
> verify that it doesn't?  You should not be tagging patches stale if they
> in fact still apply to master.  If they still need review or something
> else that's a different matter.  Please don't mark things as stale if
> they are not.

My nmfirehose script flagged the patch as not applying, and I verified
this (and all of them) by hand, using the emacs interface to save the
patch. No, I'm not intentionally tagging patches stale if they apply,
but I'll stop for now in case there's a bug somewhere (incl. PEBKAC)
breaking the patches and thus making them not apply.

> Obviously I still care about this patch, or I wouldn't have re-commented
> on it.

I was doing this purely based on whether the patches apply or not.


BR,
Jani.


[PATCH 2/2] emacs: new mua mailto: URI handler

2012-04-15 Thread Jani Nikula
Jameson Graef Rollins  writes:

> On Sun, Jan 29 2012, Jameson Graef Rollins  
> wrote:
>> The new function 'notmuch-mua-mailto' provides an interactive handler
>> for rfc6068 "mailto:; URIs.  It attempts to implement the rfc6068
>> specification: http://tools.ietf.org/html/rfc6068
>
> I am using and finding this patch useful.  It has no conflict with
> anything when not used.  Is there any other objection with pushing it?

I'm going through the review queue right now, tagging notmuch::stale any
patches that don't apply on master. I was just about to nmbug push stale
on this one (2/2). Is that in error? Care to verify?

BR,
Jani.


[PATCH 2/2] emacs: new mua mailto: URI handler

2012-04-14 Thread Jameson Graef Rollins
On Sat, Apr 14 2012, Jani Nikula  wrote:
> I was doing this purely based on whether the patches apply or not.

I'm so sorry, Jani.  You are correct that this patch requires a small
rebase fix to apply to master.  I'm not sure how I missed it previously.

Updated version on the way.

jamie.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 



[PATCH 2/2] emacs: new mua mailto: URI handler

2012-04-14 Thread Jameson Graef Rollins
On Sat, Apr 14 2012, Jani Nikula  wrote:
> I'm going through the review queue right now, tagging notmuch::stale any
> patches that don't apply on master. I was just about to nmbug push stale
> on this one (2/2). Is that in error? Care to verify?

Yes, it is an error.  This patch applies to master.  Did you in fact
verify that it doesn't?  You should not be tagging patches stale if they
in fact still apply to master.  If they still need review or something
else that's a different matter.  Please don't mark things as stale if
they are not.

Obviously I still care about this patch, or I wouldn't have re-commented
on it.

jamie.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 



[PATCH 2/2] emacs: new mua mailto: URI handler

2012-04-14 Thread Jameson Graef Rollins
On Sun, Jan 29 2012, Jameson Graef Rollins  
wrote:
> The new function 'notmuch-mua-mailto' provides an interactive handler
> for rfc6068 "mailto:; URIs.  It attempts to implement the rfc6068
> specification: http://tools.ietf.org/html/rfc6068

I am using and finding this patch useful.  It has no conflict with
anything when not used.  Is there any other objection with pushing it?

jamie.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 



Re: [PATCH 2/2] emacs: new mua mailto: URI handler

2012-04-14 Thread Jameson Graef Rollins
On Sun, Jan 29 2012, Jameson Graef Rollins jroll...@finestructure.net wrote:
 The new function 'notmuch-mua-mailto' provides an interactive handler
 for rfc6068 mailto:; URIs.  It attempts to implement the rfc6068
 specification: http://tools.ietf.org/html/rfc6068

I am using and finding this patch useful.  It has no conflict with
anything when not used.  Is there any other objection with pushing it?

jamie.


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


Re: [PATCH 2/2] emacs: new mua mailto: URI handler

2012-04-14 Thread Jani Nikula
Jameson Graef Rollins jroll...@finestructure.net writes:

 On Sun, Jan 29 2012, Jameson Graef Rollins jroll...@finestructure.net wrote:
 The new function 'notmuch-mua-mailto' provides an interactive handler
 for rfc6068 mailto:; URIs.  It attempts to implement the rfc6068
 specification: http://tools.ietf.org/html/rfc6068

 I am using and finding this patch useful.  It has no conflict with
 anything when not used.  Is there any other objection with pushing it?

I'm going through the review queue right now, tagging notmuch::stale any
patches that don't apply on master. I was just about to nmbug push stale
on this one (2/2). Is that in error? Care to verify?

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


Re: [PATCH 2/2] emacs: new mua mailto: URI handler

2012-04-14 Thread Jameson Graef Rollins
On Sat, Apr 14 2012, Jani Nikula j...@nikula.org wrote:
 I'm going through the review queue right now, tagging notmuch::stale any
 patches that don't apply on master. I was just about to nmbug push stale
 on this one (2/2). Is that in error? Care to verify?

Yes, it is an error.  This patch applies to master.  Did you in fact
verify that it doesn't?  You should not be tagging patches stale if they
in fact still apply to master.  If they still need review or something
else that's a different matter.  Please don't mark things as stale if
they are not.

Obviously I still care about this patch, or I wouldn't have re-commented
on it.

jamie.


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


Re: [PATCH 2/2] emacs: new mua mailto: URI handler

2012-04-14 Thread Jani Nikula
Jameson Graef Rollins jroll...@finestructure.net writes:

 On Sat, Apr 14 2012, Jani Nikula j...@nikula.org wrote:
 I'm going through the review queue right now, tagging notmuch::stale any
 patches that don't apply on master. I was just about to nmbug push stale
 on this one (2/2). Is that in error? Care to verify?

 Yes, it is an error.  This patch applies to master.  Did you in fact
 verify that it doesn't?  You should not be tagging patches stale if they
 in fact still apply to master.  If they still need review or something
 else that's a different matter.  Please don't mark things as stale if
 they are not.

My nmfirehose script flagged the patch as not applying, and I verified
this (and all of them) by hand, using the emacs interface to save the
patch. No, I'm not intentionally tagging patches stale if they apply,
but I'll stop for now in case there's a bug somewhere (incl. PEBKAC)
breaking the patches and thus making them not apply.

 Obviously I still care about this patch, or I wouldn't have re-commented
 on it.

I was doing this purely based on whether the patches apply or not.


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


Re: [PATCH 2/2] emacs: new mua mailto: URI handler

2012-04-14 Thread Jameson Graef Rollins
On Sat, Apr 14 2012, Jani Nikula j...@nikula.org wrote:
 I was doing this purely based on whether the patches apply or not.

I'm so sorry, Jani.  You are correct that this patch requires a small
rebase fix to apply to master.  I'm not sure how I missed it previously.

Updated version on the way.

jamie.


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


Re: [PATCH 2/2] emacs: new mua mailto: URI handler

2012-04-14 Thread Jani Nikula
Jameson Graef Rollins jroll...@finestructure.net writes:

 On Sat, Apr 14 2012, Jani Nikula j...@nikula.org wrote:
 I was doing this purely based on whether the patches apply or not.

 I'm so sorry, Jani.  You are correct that this patch requires a small
 rebase fix to apply to master.  I'm not sure how I missed it previously.

No problem. Thanks for checking again; I was worried we might have a bug
somewhere. :)

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


[PATCH 2/2] emacs: new mua mailto: URI handler

2012-01-30 Thread David Edmondson
On Sun, 29 Jan 2012 11:33:44 -0800, Jameson Graef Rollins  wrote:
> The new function 'notmuch-mua-mailto' provides an interactive handler
> for rfc6068 "mailto:; URIs.  It attempts to implement the rfc6068
> specification: http://tools.ietf.org/html/rfc6068

How is this expected to be used? I know generally about how mailto: URIs
are used, but not how they are currently plumbed in with an Emacs MUA.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: 



[PATCH 2/2] emacs: new mua mailto: URI handler

2012-01-30 Thread Jameson Graef Rollins
On Mon, 30 Jan 2012 15:43:10 +, David Edmondson  wrote:
> On Sun, 29 Jan 2012 11:33:44 -0800, Jameson Graef Rollins  finestructure.net> wrote:
> > The new function 'notmuch-mua-mailto' provides an interactive handler
> > for rfc6068 "mailto:; URIs.  It attempts to implement the rfc6068
> > specification: http://tools.ietf.org/html/rfc6068
> 
> How is this expected to be used? I know generally about how mailto: URIs
> are used, but not how they are currently plumbed in with an Emacs MUA.

I use a variant of the following as my browser mailto url handler:

  #!/bin/sh
  emacsclient --eval "(notmuch-mua-mailto \"$@\")"

jamie.
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: 



Re: [PATCH 2/2] emacs: new mua mailto: URI handler

2012-01-30 Thread Jameson Graef Rollins
On Mon, 30 Jan 2012 15:43:10 +, David Edmondson d...@dme.org wrote:
 On Sun, 29 Jan 2012 11:33:44 -0800, Jameson Graef Rollins 
 jroll...@finestructure.net wrote:
  The new function 'notmuch-mua-mailto' provides an interactive handler
  for rfc6068 mailto:; URIs.  It attempts to implement the rfc6068
  specification: http://tools.ietf.org/html/rfc6068
 
 How is this expected to be used? I know generally about how mailto: URIs
 are used, but not how they are currently plumbed in with an Emacs MUA.

I use a variant of the following as my browser mailto url handler:

  #!/bin/sh
  emacsclient --eval (notmuch-mua-mailto \$@\)

jamie.


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


[PATCH 2/2] emacs: new mua mailto: URI handler

2012-01-29 Thread Jameson Graef Rollins
The new function 'notmuch-mua-mailto' provides an interactive handler
for rfc6068 mailto:; URIs.  It attempts to implement the rfc6068
specification: http://tools.ietf.org/html/rfc6068

More decoding of the mailto string needs to be done, as is evident by
the fact that the mailto test remains broken.
---
Unfortunately I'm not sure how best to do the URI decoding, so I've
left a FIXME in the code, and the test as known_broken.  I'm hoping an
elisp/encodings expert out there will pick this up.

 emacs/notmuch-mua.el |   62 ++
 1 files changed, 62 insertions(+), 0 deletions(-)

diff --git a/emacs/notmuch-mua.el b/emacs/notmuch-mua.el
index 023645e..750e8d6 100644
--- a/emacs/notmuch-mua.el
+++ b/emacs/notmuch-mua.el
@@ -24,6 +24,10 @@
 (require 'notmuch-lib)
 (require 'notmuch-address)
 
+(require 'rfc2368)
+(require 'rfc2047)
+(require 'mailheader)
+
 ;;
 
 (defcustom notmuch-mua-send-hook '(notmuch-mua-message-send-hook)
@@ -131,6 +135,64 @@ list.
 
   (message-goto-to))
 
+(defun notmuch-mua-mailto (mailto)
+  Invoke the notmuch mail composition window for a `mailto:' URI.
+  ;; this should implement implement rfc6068: 
http://tools.ietf.org/html/rfc6068
+  ;; which obsoleted: http://tools.ietf.org/html/rfc2368
+  ;; this function is based on previous work: 
http://www.emacswiki.org/emacs/MailtoHandler
+  (interactive)
+  (when (and (stringp mailto)
+(string-match \\`mailto:; mailto))
+(let* (
+  ;; FIXME: need to decode all html encodings in uri.
+  (mailto (replace-regexp-in-string amp;  mailto))
+  (hdr-alist (rfc2368-parse-mailto-url mailto))
+  to subject other-headers body
+  (allowed-xtra-hdrs '(cc bcc in-reply-to)))
+
+  (with-temp-buffer
+   ;; extract body if it's defined
+   (when (assoc Body hdr-alist)
+ (dolist (hdr hdr-alist)
+   (when (equal Body (car hdr))
+ (insert (format %s\n (cdr hdr)
+ (rfc2047-decode-region (point-min) (point-max))
+ (setq body (buffer-substring-no-properties
+ (point-min) (point-max)))
+ (erase-buffer))
+
+   ;; extract headers
+   (dolist (hdr hdr-alist)
+ (unless (equal Body (car hdr))
+   (insert (format %s: %s\n (car hdr) (cdr hdr)
+   (rfc2047-decode-region (point-min) (point-max))
+   (goto-char (point-min))
+   (setq hdr-alist (mail-header-extract-no-properties)))
+
+  (setq to (cdr (assoc 'to hdr-alist)))
+  (setq subject (cdr (assoc 'subject hdr-alist)))
+
+  ;; extract allowed other headers, taking only first defined
+  ;; value
+  (dolist (hdr hdr-alist)
+   (if (and (member (car hdr) allowed-xtra-hdrs)
+(not (assoc (car hdr) other-headers)))
+   (add-to-list 'other-headers hdr)))
+
+  (notmuch-mua-mail to subject other-headers)
+
+  ;; insert the message body - but put it in front of the signature
+  ;; if one is present
+  (goto-char (point-max))
+  (if (re-search-backward message-signature-separator nil t)
+ (forward-line -1)
+   (goto-char (point-max)))
+  (insert body)
+  (push-mark))
+(set-buffer-modified-p nil)
+
+(message-goto-body)))
+
 (defun notmuch-mua-mail (optional to subject other-headers rest other-args)
   Invoke the notmuch mail composition window.
 
-- 
1.7.8.3

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