[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

adding "split-horiz" to wl-draft-*buffer-style



I recently switched desktops to a new iMac with a really nice big screen
(27"), and I'm currently liking using WL in a really wide (250-char)
window, but to make most effective use of this vast screen space I've
found I like to write my replies in a window beside the message display
window (with the Summary window still fully spanning both the message
and draft buffer windows).

This patch adds a split-horiz option to the wl-draft-*buffer-style
variables.

It may not be perfect, but it more or less works very well for my
existing finger memory of occasionally "closing" the draft window and
then re-opening it later again with 'c'.

-- 
						Greg A. Woods
						Planix, Inc.

<woods@planix.com>       +1 416 218 0099        http://www.planix.com/

Index: wl/wl-vars.el
===================================================================
RCS file: /cvs/root/wanderlust/wl/wl-vars.el,v
retrieving revision 1.228
diff -u -r1.228 wl-vars.el
--- wl/wl-vars.el	15 Feb 2008 14:10:39 -0000	1.228
+++ wl/wl-vars.el	28 Jan 2010 19:25:21 -0000
@@ -1012,7 +1012,7 @@
   :group 'wl)
 
 (defcustom wl-alias-file "~/.im/Aliases"
-  "*Alias file for completion."
+  "*Alias file for completion. (optional)"
   :type 'file
   :group 'wl)
 
@@ -1449,24 +1449,34 @@
   :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."
+(defcustom wl-draft-buffer-style 'keep
+  "Style of draft buffer for writing new messages (i.e. except
+  for `wl-summary-reply' and `wl-summary-forward').
+
+'keep will use the current window for the new message,
+'full will use a full frame window,
+'split will split current window vertically (top-to-bottom), and
+'split-horiz will split the current window horizontally (side-by-side).
+If a function is given, it is called with the draft buffer as an argument."
   :type '(choice (const :tag "Keep window" keep)
-		 (const :tag "Split window" split)
+		 (const :tag "Split window vertically" split)
+		 (const :tag "Split window horizontally" split-horiz)
 		 (const :tag "Full window" full)
 		 (sexp :tag "Use Function"))
   :group 'wl-draft)
 
+;; ideally should default to split-horiz if message window's width is >= 132(?)
 (defcustom wl-draft-reply-buffer-style 'split
   "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."
+
+'keep will use the existing message buffer window for the reply,
+'full will use a full frame window,
+'split will split message buffer window vertically (top-to-bottom), and
+'spilt-horiz will split the message window horizontally (side-by-side).
+If a function is given, it is called with the draft buffer as an argument."
   :type '(choice (const :tag "Keep window" keep)
 		 (const :tag "Split window" split)
+		 (const :tag "Split window horizontally" split-horiz)
 		 (const :tag "Full window" full)
 		 (sexp :tag "Use Function"))
   :group 'wl-draft)
@@ -1521,12 +1531,12 @@
   :group 'wl-draft)
 
 (defcustom wl-summary-default-number-column 5
-  "Number of columns in summary buffer."
+  "Number of characters in the message number column in a summary buffer."
   :type 'integer
   :group 'wl-summary)
 
 (defcustom wl-summary-number-column-alist '(("\\*.*" . 6))
-  "Alist of folder and its number column.
+  "Alist of folder and its message number column width.
 If no matches, 'wl-summary-default-number-column' is used.
 ex.
 '((\"^%inbox@qmail-maildir\" . 9)
Index: wl/wl-draft.el
===================================================================
RCS file: /cvs/root/wanderlust/wl/wl-draft.el,v
retrieving revision 1.283
diff -u -r1.283 wl-draft.el
--- wl/wl-draft.el	25 Jan 2010 10:04:47 -0000	1.283
+++ wl/wl-draft.el	28 Jan 2010 19:25:22 -0000
@@ -1323,6 +1323,7 @@
 	    (if (and (not (wl-message-mail-p))
 		     (not (wl-message-news-p)))
 		(error "No recipient is specified"))
+	    ;; XXX this is broken -- it's in the wrong place! see modern sendmail.el!
 	    (expand-abbrev)		; for mail-abbrevs
 	    (let ((mime-header-encode-method-alist
 		   (append
@@ -1679,12 +1680,18 @@
     ;; switch-buffer according to draft buffer style.
     (if wl-draft-use-frame
 	(switch-to-buffer-other-frame buffer)
+      ;; XXX the `case' body must be identical!  this should be re-factored
+      ;; (squashed together smartly)!
       (if reply-or-forward
 	  (case wl-draft-reply-buffer-style
 	    (split
 	     (split-window-vertically)
 	     (other-window 1)
 	     (switch-to-buffer buffer))
+	    (split-horiz
+	     (split-window-horizontally)
+	     (other-window 1)
+	     (switch-to-buffer buffer))
 	    (keep
 	     (switch-to-buffer buffer))
 	    (full
@@ -1694,13 +1701,16 @@
 	     (if (functionp wl-draft-reply-buffer-style)
 		 (funcall wl-draft-reply-buffer-style buffer)
 	       (error "Invalid value for wl-draft-reply-buffer-style"))))
+	;; otherwise we are writing an entirely new message...
 	(case wl-draft-buffer-style
 	  (split
-	   (when (eq major-mode 'wl-summary-mode)
-	     (wl-summary-toggle-disp-msg 'off))
 	   (split-window-vertically)
 	   (other-window 1)
 	   (switch-to-buffer buffer))
+	  (split-horiz
+	   (split-window-horizontally)
+	   (other-window 1)
+	   (switch-to-buffer buffer))
 	  (keep
 	   (switch-to-buffer buffer))
 	  (full
@@ -2367,7 +2377,7 @@
       len)))
 
 (defun wl-jump-to-draft-buffer (&optional arg)
-  "Jump to the draft if exists."
+  "Jump to the first of the buffers that are in `wl-draft-mode'."
   (interactive "P")
   (if arg
       (wl-jump-to-draft-folder)
@@ -2385,7 +2395,35 @@
 				   draft-bufs)))
 	    (setq buf (car buf))
 	  (setq buf (car draft-bufs)))
-	(switch-to-buffer buf))))))
+	(when (eq major-mode 'wl-summary-mode)
+	  (wl-summary-toggle-disp-msg 'on)
+	  (save-excursion
+	    (wl-summary-set-message-buffer-or-redisplay))
+	  (wl-message-select-buffer wl-message-buffer))
+	(let ((buf-win (get-buffer-window buf)))
+	  (if buf-win
+	      (pop-to-buffer buf)
+	    ;; 
+	    ;; XXX we have no way now to know if the draft was a reply or a new
+	    ;; message, so just assume it was a new message for now....
+	    ;;
+	    (case wl-draft-buffer-style
+		  (split
+		   (split-window-vertically)
+		   (other-window 1)
+		   (switch-to-buffer buf))
+		  (split-horiz
+		   (split-window-horizontally)
+		   (other-window 1)
+		   (switch-to-buffer buf))
+		  (keep
+		   (switch-to-buffer buf))
+		  (full
+		   (delete-other-windows)
+		   (switch-to-buffer buf))
+		  (t (if (functionp wl-draft-buffer-style)
+			 (funcall wl-draft-buffer-style buf)
+		       (error "Invalid value for wl-draft-buffer-style")))))))))))
 
 (defun wl-jump-to-draft-folder ()
   (let ((msgs (reverse (elmo-folder-list-messages (wl-draft-get-folder))))