emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

url-mailto insert 'body' in the wrong place


From: Leo
Subject: url-mailto insert 'body' in the wrong place
Date: Mon, 28 May 2007 19:27:19 +0100
User-agent: No Gnus v0.7, Emacs/23.0.0.2 (2007-05-26), Fedora 6.93 gnu/linux

Dear all,

To see the issue:

  (url-mailto (url-generic-parse-url "mailto:address@hidden 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))))
+
 ;;;###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))
Thanks,
-- 
Leo <sdl.web AT gmail.com>                         (GPG Key: 9283AA3F)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]