unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* prefer-window-split-horizontally patch resend
@ 2007-08-23 11:26 Fredrik Axelsson
  2007-08-24  7:49 ` Fredrik Axelsson
  2007-09-07  3:35 ` Stefan Monnier
  0 siblings, 2 replies; 5+ messages in thread
From: Fredrik Axelsson @ 2007-08-23 11:26 UTC (permalink / raw)
  To: emacs-devel; +Cc: Tassilo Horn

[-- Attachment #1: Type: text/plain, Size: 312 bytes --]

I'm re-posting the horizontal window split patch. It's updated to merge
with the current cvs trunk.

I've been away all summer and have missed the postings requesting this
patch. Sorry for that.

Prompted by Richard Stallman I have requested legal papers to
sign. They should be in the mail to me now.

/fredrik

[-- Attachment #2: prefer-window-split-horizontally.patch --]
[-- Type: text/x-patch, Size: 7075 bytes --]

Index: lisp/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.11605
diff -u -r1.11605 ChangeLog
--- lisp/ChangeLog	22 Aug 2007 22:40:18 -0000	1.11605
+++ lisp/ChangeLog	23 Aug 2007 09:05:20 -0000
@@ -1,3 +1,8 @@
+2007-08-23  Fredrik Axelsson  <f.axelsson@gmail.com>
+
+	* cus-start.el (all): Add prefer-window-split-horizontally from
+	window.c.
+
 2007-08-22  Jason Rumney  <jasonr@gnu.org>
 
 	* vc-hooks.el (vc-menu-map-filter): Reapply 2007-08-06 bugfix.
Index: lisp/cus-start.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/cus-start.el,v
retrieving revision 1.104
diff -u -r1.104 cus-start.el
--- lisp/cus-start.el	26 Jul 2007 05:26:19 -0000	1.104
+++ lisp/cus-start.el	23 Aug 2007 09:05:20 -0000
@@ -350,6 +350,8 @@
  		       (const :tag "Full screen (t)" :value t)
  		       (other :tag "Always" 1)))
 	     (display-buffer-reuse-frames windows boolean "21.1")
+	     (prefer-window-split-horizontally
+	      windows (choice boolean integer) "22.1")
 	     ;; xdisp.c
 	     (scroll-step windows integer)
 	     (scroll-conservatively windows integer)
Index: src/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/src/ChangeLog,v
retrieving revision 1.5796
diff -u -r1.5796 ChangeLog
--- src/ChangeLog	23 Aug 2007 08:45:46 -0000	1.5796
+++ src/ChangeLog	23 Aug 2007 09:05:34 -0000
@@ -1,3 +1,9 @@
+2007-08-23  Fredrik Axelsson  <f.axelsson@gmail.com>
+
+	* window.c (prefer_window_split_horizontally): New variable.
+	(display_buffer): Consider splitting window horizontally depending
+	on prefer_window_split_horizontally.
+
 2007-08-23  YAMAMOTO Mitsuharu  <mituharu@math.s.chiba-u.ac.jp>
 
 	* Makefile.in (RSVG_LIBS, RSVG_CFLAGS): New variables.
Index: src/window.c
===================================================================
RCS file: /sources/emacs/emacs/src/window.c,v
retrieving revision 1.584
diff -u -r1.584 window.c
--- src/window.c	13 Aug 2007 13:41:17 -0000	1.584
+++ src/window.c	23 Aug 2007 09:05:36 -0000
@@ -161,6 +161,13 @@
 
 Lisp_Object Veven_window_heights;
 
+/* Non-nil means that windows are split horizontally, i.e. side-by-side,
+   instead of vertically by `display-buffer'.  An integer value means that
+   windows may only be split horizontally if the newly created window is at
+   least as wide as that value.  */
+
+Lisp_Object Vprefer_window_split_horizontally;
+
 /* List of buffer *names* for buffers that should have their own frames.  */
 
 Lisp_Object Vspecial_display_buffer_names;
