-;;; wl-draft.el -- Message draft mode for Wanderlust.
+;;; wl-draft.el --- Message draft mode for Wanderlust.
;; Copyright (C) 1998,1999,2000 Yuuichi Teranishi <teranisi@gohome.org>
;; Copyright (C) 1998,1999,2000 Masahiro MURATA <muse@ba2.so-net.ne.jp>
(defvar wl-draft-parent-folder nil)
(defvar wl-draft-config-sub-func-alist
- '((body . wl-draft-config-sub-body)
- (top . wl-draft-config-sub-top)
- (bottom . wl-draft-config-sub-bottom)
- (header . wl-draft-config-sub-header)
- (header-top . wl-draft-config-sub-header-top)
- (header-bottom . wl-draft-config-sub-header)
- (body-file . wl-draft-config-sub-body-file)
- (top-file . wl-draft-config-sub-top-file)
- (bottom-file . wl-draft-config-sub-bottom-file)
- (header-file . wl-draft-config-sub-header-file)
- (template . wl-draft-config-sub-template)
- (x-face . wl-draft-config-sub-x-face)))
+ '((body . wl-draft-config-sub-body)
+ (top . wl-draft-config-sub-top)
+ (bottom . wl-draft-config-sub-bottom)
+ (header . wl-draft-config-sub-header)
+ (header-top . wl-draft-config-sub-header-top)
+ (header-bottom . wl-draft-config-sub-header)
+ (part-top . wl-draft-config-sub-part-top)
+ (part-bottom . wl-draft-config-sub-part-bottom)
+ (body-file . wl-draft-config-sub-body-file)
+ (top-file . wl-draft-config-sub-top-file)
+ (bottom-file . wl-draft-config-sub-bottom-file)
+ (header-file . wl-draft-config-sub-header-file)
+ (template . wl-draft-config-sub-template)
+ (x-face . wl-draft-config-sub-x-face)))
(make-variable-buffer-local 'wl-draft-buffer-file-name)
(make-variable-buffer-local 'wl-draft-buffer-cur-summary-buffer)
(run-hooks 'wl-reply-hook))
(defun wl-draft-add-references ()
+ (wl-draft-add-in-reply-to "References"))
+
+(defun wl-draft-add-in-reply-to (&optional alt-field)
(let* ((mes-id (save-excursion
(set-buffer mail-reply-buffer)
(std11-field-body "message-id")))
- (ref (std11-field-body "References"))
+ (field (or alt-field "In-Reply-To"))
+ (ref (std11-field-body field))
(ref-list nil) (st nil))
(when (and mes-id ref)
(while (string-match "<[^>]+>" ref st)
(setq mes-id nil)))
(when mes-id
(save-excursion
- (when (mail-position-on-field "References")
+ (when (mail-position-on-field field)
(forward-line)
(while (looking-at "^[ \t]")
(forward-line))
(mail-yank-hooks (run-hooks 'mail-yank-hooks))
(wl-draft-cite-function (funcall wl-draft-cite-function))) ; default cite
(run-hooks 'wl-draft-cited-hook)
- (when (and wl-draft-add-references
- (wl-draft-add-references))
+ (when (if wl-draft-add-references
+ (wl-draft-add-references)
+ (if wl-draft-add-in-reply-to
+ (wl-draft-add-in-reply-to)))
(wl-highlight-headers 'for-draft)) ; highlight when added References:
(when wl-highlight-body-too
(wl-highlight-body-region beg (point-max)))))
(let (original-buffer
mail-reply-buffer
mail-citation-hook mail-yank-hooks
- wl-draft-add-references wl-draft-cite-function)
+ wl-draft-add-references wl-draft-add-in-reply-to
+ wl-draft-cite-function)
(with-current-buffer wl-draft-buffer-cur-summary-buffer
(with-current-buffer wl-message-buffer
(setq original-buffer (wl-message-get-original-buffer))
(defun wl-draft-write-sendlog (status proto server to id)
"Write send log file, if `wl-draft-sendlog' is non-nil."
(when wl-draft-sendlog
- (save-excursion
- (let* ((tmp-buf (get-buffer-create " *wl-draft-sendlog*"))
- (filename (expand-file-name wl-draft-sendlog-filename
+ (with-temp-buffer
+ (let* ((filename (expand-file-name wl-draft-sendlog-filename
elmo-msgdb-dir))
(filesize (nth 7 (file-attributes filename)))
(server (if server (concat " server=" server) ""))
""))
(id (if id (concat " id=" id) ""))
(time (wl-sendlog-time)))
- (set-buffer tmp-buf)
- (erase-buffer)
(insert (format "%s proto=%s stat=%s%s%s%s\n"
time proto status server to id))
(if (and wl-draft-sendlog-max-size filesize
(> filesize wl-draft-sendlog-max-size))
(rename-file filename (concat filename ".old") t))
(if (file-writable-p filename)
- (write-region (point-min) (point-max)
- filename t 'no-msg)
- (message (format "%s is not writable." filename)))
- (kill-buffer tmp-buf)))))
+ (write-region-as-binary (point-min) (point-max)
+ filename t 'no-msg)
+ (message (format "%s is not writable." filename)))))))
(defun wl-draft-get-header-delimiter (&optional delete)
;; If DELETE is non-nil, replace the header delimiter with a blank line
"Get address list suitable for smtp RCPT TO:<address>.
Group list content is removed if `wl-draft-remove-group-list-contents' is
non-nil."
- (let ((fields '("to" "cc" "bcc"))
+ (let ((fields '("to" "cc" "bcc"))
(resent-fields '("resent-to" "resent-cc" "resent-bcc"))
(case-fold-search t)
addrs recipients)
body edit-again summary-buf from parent-folder)
"Write and send mail/news message with Wanderlust."
(interactive)
- (unless (featurep 'wl)
- (require 'wl))
+ (require 'wl)
(unless wl-init
(wl-load-profile)
(wl-folder-init)
(wl-draft-body-goto-bottom)
(if content (insert (eval content))))
+(defun wl-draft-config-sub-header (content)
+ (wl-draft-config-body-goto-header)
+ (if content (insert (concat (eval content) "\n"))))
+
(defun wl-draft-config-sub-header-top (content)
(goto-char (point-min))
(if content (insert (concat (eval content) "\n"))))
-(defun wl-draft-config-sub-header (content)
- (wl-draft-config-body-goto-header)
+(defun wl-draft-config-sub-part-top (content)
+ (goto-char (mime-edit-content-beginning))
+ (if content (insert (concat (eval content) "\n"))))
+
+(defun wl-draft-config-sub-part-bottom (content)
+ (goto-char (mime-edit-content-end))
(if content (insert (concat (eval content) "\n"))))
(defsubst wl-draft-config-sub-file (content)