* wl-summary.el (wl-summary-reply): Don't treat switch buffer here.
authorteranisi <teranisi>
Thu, 7 Nov 2002 08:19:23 +0000 (08:19 +0000)
committerteranisi <teranisi>
Thu, 7 Nov 2002 08:19:23 +0000 (08:19 +0000)
(wl-summary-forward): Ditto.

* wl-vars.el (wl-draft-buffer-style): Added choice of keep and
function.
(wl-draft-buffer-style): New use option.

* wl-draft.el (wl-draft-create-buffer): Abolish argument `full'.
(wl-draft): Follow the change above.
(wl-draft-create-buffer): Use wl-draft-reply-buffer-style and
wl-draft-buffer-style.
(wl-user-agent-compose): Bind wl-draft-buffer-style with
switch-function.

wl/ChangeLog
wl/wl-draft.el
wl/wl-summary.el
wl/wl-vars.el

index 2d747be..29f003a 100644 (file)
@@ -1,3 +1,19 @@
+2002-11-07  Yuuichi Teranishi  <teranisi@gohome.org>
+
+       * wl-summary.el (wl-summary-reply): Don't treat switch buffer here.
+       (wl-summary-forward): Ditto.
+
+       * wl-vars.el (wl-draft-buffer-style): Added choice of keep and
+       function.
+       (wl-draft-buffer-style): New use option.
+
+       * wl-draft.el (wl-draft-create-buffer): Abolish argument `full'.
+       (wl-draft): Follow the change above.
+       (wl-draft-create-buffer): Use wl-draft-reply-buffer-style and
+       wl-draft-buffer-style.
+       (wl-user-agent-compose): Bind wl-draft-buffer-style with
+       switch-function.
+
 2002-11-01  Tomotaka SUWA  <cooper@saitama.fujimic.fujisankei-g.co.jp>
 
        * wl-address.el (wl-address-make-completion-entry): Extracted from
