From: teranisi Date: Thu, 24 Jan 2002 06:11:55 +0000 (+0000) Subject: * wl-draft.el (wl-draft-reedit): Rewrite. X-Git-Tag: wl-2_9_7~40 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=84515394b647606ed4113c23b01e7255480fda0a;p=elisp%2Fwanderlust.git * wl-draft.el (wl-draft-reedit): Rewrite. (wl-jump-to-draft-buffer): Don't use `buffer-file-name'. * wl-summary.el (wl-summary-reedit): Revert last change. --- diff --git a/wl/ChangeLog b/wl/ChangeLog index ea6f99f..0ae0e31 100644 --- a/wl/ChangeLog +++ b/wl/ChangeLog @@ -1,5 +1,10 @@ 2002-01-24 Yuuichi Teranishi + * wl-draft.el (wl-draft-reedit): Rewrite. + (wl-jump-to-draft-buffer): Don't use `buffer-file-name'. + + * wl-summary.el (wl-summary-reedit): Revert last change. + * wl-draft.el (wl-draft-save): Rewrite. (wl-draft-create-buffer): Set buffer-file-name as nil. diff --git a/wl/wl-draft.el b/wl/wl-draft.el index 5cd51bb..2447e07 100644 --- a/wl/wl-draft.el +++ b/wl/wl-draft.el @@ -1671,36 +1671,53 @@ Derived from `message-save-drafts' in T-gnus." (defun wl-draft-reedit (number) (let ((draft-folder (wl-folder-get-elmo-folder wl-draft-folder)) (wl-draft-reedit t) - buf-name file-name change-major-mode-hook) + buffer file-name change-major-mode-hook) (setq file-name (elmo-message-file-name draft-folder number)) (unless (file-exists-p file-name) (error "File %s does not exist" file-name)) - (setq buf-name (find-file-noselect file-name)) - (if wl-draft-use-frame - (switch-to-buffer-other-frame buf-name) - (switch-to-buffer buf-name)) - (set-buffer buf-name) - (if (not (string-match (regexp-quote wl-draft-folder) - (buffer-name))) - (rename-buffer (concat wl-draft-folder "/" (buffer-name)))) - (auto-save-mode -1) - (wl-draft-mode) - (setq wl-sent-message-via nil) - (setq wl-sent-message-queued nil) - (setq wl-draft-buffer-file-name file-name) - (wl-draft-config-info-operation number 'load) - (goto-char (point-min)) - (or (re-search-forward "\n\n" nil t) - (search-forward (concat mail-header-separator "\n") nil t)) - (write-region (point-min)(point-max) wl-draft-buffer-file-name - nil t) - (wl-draft-overload-functions) - (wl-draft-editor-mode) - (wl-highlight-headers 'for-draft) - (run-hooks 'wl-draft-reedit-hook) - (goto-char (point-max)) - buf-name - )) + (if (setq buffer (get-buffer + (concat wl-draft-folder "/" + (number-to-string number)))) + (progn + (if wl-draft-use-frame + (switch-to-buffer-other-frame buffer) + (switch-to-buffer buffer)) + (set-buffer buffer)) + (setq buffer (get-buffer-create (number-to-string number))) + (if wl-draft-use-frame + (switch-to-buffer-other-frame buffer) + (switch-to-buffer buffer)) + (set-buffer buffer) + (insert-file-contents-as-binary file-name) + (let((mime-edit-again-ignored-field-regexp + "^\\(Content-.*\\|Mime-Version\\):")) + (wl-draft-decode-message-in-buffer)) + (wl-draft-insert-mail-header-separator) + (if wl-draft-use-frame + (switch-to-buffer-other-frame buffer) + (switch-to-buffer buffer)) + (set-buffer buffer) + (if (not (string-match (regexp-quote wl-draft-folder) + (buffer-name))) + (rename-buffer (concat wl-draft-folder "/" (buffer-name)))) + (auto-save-mode -1) + (wl-draft-mode) + ;; Don't care about supersession. + (make-local-variable 'truncate-partial-width-windows) + (setq truncate-partial-width-windows nil) + (setq truncate-lines wl-draft-truncate-lines) + (setq buffer-file-name nil) + (setq wl-sent-message-via nil) + (setq wl-sent-message-queued nil) + (setq wl-draft-buffer-file-name file-name) + (wl-draft-config-info-operation number 'load) + (goto-char (point-min)) + (wl-draft-overload-functions) + (wl-draft-editor-mode) + (wl-highlight-headers 'for-draft) + (run-hooks 'wl-draft-reedit-hook) + (goto-char (point-max)) + buffer))) (defmacro wl-draft-body-goto-top () (` (progn @@ -2077,7 +2094,8 @@ Derived from `message-save-drafts' in T-gnus." buf draft-bufs) (while bufs (if (and - (setq buf (buffer-file-name (car bufs))) + (setq buf (with-current-buffer (car bufs) + wl-draft-buffer-file-name)) (string-match draft-regexp buf)) (setq draft-bufs (cons (buffer-name (car bufs)) draft-bufs))) (setq bufs (cdr bufs))) diff --git a/wl/wl-summary.el b/wl/wl-summary.el index 068b11e..bc73637 100644 --- a/wl/wl-summary.el +++ b/wl/wl-summary.el @@ -593,7 +593,15 @@ If ARG is non-nil, Supersedes message" (interactive "P") (if arg (wl-summary-supersedes-message) - (wl-draft-edit-string (wl-summary-message-string)))) + (if (string= (wl-summary-buffer-folder-name) wl-draft-folder) + (if (wl-summary-message-number) + (unwind-protect + (wl-draft-reedit (wl-summary-message-number)) + (if (wl-message-news-p) + (mail-position-on-field "Newsgroups") + (mail-position-on-field "To")) + (delete-other-windows))) + (wl-draft-edit-string (wl-summary-message-string))))) (defun wl-summary-resend-bounced-mail () "Re-mail the current message.