X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=wl%2Fwl-draft.el;h=bcb09bdfa5e6f80b2bf36af44c8fbb39dd63a25c;hb=000345eadd81debeb1527fb65e46109c96fc35e0;hp=4f000cbb821061abf9e070090e20dae9f9e26bd6;hpb=3ecffb2025a98cd1fcf529e9495d6d657531c5a3;p=elisp%2Fwanderlust.git diff --git a/wl/wl-draft.el b/wl/wl-draft.el index 4f000cb..bcb09bd 100644 --- a/wl/wl-draft.el +++ b/wl/wl-draft.el @@ -81,11 +81,11 @@ This variable is local in each draft buffer. You can refer its value in `wl-draft-config-alist'. e.g. -(setq wl-draft-config-alist +\(setq wl-draft-config-alist '(((string-match \".*@domain1$\" wl-draft-parent-folder) - (\"From\" . \"user@domain1\")) - ((string-match \".*@domain2$\" wl-draft-parent-folder) - (\"From\" . \"user@domain2\"))))") + (\"From\" . \"user@domain1\")) + ((string-match \".*@domain2$\" wl-draft-parent-folder) + (\"From\" . \"user@domain2\"))))") (defvar wl-draft-config-sub-func-alist '((body . wl-draft-config-sub-body) @@ -295,6 +295,9 @@ e.g. references (wl-delete-duplicates references) references (when references (mapconcat 'identity references "\n\t")))) + (and wl-draft-use-frame + (get-buffer-window summary-buf) + (select-window (get-buffer-window summary-buf))) (wl-draft (list (cons 'To "") (cons 'Subject (concat wl-forward-subject-prefix original-subject)) @@ -310,10 +313,14 @@ e.g. (substring subject (match-end 0)) subject)) +(defun wl-draft-self-reply-p () + "Return t when From address in the current message is user's self one or not." + (wl-address-user-mail-address-p (or (elmo-field-body "From") ""))) + (defun wl-draft-reply-list-symbol (with-arg) "Return symbol `wl-draft-reply-*-argument-list' match condition. Check WITH-ARG and From: field." - (if (wl-address-user-mail-address-p (or (elmo-field-body "From") "")) + (if (wl-draft-self-reply-p) (if with-arg 'wl-draft-reply-myself-with-argument-list 'wl-draft-reply-myself-without-argument-list) @@ -328,9 +335,10 @@ Reply to author if WITH-ARG is non-nil." (let (r-list to mail-followup-to cc subject in-reply-to references newsgroups to-alist cc-alist decoder parent-folder) - (set-buffer summary-buf) - (setq parent-folder (wl-summary-buffer-folder-name)) - (set-buffer buf) + (when (buffer-live-p summary-buf) + (with-current-buffer summary-buf + (setq parent-folder (wl-summary-buffer-folder-name)))) + (set-buffer (or buf mime-mother-buffer)) (setq r-list (symbol-value (wl-draft-reply-list-symbol with-arg))) (catch 'done (while r-list @@ -460,6 +468,9 @@ Reply to author if WITH-ARG is non-nil." references (wl-delete-duplicates references) references (if references (mapconcat 'identity references "\n\t"))) + (and wl-draft-use-frame + (get-buffer-window summary-buf) + (select-window (get-buffer-window summary-buf))) (wl-draft (list (cons 'To to) (cons 'Cc cc) (cons 'Newsgroups newsgroups) @@ -1077,7 +1088,7 @@ non-nil." (wl-draft-write-sendlog 'failed 'smtp smtp-server recipients id) (if (and (eq (car err) 'smtp-response-error) - (/= (nth 1 err) 334)) + (= (nth 1 err) 535)) (elmo-remove-passwd (wl-smtp-password-key smtp-sasl-user-name @@ -1863,9 +1874,23 @@ If KILL-WHEN-DONE is non-nil, current draft buffer is killed" (switch-to-buffer buffer)) (set-buffer buffer) (insert-file-contents-as-binary file-name) + (elmo-delete-cr-buffer) (let((mime-edit-again-ignored-field-regexp "^\\(Content-.*\\|Mime-Version\\):")) - (wl-draft-decode-message-in-buffer)) +; (wl-draft-decode-message-in-buffer)) + ;;;; From gnus-article-mime-edit-article-setup in T-gnus + ;;;; XXX: it is semi issue, perhaps [wl:10790] + (let ((ofn (symbol-function 'mime-edit-decode-single-part-in-buffer))) + (fset 'mime-edit-decode-single-part-in-buffer + (lambda (&rest args) + (unless (let ((content-type (car args))) + (eq 'text (mime-content-type-primary-type + content-type))) + (setcar (cdr args) 'not-decode-text)) + (apply ofn args))) + (unwind-protect + (wl-draft-decode-message-in-buffer) + (fset 'mime-edit-decode-single-part-in-buffer ofn)))) (wl-draft-insert-mail-header-separator) (if (not (string-match (regexp-quote wl-draft-folder) (buffer-name))) @@ -1906,34 +1931,41 @@ If KILL-WHEN-DONE is non-nil, current draft buffer is killed" (beginning-of-line) (goto-char (point-max)))))) +(defsubst wl-draft-config-sub-eval-insert (content &optional newline) + (let (content-value) + (when (and content + (stringp (setq content-value (eval content)))) + (insert content-value) + (if newline (insert "\n"))))) + (defun wl-draft-config-sub-body (content) (wl-draft-body-goto-top) (delete-region (point) (point-max)) - (if content (insert (eval content)))) + (wl-draft-config-sub-eval-insert content)) (defun wl-draft-config-sub-top (content) (wl-draft-body-goto-top) - (if content (insert (eval content)))) + (wl-draft-config-sub-eval-insert content)) (defun wl-draft-config-sub-bottom (content) (wl-draft-body-goto-bottom) - (if content (insert (eval content)))) + (wl-draft-config-sub-eval-insert content)) (defun wl-draft-config-sub-header (content) (wl-draft-config-body-goto-header) - (if content (insert (concat (eval content) "\n")))) + (wl-draft-config-sub-eval-insert content 'newline)) (defun wl-draft-config-sub-header-top (content) (goto-char (point-min)) - (if content (insert (concat (eval content) "\n")))) + (wl-draft-config-sub-eval-insert content 'newline)) (defun wl-draft-config-sub-part-top (content) (goto-char (mime-edit-content-beginning)) - (if content (insert (concat (eval content) "\n")))) + (wl-draft-config-sub-eval-insert content 'newline)) (defun wl-draft-config-sub-part-bottom (content) (goto-char (mime-edit-content-end)) - (if content (insert (concat (eval content) "\n")))) + (wl-draft-config-sub-eval-insert content 'newline)) (defsubst wl-draft-config-sub-file (content) (let ((coding-system-for-read wl-cs-autoconv) @@ -2291,11 +2323,13 @@ Automatically applied in draft sending time." (defun wl-draft-highlight-and-recenter (&optional n) (interactive "P") - (if wl-highlight-body-too - (let ((beg (point-min)) - (end (point-max))) - (put-text-property beg end 'face nil) - (wl-highlight-message beg end t))) + (when wl-highlight-body-too + (let ((modified (buffer-modified-p))) + (unwind-protect + (progn + (put-text-property (point-min) (point-max) 'face nil) + (wl-highlight-message (point-min) (point-max) t)) + (set-buffer-modified-p modified)))) (recenter n)) ;;;; user-agent support by Sen Nagata