index cf637ca..2b4374a 100644 (file)
@@ -1553,13 +1553,7 @@ If KILL-WHEN-DONE is non-nil, current draft buffer is killed"
 
   (let (buf-name header-alist-internal)
     (setq buf-name
-         (wl-draft-create-buffer
-          (or
-           (eq this-command 'wl-draft)
-           (eq this-command 'wl-summary-write)
-           (eq this-command 'wl-summary-write-current-folder)
-           (eq this-command 'wl-folder-write-current-folder))
-          parent-folder))
+         (wl-draft-create-buffer parent-folder))
 
     (unless (cdr (assq 'From header-alist))
       (setq header-alist
@@ -1601,11 +1595,13 @@ If KILL-WHEN-DONE is non-nil, current draft buffer is killed"
           (goto-char (point-max))))
     buf-name))
 
-(defun wl-draft-create-buffer (&optional full parent-folder)
+(defun wl-draft-create-buffer (&optional parent-folder)
   (let* ((draft-folder (wl-folder-get-elmo-folder wl-draft-folder))
         (parent-folder (or parent-folder (wl-summary-buffer-folder-name)))
         (summary-buf (wl-summary-get-buffer parent-folder))
-       buf-name file-name num change-major-mode-hook)
+       buf-name file-name num change-major-mode-hook
+       (reply-or-forward (or (eq this-command 'wl-summary-reply)
+                             (eq this-command 'wl-summary-forward))))
     (if (not (elmo-folder-message-file-p draft-folder))
        (error "%s folder cannot be used for draft folder" wl-draft-folder))
     (setq num (elmo-max-of-list
@@ -1619,16 +1615,46 @@ If KILL-WHEN-DONE is non-nil, current draft buffer is killed"
                          (elmo-message-file-name
                           (wl-folder-get-elmo-folder wl-draft-folder)
                           num))))
+    ;; switch-buffer according to draft buffer style.
     (if wl-draft-use-frame
        (switch-to-buffer-other-frame buf-name)
-      (switch-to-buffer buf-name))
+      (if reply-or-forward
+         (case wl-draft-reply-buffer-style
+           (split
+            (split-window-vertically)
+            (other-window 1)
+            (switch-to-buffer buf-name))
+           (keep
+            (switch-to-buffer buf-name))
+           (full
+            (delete-other-windows)
+            (switch-to-buffer buf-name))
+           (t
+            (if (functionp wl-draft-reply-buffer-style)
+                (funcall wl-draft-reply-buffer-style buf-name)
+              (error "Invalid value for wl-draft-reply-buffer-style"))))
+       (case wl-draft-buffer-style
+         (split
+          (when (and (eq major-mode 'wl-summary-mode)
+                     wl-message-buffer
+                     (buffer-live-p wl-message-buffer)
+                     (get-buffer-window wl-message-buffer))
+            (delete-window (get-buffer-window wl-message-buffer)))
+          (split-window-vertically)
+          (other-window 1)
+          (switch-to-buffer buf-name))
+         (keep
+          (switch-to-buffer buf-name))
+         (full
+          (delete-other-windows)
+          (switch-to-buffer buf-name))
+         (t (if (functionp wl-draft-buffer-style)
+                (funcall wl-draft-buffer-style buf-name)
+              (error "Invalid value for wl-draft-buffer-style"))))))
     (set-buffer buf-name)
     (if (not (string-match (regexp-quote wl-draft-folder)
                           (buffer-name)))
        (rename-buffer (concat wl-draft-folder "/" (int-to-string num))))
-    (if (or (eq wl-draft-reply-buffer-style 'full)
-           full)
-       (delete-other-windows))
     (auto-save-mode -1)
     (wl-draft-mode)
     (make-local-variable 'truncate-partial-width-windows)
@@ -2367,7 +2393,7 @@ been implemented yet.  Partial support for SWITCH-FUNCTION now supported."
   ;; to be necessary to protect the values used w/in
   (let ((wl-user-agent-headers-and-body-alist other-headers)
        (wl-draft-use-frame (eq switch-function 'switch-to-buffer-other-frame))
-       (wl-draft-reply-buffer-style 'split))
+       (wl-draft-buffer-style switch-function))
     (when (eq switch-function 'switch-to-buffer-other-window)
       (when (one-window-p t)
        (if (window-minibuffer-p) (other-window 1))
index ade5c04..9f64586 100644 (file)
@@ -4876,9 +4876,6 @@ Reply to author if invoked with ARG."
       (wl-message-select-buffer wl-message-buffer)
       (set-buffer mes-buf)
       (goto-char (point-min))
-      (unless wl-draft-use-frame
-       (split-window-vertically)
-       (other-window 1))
       (when (setq mes-buf (wl-message-get-original-buffer))
        (wl-draft-reply mes-buf arg summary-buf)
        (unless without-setup-hook
@@ -4950,9 +4947,6 @@ Use function list is `wl-summary-write-current-folder-functions'."
        (wl-summary-redisplay-internal folder number))
       (setq mes-buf wl-message-buffer)
       (wl-message-select-buffer mes-buf)
-      (unless wl-draft-use-frame
-       (split-window-vertically)
-       (other-window 1))
       ;; get original subject.
       (if summary-buf
          (save-excursion
index 187721e..48ce748 100644 (file)
@@ -1222,10 +1222,26 @@ See also variable `wl-draft-parent-folder'."
   :group 'wl-draft
   :group 'wl-pref)
 
+(defcustom wl-draft-buffer-style 'full
+  "Style of draft buffer except for `wl-summary-reply' and `wl-summary-forward'
+'keep is to use current window, 'full is to use full frame window and
+'split is to split current window.
+If it is a function, it is called with the draft buffer as an argument."
+  :type '(choice (const :tag "Keep window" keep)
+                (const :tag "Split window" split)
+                (const :tag "Full window"full)
+                (sexp :tag "Use Function"))
+  :group 'wl-draft)
+
 (defcustom wl-draft-reply-buffer-style 'split
-  "'split or 'full."
-  :type '(radio (const split)
-               (const full))
+  "Style of draft buffer for `wl-summary-reply' and `wl-summary-forward'
+'keep is to use message buffer window, 'full is to use full frame window and
+'split is to split message buffer window.
+If it is a function, it is called with the draft buffer as an argument."
+  :type '(choice (const :tag "Keep window" keep)
+                (const :tag "Split window" split)
+                (const :tag "Full window"full)
+                (sexp :tag "Use Function"))
   :group 'wl-draft)
 
 (defcustom wl-draft-queue-save-variables