From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: Re: `split-window-preferred-horizontally' Date: Sat, 07 Jun 2008 10:21:48 +0200 Message-ID: <484A451C.2010408@gmx.at> References: <87k5h28i23.fsf@localhorst.mine.nu> <4849B3D7.6090809@gmx.at> <87fxrq198q.fsf@localhorst.mine.nu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1212826910 27348 80.91.229.12 (7 Jun 2008 08:21:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 7 Jun 2008 08:21:50 +0000 (UTC) Cc: emacs-devel@gnu.org To: David Hansen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jun 07 10:22:32 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 1K4th1-0005h2-81 for ged-emacs-devel@m.gmane.org; Sat, 07 Jun 2008 10:22:31 +0200 Original-Received: from localhost ([127.0.0.1]:51414 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K4tgD-0004BU-GE for ged-emacs-devel@m.gmane.org; Sat, 07 Jun 2008 04:21:41 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K4tg8-00049v-Cr for emacs-devel@gnu.org; Sat, 07 Jun 2008 04:21:36 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K4tg6-00048q-Po for emacs-devel@gnu.org; Sat, 07 Jun 2008 04:21:36 -0400 Original-Received: from [199.232.76.173] (port=34504 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K4tg6-00048d-FE for emacs-devel@gnu.org; Sat, 07 Jun 2008 04:21:34 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]:41866) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1K4tg6-0007LV-13 for emacs-devel@gnu.org; Sat, 07 Jun 2008 04:21:34 -0400 Original-Received: (qmail invoked by alias); 07 Jun 2008 08:21:32 -0000 Original-Received: from 62-47-38-140.adsl.highway.telekom.at (EHLO [62.47.38.140]) [62.47.38.140] by mail.gmx.net (mp055) with SMTP; 07 Jun 2008 10:21:32 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX18XzRU/W8kXBWOTjE2geNu4aGuf2xOvlJc3UW/QZF TfUNV10PoEk2mi User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en In-Reply-To: <87fxrq198q.fsf@localhorst.mine.nu> X-Y-GMX-Trusted: 0 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) 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:98566 Archived-At: > That's how I would like it: > > If the *frame* is >= 160 chars wide > > - if it is already (horizontally) split use the *other* window with > all the `*-other-window' commands and `display-buffer' `split-window-preferred-function' should decide if and how to split the largest (or most recently used) window offered by `display-buffer'. It cannot decide which window to use when _no_ window gets split. > - otherwise split it horizontally. > > If the *frame* is < 160 chars wide do above with s/horizontally/vertically/ > (as the default behavior already is). (defun my-spf (window) (if (>= (frame-width (window-frame window)) 120) (when (window-full-width-p window) (let ((split-width-threshold 120)) (split-window window nil t))) (split-window))) seems to do what you want with a value of 120 - I can't test 160 here. > I suspect that emacs thinks my already (horizontally) split frame is to > small because the *window* is just 80 + ? chars wide. The value of `split-width-threshold' must be set accordingly to handle this when your frame contains more than one window. If WINDOW is 120 columns wide, `split-width-threshold' equals 160, and you have more than one window on your frame, `split-window' should refuse to split WINDOW.