From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel Subject: Re: Patch: prefer-window-split-horizontally Date: Tue, 14 Aug 2007 18:51:56 +0200 Message-ID: <87sl6mhxeb.fsf@baldur.tsdh.de> References: <87bqdajcr1.fsf@baldur.tsdh.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1187110340 5776 80.91.229.12 (14 Aug 2007 16:52:20 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 14 Aug 2007 16:52:20 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Aug 14 18:52:17 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IKzct-000329-6b for ged-emacs-devel@m.gmane.org; Tue, 14 Aug 2007 18:52:15 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IKzcs-0003DV-Id for ged-emacs-devel@m.gmane.org; Tue, 14 Aug 2007 12:52:14 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IKzcp-0003DQ-EJ for emacs-devel@gnu.org; Tue, 14 Aug 2007 12:52:11 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IKzcp-0003DB-6K for emacs-devel@gnu.org; Tue, 14 Aug 2007 12:52:11 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IKzco-0003D8-RM for emacs-devel@gnu.org; Tue, 14 Aug 2007 12:52:10 -0400 Original-Received: from main.gmane.org ([80.91.229.2] helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IKzco-0000cR-5w for emacs-devel@gnu.org; Tue, 14 Aug 2007 12:52:10 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1IKzch-0008IQ-Rx for emacs-devel@gnu.org; Tue, 14 Aug 2007 18:52:03 +0200 Original-Received: from dslb-084-063-059-104.pools.arcor-ip.net ([84.63.59.104]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 14 Aug 2007 18:52:03 +0200 Original-Received: from tassilo by dslb-084-063-059-104.pools.arcor-ip.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 14 Aug 2007 18:52:03 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 183 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: dslb-084-063-059-104.pools.arcor-ip.net Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAAAAAByaaZbAAAACXBIWXMAAABIAAAASABGyWs+ AAAATnRFWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYACmV4aWYKICAgICAgMjAKNDU3ODY5NjYwMDAw NGQ0ZDAwMmEwMDAwMDAwODAwMDAwMDAwMDAwMAqJuBZbAAAACXZwQWcAAAAwAAAAMADO7oxXAAAB jUlEQVRIx5VVWxLEIAjzJh6Ny+WMfm95iKhYu87ObIuEQARb2p+rjEc8P/wBgK3MK2yVbiFZlXYI 1E4kO6UHqIDYNsBjFivHQ2DonllKEFStHYB2TD4mBnqyYID4ryVmhUtOxeTErK68k9XpYfi9bP4P My/5E9WiWswAeVz9x3KEyCUAiF5mDJ5kXIFCa2BoN7k7MQARwbo2Zeg1aHySU212VlXltxJGSlBT xdQSIxOuTdrGAIxQSuGGykvN9aWumB5cJclXwz8Z+ZGQ9oqkRgGgglh89P5hz6EP1NJ7aTvVie3Z b3EettGpvXqYRO5v7c0csbHhZRjviObz4JOwzc9hpkfLbNMzmcvtlnBu2m6NNX6Y2SBJSfk9R7S2 zGOJrtMW5XdCCRfDuknZaEeVsEWkXbirSsca1qrDYKK9MSTn9w5IEEfAcnQyAXoZfS0aSXOVm8PL JytRCkTH9k5v+Er4whCTuwLgE5uP0zGlvwHJJFxqwHQzfGGAfgbwFSD5rH1xOweAvqf0T2u8rh9P LJ2hezyQygAAACp6VFh0Q29tbWVudAAAeNrzCnB1t0rPK9XNSE1M0csqSFcwMjerMDIzBABomgep tDkYGQAAABp6VFh0anBlZzpjb2xvcnNwYWNlAAB42jMEAAAyADIppJqJAAAAIXpUWHRqcGVnOnNh bXBsaW5nLWZhY3RvcgAAeNozqjACAAG7AN1zYDKrAAAAAElFTkSuQmCC User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1.50 (gnu/linux) Cancel-Lock: sha1:3O+75HzAscEcN4MXqAmvscONLa4= X-Detected-Kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:76513 Archived-At: --=-=-= Hi again, I forgot to attach the patch. --=-=-= Content-Type: text/x-patch; charset=iso-8859-1 Content-Disposition: attachment; filename=prefer-window-split-horizontally.patch Content-Transfer-Encoding: 8bit Content-Description: prefer-window-split-horizontally.patch 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 + + * 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 * 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 + + * 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 (tiny change) * calc/calc-aent.el (calc-do-quick-calc): Add binary --=-=-= Bye, Tassilo --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel --=-=-=--