* wl-address.el (wl-address-make-alist-from-alias-file): Use
[elisp/wanderlust.git] / wl / wl-draft.el
index 4a98bcb..28b73b2 100644 (file)
@@ -865,7 +865,7 @@ text was killed."
                          (concat " to="
                                  (mapconcat
                                   'identity
-                                  (mapcar (lambda(x) (format "<%s>" x)) to)
+                                  (mapcar (lambda (x) (format "<%s>" x)) to)
                                   ","))))
                   ""))
             (id (if id (concat " id=" id) ""))
@@ -1167,7 +1167,7 @@ If FORCE-MSGID, insert message-id regardless of `wl-insert-message-id'."
            nil t)
       (when (string= "" (match-string 1))
        (replace-match ""))))
-;;;  (run-hooks 'wl-mail-send-pre-hook) ;; X-PGP-Sig, Cancel-Lock
+;;;  (run-hooks 'wl-mail-send-pre-hook) ; X-PGP-Sig, Cancel-Lock
   (wl-draft-dispatch-message)
   (when kill-when-done
     ;; hide editing-buffer.
@@ -1279,7 +1279,8 @@ This variable is valid when `wl-interactive-send' has non-nil value."
       (condition-case nil
          (progn
            (when wl-draft-send-confirm-with-preview
-             (let (wl-draft-send-hook)
+             (let (wl-draft-send-hook
+                   (pgg-decrypt-automatically nil))
                (wl-draft-preview-message)))
            (save-excursion
              (goto-char (point-min)) ; to show recipients in header
@@ -1300,9 +1301,9 @@ This variable is valid when `wl-interactive-send' has non-nil value."
   "Send current draft message.
 If KILL-WHEN-DONE is non-nil, current draft buffer is killed"
   (interactive)
-  ;; Don't call this explicitly.
-  ;; Added to 'wl-draft-send-hook (by teranisi)
-  ;; (wl-draft-config-exec)
+;;; Don't call this explicitly.
+;;; Added to 'wl-draft-send-hook (by teranisi)
+;;;  (wl-draft-config-exec)
   (run-hooks 'wl-draft-send-hook)
   (when (or (not wl-interactive-send)
            (wl-draft-send-confirm))
@@ -1877,7 +1878,7 @@ If KILL-WHEN-DONE is non-nil, current draft buffer is killed"
        (goto-char delimline)
       (goto-char (point-min))
       (if (search-forward "\n\n" nil t)
-         (delete-backward-char 1)
+         (delete-char -1)
        (goto-char (point-max))))
     (wl-draft-check-new-line)
     (put-text-property (point)
@@ -2438,8 +2439,8 @@ Automatically applied in draft sending time."
                  ((looking-at wl-folder-complete-header-regexp)
                   (and (boundp 'wl-read-folder-history)
                        (setq history wl-read-folder-history)))
-                 ;; ((looking-at wl-address-complete-header-regexp)
-                 ;;  (setq history .....))
+;;;              ((looking-at wl-address-complete-header-regexp)
+;;;               (setq history .....))
                  (t
                   nil)))
               (eolp))
@@ -2526,7 +2527,8 @@ Automatically applied in draft sending time."
   (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
@@ -2545,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))
-       (wl-draft-buffer-style switch-function))
+       (wl-draft-buffer-style switch-function)
+       tem)
     (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
-       (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))))
@@ -2596,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
-       (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)