all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* url-mailto insert 'body' in the wrong place
@ 2007-05-28 18:27 Leo
  2007-05-28 18:32 ` David Kastrup
  0 siblings, 1 reply; 7+ messages in thread
From: Leo @ 2007-05-28 18:27 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 305 bytes --]

Dear all,

To see the issue:

  (url-mailto (url-generic-parse-url "mailto:nobd1@unl.edu?body=I should be inserted before the signature"))

If the mail buffer has a signature part, the 'body' text will be added
after the signature, which is clearly wrong.

I wonder if the following small patch is good:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: url-mailto.diff --]
[-- Type: text/x-patch, Size: 855 bytes --]

Index: url-mailto.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/url/url-mailto.el,v
retrieving revision 1.4.2.9
diff -u -r1.4.2.9 url-mailto.el
--- url-mailto.el	26 Jan 2007 06:15:30 -0000	1.4.2.9
+++ url-mailto.el	28 May 2007 18:13:20 -0000
@@ -60,6 +60,11 @@
 	(save-excursion
 	  (insert "\n"))))))
 
+(defun url-mail-goto-body ()
+  (goto-char (point-min))
+  (or (search-forward (concat "\n" mail-header-separator "\n") nil t)
+      (goto-char (point-max))))
+
 ;;;###autoload
 (defun url-mailto (url)
   "Handle the mailto: URL syntax."
@@ -100,7 +105,7 @@
     (while args
       (if (string= (caar args) "body")
 	  (progn
-	    (goto-char (point-max))
+	    (url-mail-goto-body)
 	    (insert (mapconcat 
 		     #'(lambda (string)
 			 (replace-regexp-in-string "\r\n" "\n" string))

[-- Attachment #3: Type: text/plain, Size: 84 bytes --]


Thanks,
-- 
Leo <sdl.web AT gmail.com>                         (GPG Key: 9283AA3F)

[-- Attachment #4: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: url-mailto insert 'body' in the wrong place
  2007-05-28 18:27 url-mailto insert 'body' in the wrong place Leo
@ 2007-05-28 18:32 ` David Kastrup
  2007-05-28 18:44   ` Leo
  0 siblings, 1 reply; 7+ messages in thread
From: David Kastrup @ 2007-05-28 18:32 UTC (permalink / raw)
  To: Leo; +Cc: emacs-devel

Leo <sdl.web@gmail.com> writes:

> Dear all,
>
> To see the issue:
>
>   (url-mailto (url-generic-parse-url "mailto:nobd1@unl.edu?body=I should be inserted before the signature"))
>
> If the mail buffer has a signature part, the 'body' text will be added
> after the signature, which is clearly wrong.
>
> I wonder if the following small patch is good:
>
> Index: url-mailto.el
> ===================================================================
> RCS file: /cvsroot/emacs/emacs/lisp/url/url-mailto.el,v
> retrieving revision 1.4.2.9
> diff -u -r1.4.2.9 url-mailto.el
> --- url-mailto.el	26 Jan 2007 06:15:30 -0000	1.4.2.9
> +++ url-mailto.el	28 May 2007 18:13:20 -0000
> @@ -60,6 +60,11 @@
>  	(save-excursion
>  	  (insert "\n"))))))
>  
> +(defun url-mail-goto-body ()
> +  (goto-char (point-min))
> +  (or (search-forward (concat "\n" mail-header-separator "\n") nil t)
> +      (goto-char (point-max))))
> +

Can't you use message-goto-body here?

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: url-mailto insert 'body' in the wrong place
  2007-05-28 18:32 ` David Kastrup
@ 2007-05-28 18:44   ` Leo
  2007-05-29  4:11     ` Richard Stallman
  0 siblings, 1 reply; 7+ messages in thread
From: Leo @ 2007-05-28 18:44 UTC (permalink / raw)
  To: emacs-devel

----- David Kastrup (2007-05-28) wrote:-----

