From: Tassilo Horn <tassilo@member.fsf.org>
To: emacs-devel@gnu.org
Subject: Re: Patch: prefer-window-split-horizontally
Date: Tue, 14 Aug 2007 18:51:56 +0200 [thread overview]
Message-ID: <87sl6mhxeb.fsf@baldur.tsdh.de> (raw)
In-Reply-To: 87bqdajcr1.fsf@baldur.tsdh.de
[-- Attachment #1: Type: text/plain, Size: 42 bytes --]
Hi again,
I forgot to attach the patch.
[-- Attachment #2: prefer-window-split-horizontally.patch --]
[-- Type: text/x-patch, Size: 6903 bytes --]
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 14 Aug 2007 16:22:19 -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,25 +3759,52 @@
else
window = Fget_largest_window (frames, Qt);
+ /* If we prefer to split horizontally and if the resulting window would be
+ wide enough, split it horizontally. */
+ if (!NILP (window)
+ && !NILP (Vprefer_window_split_horizontally)
+ && ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame))
+ && WINDOW_FULL_WIDTH_P (XWINDOW (window))
+ && (window_width(window) >> 1) >= window_min_width
+ && (!NUMBERP (Vprefer_window_split_horizontally) ||
+ (window_width(window) >> 1) >= XINT (Vprefer_window_split_horizontally)))
+ {
+ window = Fsplit_window (window, Qnil, Qt);
+ }
+
/* If the largest window is tall enough, full-width, and either eligible
for splitting or the only window, split it. */
- 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))))
+ 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);
else
{
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 the LRU window is selected, and we prefer to split horizontally
+ and it's big enough, and can be split, split it horizontally. */
if (!NILP (window)
&& ! FRAME_NO_SPLIT_P (XFRAME (XWINDOW (window)->frame))
+ && (EQ (window, selected_window)
+ || EQ (XWINDOW (window)->parent, Qnil))
+ && !NILP (Vprefer_window_split_horizontally)
+ && (window_width(window) >> 1) >= window_min_width
+ && (!NUMBERP (Vprefer_window_split_horizontally) ||
+ (window_width(window) >> 1) >= XINT (Vprefer_window_split_horizontally)))
+ {
+ window = Fsplit_window (window, Qnil, Qt);
+ }
+
+ /* 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)))
@@ -7344,6 +7383,13 @@
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;
Index: src/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/src/ChangeLog,v
retrieving revision 1.5785
diff -u -r1.5785 ChangeLog
--- src/ChangeLog 13 Aug 2007 13:41:12 -0000 1.5785
+++ src/ChangeLog 14 Aug 2007 16:23:07 -0000
@@ -1,3 +1,10 @@
+2007-08-14 Tassilo Horn <tassilo@member.fsf.org>
+
+ * window.c (prefer_window_split_horizontally): New variable.
+ Rework of Fredrik Axelsson's patch. See
+ http://thread.gmane.org/gmane.emacs.pretest.bugs/17653.
+ (display_buffer): Consider splitting windows horizontally.
+
2007-08-13 Jan Djärv <jan.h.d@swipnet.se>
* gtkutil.c (update_frame_tool_bar): Use -1 as index
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 14 Aug 2007 16:23:08 -0000
@@ -350,6 +350,7 @@
(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: lisp/ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.11548
diff -u -r1.11548 ChangeLog
--- lisp/ChangeLog 14 Aug 2007 14:52:51 -0000 1.11548
+++ lisp/ChangeLog 14 Aug 2007 16:23:15 -0000
@@ -1,3 +1,9 @@
+2007-08-14 Tassilo Horn <tassilo@member.fsf.org>
+
+ * cus-start.el (all): Add prefer-window-split-horizontally from
+ window.c. Rework of Fredrik Axelsson's patch. See
+ http://thread.gmane.org/gmane.emacs.pretest.bugs/17653.
+
2007-08-14 Chris Hecker <checker@d6.com> (tiny change)
* calc/calc-aent.el (calc-do-quick-calc): Add binary
[-- Attachment #3: Type: text/plain, Size: 14 bytes --]
Bye,
Tassilo
[-- Attachment #4: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
next prev parent reply other threads:[~2007-08-14 16:51 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-14 16:34 Patch: prefer-window-split-horizontally Tassilo Horn
2007-08-14 16:51 ` Tassilo Horn [this message]
2007-08-15 18:22 ` Richard Stallman
2007-08-15 18:47 ` Tassilo Horn
2007-08-16 2:42 ` Richard Stallman
2007-08-16 5:52 ` Tassilo Horn
2007-08-14 20:47 ` Juri Linkov
2007-08-15 5:35 ` Tassilo Horn
2007-08-15 15:24 ` Davis Herring
2007-08-15 15:49 ` Tassilo Horn
2007-08-15 18:22 ` Richard Stallman
2007-08-15 18:57 ` Tassilo Horn
2007-08-15 19:35 ` Stefan Monnier
2007-08-15 19:53 ` Tassilo Horn
2007-08-15 20:31 ` Stefan Monnier
2007-08-16 6:28 ` Tassilo Horn
2007-08-16 13:11 ` Stefan Monnier
2007-08-16 13:38 ` Tassilo Horn
2007-08-16 14:00 ` klaus.berndl
2007-08-16 14:37 ` Tassilo Horn
2007-08-16 14:34 ` Stefan Monnier
2007-08-16 14:52 ` Tassilo Horn
2007-08-16 15:46 ` klaus.berndl
2007-08-15 23:36 ` Juri Linkov
2007-08-16 0:45 ` Stefan Monnier
2007-08-16 20:21 ` Juri Linkov
2007-08-16 2:42 ` Richard Stallman
2007-08-16 20:23 ` Juri Linkov
2007-08-15 5:52 ` Dieter Wilhelm
2007-08-15 6:27 ` Tassilo Horn
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87sl6mhxeb.fsf@baldur.tsdh.de \
--to=tassilo@member.fsf.org \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).