From: teranisi Date: Sat, 9 Nov 2002 08:49:26 +0000 (+0000) Subject: * wl-vars.el (wl-draft-write-file-function): Fix. X-Git-Tag: wl-2_11_1~54 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d6cb38e87c7636fb0036b94ff4252ed3dee49f1;p=elisp%2Fwanderlust.git * 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. --- diff --git a/wl/ChangeLog b/wl/ChangeLog index 2d1ada3..decbcfc 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,5 +1,13 @@ 2002-11-09 Yuuichi Teranishi + * 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 diff --git a/wl/wl-draft.el b/wl/wl-draft.el index b80d533..ea773a2 100644 --- a/wl/wl-draft.el +++ b/wl/wl-draft.el @@ -618,9 +618,12 @@ Reply to author if WITH-ARG is non-nil." 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) @@ -1876,10 +1879,15 @@ If KILL-WHEN-DONE is non-nil, current draft buffer is killed" (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)) @@ -1913,10 +1921,7 @@ If KILL-WHEN-DONE is non-nil, current draft buffer is killed" (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)))) @@ -1936,6 +1941,7 @@ If KILL-WHEN-DONE is non-nil, current draft buffer is killed" (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))) diff --git a/wl/wl-vars.el b/wl/wl-vars.el index 99a25e6..6500446 100644 --- a/wl/wl-vars.el +++ b/wl/wl-vars.el @@ -379,7 +379,7 @@ If file exists and `wl-auto-insert-x-face' is non-nil." :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) @@ -643,8 +643,9 @@ reasons of system internal to accord facilities for the Emacs variants.") "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