>> I wonder if the following small patch is good:
>>
>> Index: url-mailto.el
>> ===================================================================
>> RCS file: /cvsroot/emacs/emacs/lisp/url/url-mailto.el,v
>> retrieving revision 1.4.2.9
>> diff -u -r1.4.2.9 url-mailto.el
>> --- url-mailto.el	26 Jan 2007 06:15:30 -0000	1.4.2.9
>> +++ url-mailto.el	28 May 2007 18:13:20 -0000
>> @@ -60,6 +60,11 @@
>>  	(save-excursion
>>  	  (insert "\n"))))))
>>  
>> +(defun url-mail-goto-body ()
>> +  (goto-char (point-min))
>> +  (or (search-forward (concat "\n" mail-header-separator "\n") nil t)
>> +      (goto-char (point-max))))
>> +
>
> Can't you use message-goto-body here?

But that means you have to load the message package, no?

Anyway, I don't mind I just want this fixed ;)

-- 
Leo <sdl.web AT gmail.com>                         (GPG Key: 9283AA3F)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: url-mailto insert 'body' in the wrong place
  2007-05-28 18:44   ` Leo
@ 2007-05-29  4:11     ` Richard Stallman
  2007-05-29 15:31       ` Chong Yidong
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Stallman @ 2007-05-29  4:11 UTC (permalink / raw)
  To: Leo; +Cc: emacs-devel

    > Can't you use message-goto-body here?

    But that means you have to load the message package, no?

That is a good point.  We certainly do not want to load message here.

There's no great benefit in using a subroutine
when the job is so simple.

Would someone please install your fix in Emacs 22?

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: url-mailto insert 'body' in the wrong place
  2007-05-29  4:11     ` Richard Stallman
@ 2007-05-29 15:31       ` Chong Yidong
  2007-05-29 16:16         ` Leo
  0 siblings, 1 reply; 7+ messages in thread
From: Chong Yidong @ 2007-05-29 15:31 UTC (permalink / raw)
  To: rms; +Cc: Leo, emacs-devel

Richard Stallman <rms@gnu.org> writes:

>     > Can't you use message-goto-body here?
>
>     But that means you have to load the message package, no?
>
> That is a good point.  We certainly do not want to load message here.
>
> There's no great benefit in using a subroutine
> when the job is so simple.
>
> Would someone please install your fix in Emacs 22?

Done.  (I put the new code in the body of url-mailto instead of a
subroutine, since it is so short.)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: url-mailto insert 'body' in the wrong place
  2007-05-29 15:31       ` Chong Yidong
@ 2007-05-29 16:16         ` Leo
  2007-05-29 16:24           ` Chong Yidong
  0 siblings, 1 reply; 7+ messages in thread
From: Leo @ 2007-05-29 16:16 UTC (permalink / raw)
  To: Chong Yidong; +Cc: emacs-devel

Dear Chong,

----- Chong Yidong (2007-05-29) wrote:-----

> Richard Stallman <rms@gnu.org> writes:
>
>>     > Can't you use message-goto-body here?
>>
>>     But that means you have to load the message package, no?
>>
>> That is a good point.  We certainly do not want to load message here.
>>
>> There's no great benefit in using a subroutine
>> when the job is so simple.
>>
>> Would someone please install your fix in Emacs 22?
>
> Done.  (I put the new code in the body of url-mailto instead of a
> subroutine, since it is so short.)

Thanks. There is a typo in ChangeLog:

,----
| so that is is
|         ^ it
`----

regards,
-- 
Leo <sdl.web AT gmail.com>                         (GPG Key: 9283AA3F)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: url-mailto insert 'body' in the wrong place
  2007-05-29 16:16         ` Leo
@ 2007-05-29 16:24           ` Chong Yidong
  0 siblings, 0 replies; 7+ messages in thread
From: Chong Yidong @ 2007-05-29 16:24 UTC (permalink / raw)
  To: Leo; +Cc: emacs-devel

Leo <sdl.web@gmail.com> writes:

>> Done.  (I put the new code in the body of url-mailto instead of a
>> subroutine, since it is so short.)
>
> Thanks. There is a typo in ChangeLog:

Fixed, thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-05-29 16:24 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-28 18:27 url-mailto insert 'body' in the wrong place Leo
2007-05-28 18:32 ` David Kastrup
2007-05-28 18:44   ` Leo
2007-05-29  4:11     ` Richard Stallman
2007-05-29 15:31       ` Chong Yidong
2007-05-29 16:16         ` Leo
2007-05-29 16:24           ` Chong Yidong

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.