@@ -3647,7 +3654,12 @@
 
 If `even-window-heights' is non-nil, window heights will be evened out
 if displaying the buffer causes two vertically adjacent windows to be
-displayed.  */)
+displayed.  
+
+If `prefer-window-split-horizontally' is non-nil, windows are split
+horizontally, i.e. side-by-side, instead of vertically if possible. If the
+variable has an integer value, windows may only be split horizontally if the
+newly created window is at least as wide as that value.  */)
      (buffer, not_this_window, frame)
      register Lisp_Object buffer, not_this_window, frame;
 {
@@ -3747,13 +3759,26 @@
       else
 	window = Fget_largest_window (frames, Qt);
 
-      /* If the largest window is tall enough, full-width, and either eligible
-	 for splitting or the only window, split it.  */
+      /* If we prefer to split horizontally and the window is wide
+         enough, split it horizontally.  */
       if (!NILP (window)
 	  && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame))
 	  && WINDOW_FULL_WIDTH_P (XWINDOW (window))
-	  && (window_height (window) >= split_height_threshold
-	      || (NILP (XWINDOW (window)->parent)))
+	  && !NILP (Vprefer_window_split_horizontally)
+	  && (!NUMBERP (Vprefer_window_split_horizontally) ||
+              (window_width(window) >=
+	       2 * XINT (Vprefer_window_split_horizontally)))
+	  && (window_width(window)) >= (2 * window_min_width))
+	{
+	  window = Fsplit_window (window, Qnil, Qt);
+	}
+      /* Else, if the largest window is tall enough, full-width, and either
+	 eligible for splitting or the only window, split it. */
+      else if (!NILP (window)
+	       && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame))
+	       && WINDOW_FULL_WIDTH_P (XWINDOW (window))
+	       && (window_height (window) >= split_height_threshold
+		   || (NILP (XWINDOW (window)->parent)))
 	  && (window_height (window)
 	      >= (2 * window_min_size_2 (XWINDOW (window), 0))))
 	window = Fsplit_window (window, Qnil, Qnil);
@@ -3762,16 +3787,30 @@
 	  Lisp_Object upper, lower, other;
 
 	  window = Fget_lru_window (frames, Qt);
-	  /* If the LRU window is tall enough, and either eligible for splitting
-	  and selected or the only window, split it.  */
+	  /* If we prefer to split horizontally and the LRU window is wide
+	     enough, split it horizontally. */
 	  if (!NILP (window)
 	      && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame))
-	      && ((EQ (window, selected_window)
-		   && window_height (window) >= split_height_threshold)
-		  || (NILP (XWINDOW (window)->parent)))
-	      && (window_height (window)
-		  >= (2 * window_min_size_2 (XWINDOW (window), 0))))
-	    window = Fsplit_window (window, Qnil, Qnil);
+	      && !NILP (Vprefer_window_split_horizontally)
+	      && window_width(window) >= (2 * window_min_width)
+	      && (!NUMBERP (Vprefer_window_split_horizontally) ||
+		  window_width(window) >=
+		  (2 * XINT (Vprefer_window_split_horizontally))))
+	    {
+	      window = Fsplit_window (window, Qnil, Qt);
+	    }
+	  /* Else if the LRU window is tall enough, and either eligible for
+	  splitting and selected or the only window, split it.  */
+	  else if (!NILP (window)
+		   && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame))
+		   && ((EQ (window, selected_window)
+			&& window_height (window) >= split_height_threshold)
+		       || (NILP (XWINDOW (window)->parent)))
+		   && (window_height (window)
+		       >= (2 * window_min_size_2 (XWINDOW (window), 0))))
+	    {
+	      window = Fsplit_window (window, Qnil, Qnil);
+	    }
 	  else
 	    window = Fget_lru_window (frames, Qnil);
 	  /* If Fget_lru_window returned nil, try other approaches.  */
@@ -7344,6 +7383,14 @@
 If nil, `display-buffer' will leave the window configuration alone.  */);
   Veven_window_heights = Qt;
 
+  DEFVAR_LISP ("prefer-window-split-horizontally", &Vprefer_window_split_horizontally,
+               doc: /* *Non-nil means that windows are split horizontally, i.e. 
+side-by-side, instead
+of vertically by `display-buffer'.
+An integer value means that windows may only be split horizontally if the newly
+created window is at least as wide as that value.  */);
+  Vprefer_window_split_horizontally = Qnil;
+
   DEFVAR_LISP ("minibuffer-scroll-window", &Vminibuf_scroll_window,
 	       doc: /* Non-nil means it is the window that C-M-v in minibuffer should scroll.  */);
   Vminibuf_scroll_window = Qnil;

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: prefer-window-split-horizontally patch resend
  2007-08-23 11:26 prefer-window-split-horizontally patch resend Fredrik Axelsson
