From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Re: split-window-preferred-function Date: Sun, 23 Mar 2008 04:16:18 +0200 Organization: JURTA Message-ID: <87fxui5jfh.fsf@jurta.org> References: <47E188D5.5030502@gmx.at> <87hcf1rrdj.fsf@jurta.org> <87r6e3k3hc.fsf@jurta.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1206240150 24489 80.91.229.12 (23 Mar 2008 02:42:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 23 Mar 2008 02:42:30 +0000 (UTC) Cc: martin rudalics , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Mar 23 03:43:00 2008 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 1JdGAk-0000a9-7H for ged-emacs-devel@m.gmane.org; Sun, 23 Mar 2008 03:42:58 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JdGA9-0003hc-11 for ged-emacs-devel@m.gmane.org; Sat, 22 Mar 2008 22:42:21 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JdGA4-0003hK-2i for emacs-devel@gnu.org; Sat, 22 Mar 2008 22:42:16 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JdGA1-0003h0-W1 for emacs-devel@gnu.org; Sat, 22 Mar 2008 22:42:15 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JdGA1-0003gx-R5 for emacs-devel@gnu.org; Sat, 22 Mar 2008 22:42:13 -0400 Original-Received: from relay02.kiev.sovam.com ([62.64.120.197]) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JdGA1-0007PR-9g for emacs-devel@gnu.org; Sat, 22 Mar 2008 22:42:13 -0400 Original-Received: from [83.170.232.243] (helo=smtp.svitonline.com) by relay02.kiev.sovam.com with esmtp (Exim 4.67) (envelope-from ) id 1JdG9v-000A4a-3k; Sun, 23 Mar 2008 04:42:09 +0200 In-Reply-To: (Stefan Monnier's message of "Sat, 22 Mar 2008 12:36:32 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (x86_64-pc-linux-gnu) X-Scanner-Signature: 4204c266f86c3e9b1e0231505dd73b85 X-DrWeb-checked: yes X-SpamTest-Envelope-From: juri@jurta.org X-SpamTest-Group-ID: 00000000 X-SpamTest-Header: Not Detected X-SpamTest-Info: Profiles 2459 [Mar 21 2008] X-SpamTest-Info: helo_type=3 X-SpamTest-Info: {HEADERS: header Content-Type found without required header Content-Transfer-Encoding} X-SpamTest-Method: none X-SpamTest-Rate: 11 X-SpamTest-Status: Not detected X-SpamTest-Status-Extended: not_detected X-SpamTest-Version: SMTP-Filter Version 3.0.0 [0278], KAS30/Release X-detected-kernel: by monty-python.gnu.org: FreeBSD 6.x (1) 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:93234 Archived-At: > 2 - provide a non-nil default for split_window_preferred_function > by moving the current C code that checks the size and calls > split-window to Elisp. I tried to follow the current C code as close as possible, and the result is the function `split-window-preferred-horizontally' below. It is intended to be set as an option of `split-window-preferred-function'. Then the other option for it should be nil that will continue the standard processing of vertical splitting. There is a comment in cus-start.el that says: ;; FIXME: Add `sensibly' which chooses between ;; vertical or horizontal splits depending on the size ;; and shape of the window. So `split-window-preferred-sensibly' could be implemented later too as a similar function. (defcustom split-width-threshold 100 "A window must be at least this wide to be eligible for splitting by `display-buffer'. The value is in line units. If there is only one window, it is split regardless of this value." :type 'integer :group 'windows) (defun split-window-preferred-horizontally (window) (interactive) (if (and window (not (frame-parameter (window-frame window) 'unsplittable)) (window-full-width-p window) (>= (window-width window) split-width-threshold) (>= (window-width window) (* 2 window-min-width))) (split-window window nil 'horiz) (get-lru-window))) -- Juri Linkov http://www.jurta.org/emacs/