2002-11-09 Yuuichi Teranishi <teranisi@gohome.org>
+ * wl-vars.el (wl-draft-write-file-function): Fix.
+ (wl-draft-reedit-hook): Changed default value.
+
+ * wl-draft.el (wl-draft-edit-string): Set cursor point for
+ wl-draft-reedit-hook.
+ (wl-draft-remove-text-plain-tag): New function.
+ (wl-draft-reedit): Set cursor point for wl-draft-reedit-hook.
+
* wl-vars.el (wl-draft-write-file-function): New user option.
* wl-draft.el (wl-draft-prepare-edit): Use it for
content-type content-transfer-encoding
(buffer-substring (point) (point-max))
'edit-again))
- (and to (mail-position-on-field "To"))
- (kill-buffer tmp-buf)))
- (run-hooks 'wl-draft-reedit-hook))
+ (kill-buffer tmp-buf))
+ ;; Set cursor point to the top.
+ (goto-char (point-min))
+ (search-forward (concat mail-header-separator "\n") nil t)
+ (run-hooks 'wl-draft-reedit-hook)
+ (and to (mail-position-on-field "To"))))
(defun wl-draft-insert-current-message (dummy)
(interactive)
(setq local-variables (cdr local-variables)))
(current-buffer))))
+(defun wl-draft-remove-text-plain-tag ()
+ "Remove text/plain tag of mime-edit."
+ (if (looking-at "^--\\[\\[text/plain\\]\\]$")
+ (delete-region (point-at-bol)(1+ (point-at-eol)))))
+
(defun wl-draft-reedit (number)
(let ((draft-folder (wl-folder-get-elmo-folder wl-draft-folder))
(wl-draft-reedit t)
- buffer file-name change-major-mode-hook)
+ buffer file-name change-major-mode-hook body-top)
(setq file-name (elmo-message-file-name draft-folder number))
(unless (file-exists-p file-name)
(error "File %s does not exist" file-name))
(let((mime-edit-again-ignored-field-regexp
"^\\(Content-.*\\|Mime-Version\\):"))
(wl-draft-decode-message-in-buffer))
- (goto-char (wl-draft-insert-mail-header-separator))
- ;; If the first part is text/plain, the mime-edit tag is useless.
- (if (looking-at "^--\\[\\[text/plain\\]\\]$")
- (delete-region (point-at-bol)(1+ (point-at-eol))))
+ (setq body-top (wl-draft-insert-mail-header-separator))
(if (not (string-match (regexp-quote wl-draft-folder)
(buffer-name)))
(rename-buffer (concat wl-draft-folder "/" (buffer-name))))
(when wl-draft-write-file-function
(add-hook 'local-write-file-hooks wl-draft-write-file-function))
(wl-highlight-headers 'for-draft)
+ (goto-char body-top)
(run-hooks 'wl-draft-reedit-hook)
(goto-char (point-max))
buffer)))
:type 'file
:group 'wl-draft)
-(defvar wl-draft-write-file-function 'wl-draft-save
+(defcustom wl-draft-write-file-function 'wl-draft-save
"Save function for draft message."
:type 'function
:group 'wl-draft)
"A hook called when replied.")
(defvar wl-mail-setup-hook nil
"A hook called when Draft is prepared.")
-(defvar wl-draft-reedit-hook nil
- "A hook called when Draft is re-edited.")
+(defvar wl-draft-reedit-hook '(wl-draft-remove-text-plain-tag)
+ "A hook called when Draft is re-edited.
+The cursor point is located at top of the body.")
(defvar wl-draft-send-hook '(wl-draft-config-exec)
"A hook called on the draft editing buffer before sending process starts.")
(defvar wl-mail-send-pre-hook nil