@ 2007-08-24  7:49 ` Fredrik Axelsson
  2007-09-07  3:35 ` Stefan Monnier
  1 sibling, 0 replies; 5+ messages in thread
From: Fredrik Axelsson @ 2007-08-24  7:49 UTC (permalink / raw)
  To: emacs-devel

Here are ChangeLog entries for the patch.

Index: lisp/ChangeLog
+2007-08-23  Fredrik Axelsson  <f.axelsson@gmail.com>
+
+	* cus-start.el (all): Add prefer-window-split-horizontally from
+	window.c.

Index: src/ChangeLog
+2007-08-23  Fredrik Axelsson  <f.axelsson@gmail.com>
+
+	* window.c (prefer_window_split_horizontally): New variable.
+	(display_buffer): Consider splitting window horizontally depending
+	on prefer_window_split_horizontally.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: prefer-window-split-horizontally patch resend
  2007-08-23 11:26 prefer-window-split-horizontally patch resend Fredrik Axelsson
  2007-08-24  7:49 ` Fredrik Axelsson
@ 2007-09-07  3:35 ` Stefan Monnier
  2007-09-07  7:50   ` Tassilo Horn
  2007-09-07  8:54   ` Juri Linkov
  1 sibling, 2 replies; 5+ messages in thread
From: Stefan Monnier @ 2007-09-07  3:35 UTC (permalink / raw)
  To: Fredrik Axelsson; +Cc: Tassilo Horn, emacs-devel

> I'm re-posting the horizontal window split patch. It's updated to merge
> with the current cvs trunk.

I've installed a similar change, except that the var name is
split-window-preferred-function, and it does enjoy the flexibility implied
by its name: it can be set to a function that chooses between horizontal and
vertical splits based on the time of day (and it may also send a mail to
your boss along the way).


        Stefan

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: prefer-window-split-horizontally patch resend
  2007-09-07  3:35 ` Stefan Monnier
@ 2007-09-07  7:50   ` Tassilo Horn
  2007-09-07  8:54   ` Juri Linkov
  1 sibling, 0 replies; 5+ messages in thread
From: Tassilo Horn @ 2007-09-07  7:50 UTC (permalink / raw)
  To: emacs-devel

Stefan Monnier <monnier@iro.umontreal.ca> writes:

Hi Stefan,

>> I'm re-posting the horizontal window split patch. It's updated to
>> merge with the current cvs trunk.
>
> I've installed a similar change, except that the var name is
> split-window-preferred-function, and it does enjoy the flexibility
> implied by its name: it can be set to a function that chooses between
> horizontal and vertical splits based on the time of day (and it may
> also send a mail to your boss along the way).

Great!  Thanks a lot.

Bye,
Tassilo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: prefer-window-split-horizontally patch resend
  2007-09-07  3:35 ` Stefan Monnier
  2007-09-07  7:50   ` Tassilo Horn
@ 2007-09-07  8:54   ` Juri Linkov
  1 sibling, 0 replies; 5+ messages in thread
From: Juri Linkov @ 2007-09-07  8:54 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: tassilo, f.axelsson, emacs-devel

> I've installed a similar change, except that the var name is
> split-window-preferred-function, and it does enjoy the flexibility implied
> by its name: it can be set to a function that chooses between horizontal and
> vertical splits based on the time of day (and it may also send a mail to
> your boss along the way).

Thank you very much!  This is a flexible option with a good name.
I'm starting to test it.

-- 
Juri Linkov
http://www.jurta.org/emacs/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-09-07  8:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-23 11:26 prefer-window-split-horizontally patch resend Fredrik Axelsson
2007-08-24  7:49 ` Fredrik Axelsson
2007-09-07  3:35 ` Stefan Monnier
2007-09-07  7:50   ` Tassilo Horn
2007-09-07  8:54   ` Juri Linkov

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).