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: split-window-preferred-function Date: Fri, 04 Apr 2008 12:04:00 +0200 Message-ID: <87ve2yx7fz.fsf@member.fsf.org> References: <47E188D5.5030502@gmx.at> <87hcf1rrdj.fsf@jurta.org> <87r6e3k3hc.fsf@jurta.org> <87d4pfzt2j.fsf@jurta.org> <47ED4BF7.9060507@gmx.at> <871w5utnac.fsf@jurta.org> <47EE064A.1060105@gmx.at> <874papk8zl.fsf@jurta.org> <47F34982.2000706@gmx.at> <87hcejc318.fsf@jurta.org> <87ve2zo1y5.fsf@member.fsf.org> <87bq4qfyuu.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 1207303464 13234 80.91.229.12 (4 Apr 2008 10:04:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 4 Apr 2008 10:04:24 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Apr 04 12:04:56 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 1Jhin0-0006Jc-02 for ged-emacs-devel@m.gmane.org; Fri, 04 Apr 2008 12:04:54 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JhimN-0005Fv-AS for ged-emacs-devel@m.gmane.org; Fri, 04 Apr 2008 06:04:15 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JhimH-0005F2-WC for emacs-devel@gnu.org; Fri, 04 Apr 2008 06:04:10 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JhimE-0005DI-OW for emacs-devel@gnu.org; Fri, 04 Apr 2008 06:04:08 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JhimD-0005D4-Rd for emacs-devel@gnu.org; Fri, 04 Apr 2008 06:04:05 -0400 Original-Received: from out4.smtp.messagingengine.com ([66.111.4.28]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JhimD-0007FT-BQ for emacs-devel@gnu.org; Fri, 04 Apr 2008 06:04:05 -0400 Original-Received: from compute2.internal (compute2.internal [10.202.2.42]) by out1.messagingengine.com (Postfix) with ESMTP id A4418E4B63 for ; Fri, 4 Apr 2008 06:04:03 -0400 (EDT) Original-Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute2.internal (MEProxy); Fri, 04 Apr 2008 06:04:03 -0400 X-Sasl-enc: HFADoWjogUIxPuHqLXaiNdK8dOtKjKIovCqpq43/rtHe 1207303443 Original-Received: from localhost (dslb-092-072-009-019.pools.arcor-ip.net [92.72.9.19]) by mail.messagingengine.com (Postfix) with ESMTPA id D8FA627954 for ; Fri, 4 Apr 2008 06:04:02 -0400 (EDT) Mail-Followup-To: emacs-devel@gnu.org In-Reply-To: <87bq4qfyuu.fsf@jurta.org> (Juri Linkov's message of "Fri, 04 Apr 2008 01:54:29 +0300") User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. 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:94316 Archived-At: Juri Linkov writes: > I don't see how this would help to decide whether to split a window > vertically or horizontally, or to display a buffer in a new window. The order of the splitting functions in the hypothetical `split-window-functions' list would express the preference. Each function checks if it's applicable (wrt to split-{width,height}-threshold) and returns nil, if it's not. > For example: > > +----------------+--------------------------------+ > | | | > | 80 columns | 160 columns | > | | | > | | | > | | | > | | | > +----------------+--------------------------------+ > > When the right window is wide enough to be split horizontally, and > point is in the left window, what is the best to do here? > > 1. display a buffer in the right window without splitting it; > 2. split the wide right window horizontally and display a buffer > in a new window; > 3. split the left window vertically (this option is preferable > for some buffers, e.g. for calendar) By default I'd say the splitting functions only check if the current window is wide/high enough. So I the case above if horizontal splitting is preferred and split-width-threshold is more than 40, the horizontal splitting function would not be applicable and return nil. The vertical splitting function is the next and checks if the left window is higher than split-height-threshold (the default should be changed to something like 40). If it is, then option 3 would be done. If not, then it would return nil, too. In that case display-buffer would reuse the LRU window which is the right one. I think that's a sensible default. Users are free to add other functions. For example the splitting functions could be extended to search through all windows of the current frame to find one that's large enough for a horizontal/vertical split. Bye, Tassilo