(wl-user-agent-insert-body): Make sure body ends with newline.
authoryamaoka <yamaoka>
Wed, 17 Mar 2010 00:26:35 +0000 (00:26 +0000)
committeryamaoka <yamaoka>
Wed, 17 Mar 2010 00:26:35 +0000 (00:26 +0000)
(wl-user-agent-compose, wl-user-agent-compose-internal): Fix regexps so as to
 match header tokens strictly.

wl/ChangeLog
wl/wl-draft.el

index 23a38c1..d3ad732 100644 (file)
@@ -1,3 +1,10 @@
+2010-03-17  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * wl-draft.el (wl-user-agent-insert-body): Make sure body ends with
+       newline.
+       (wl-user-agent-compose, wl-user-agent-compose-internal): Fix regexps
+       so as to match header tokens strictly.
+
 2010-02-16  Tetsurou Okazaki  <okazaki@be.to>
 
        * wl-spam.el (wl-summary-test-spam): Call `wl-summary-unmark-spam'
 2010-02-16  Tetsurou Okazaki  <okazaki@be.to>
 
        * wl-spam.el (wl-summary-test-spam): Call `wl-summary-unmark-spam'
index afda8ff..0e64e1b 100644 (file)
@@ -2527,7 +2527,8 @@ Automatically applied in draft sending time."
   (goto-char (point-min))
   (search-forward mail-header-separator)
   (forward-line 1)
   (goto-char (point-min))
   (search-forward mail-header-separator)
   (forward-line 1)
-  (insert body-text))
+  (insert body-text)
+  (or (bolp) (insert "\n")))
 
 ;;;###autoload
 (defun wl-user-agent-compose (&optional to subject other-headers continue
 
 ;;;###autoload
 (defun wl-user-agent-compose (&optional to subject other-headers continue
@@ -2546,26 +2547,23 @@ been implemented yet.  Partial support for SWITCH-FUNCTION now supported."
   ;; to be necessary to protect the values used w/in
   (let ((wl-user-agent-headers-and-body-alist other-headers)
        (wl-draft-use-frame (eq switch-function 'switch-to-buffer-other-frame))
   ;; to be necessary to protect the values used w/in
   (let ((wl-user-agent-headers-and-body-alist other-headers)
        (wl-draft-use-frame (eq switch-function 'switch-to-buffer-other-frame))
-       (wl-draft-buffer-style switch-function))
+       (wl-draft-buffer-style switch-function)
+       tem)
     (if to
     (if to
-       (if (wl-string-match-assoc "to" wl-user-agent-headers-and-body-alist
-                                  'ignore-case)
-           (setcdr
-            (wl-string-match-assoc "to" wl-user-agent-headers-and-body-alist
-                                   'ignore-case)
-            to)
+       (if (setq tem (wl-string-match-assoc
+                      "\\`to\\'"
+                      wl-user-agent-headers-and-body-alist
+                      'ignore-case))
+           (setcdr tem to)
          (setq wl-user-agent-headers-and-body-alist
                (cons (cons "to" to)
                      wl-user-agent-headers-and-body-alist))))
     (if subject
          (setq wl-user-agent-headers-and-body-alist
                (cons (cons "to" to)
                      wl-user-agent-headers-and-body-alist))))
     (if subject
-       (if (wl-string-match-assoc "subject"
-                                  wl-user-agent-headers-and-body-alist
-                                  'ignore-case)
-           (setcdr
-            (wl-string-match-assoc "subject"
-                                   wl-user-agent-headers-and-body-alist
-                                   'ignore-case)
-            subject)
+       (if (setq tem (wl-string-match-assoc
+                      "\\`subject\\'"
+                      wl-user-agent-headers-and-body-alist
+                      'ignore-case))
+           (setcdr tem subject)
          (setq wl-user-agent-headers-and-body-alist
                (cons (cons "subject" subject)
                      wl-user-agent-headers-and-body-alist))))
          (setq wl-user-agent-headers-and-body-alist
                (cons (cons "subject" subject)
                      wl-user-agent-headers-and-body-alist))))
@@ -2597,12 +2595,11 @@ been implemented yet.  Partial support for SWITCH-FUNCTION now supported."
        ;; highlight headers (from wl-draft in wl-draft.el)
        (wl-highlight-headers 'for-draft)
        ;; insert body
        ;; highlight headers (from wl-draft in wl-draft.el)
        (wl-highlight-headers 'for-draft)
        ;; insert body
-       (if (wl-string-match-assoc "body" wl-user-agent-headers-and-body-alist
-                                  'ignore-case)
-           (wl-user-agent-insert-body
-            (cdr (wl-string-match-assoc
-                  "body"
-                  wl-user-agent-headers-and-body-alist 'ignore-case)))))
+       (let ((body (wl-string-match-assoc "\\`body\\'"
+                                          wl-user-agent-headers-and-body-alist
+                                          'ignore-case)))
+         (if body
+             (wl-user-agent-insert-body (cdr body)))))
     t))
 
 (defun wl-draft-setup-parent-flag (flag)
     t))
 
 (defun wl-draft-setup-parent-flag (flag)