From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: David De La Harpe Golden Newsgroups: gmane.emacs.devel Subject: Re: split-window-preferred-function Date: Wed, 02 Apr 2008 23:26:14 +0100 Message-ID: <47F40806.6090705@harpegolden.net> 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> <87lk3woay9.fsf@member.fsf.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1207175204 9896 80.91.229.12 (2 Apr 2008 22:26:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 2 Apr 2008 22:26:44 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Apr 03 00:27:16 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 1JhBQG-0007B7-Ti for ged-emacs-devel@m.gmane.org; Thu, 03 Apr 2008 00:27:13 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JhBPe-0001xI-FE for ged-emacs-devel@m.gmane.org; Wed, 02 Apr 2008 18:26:34 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JhBPZ-0001tX-Qo for emacs-devel@gnu.org; Wed, 02 Apr 2008 18:26:29 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JhBPW-0001oW-Dt for emacs-devel@gnu.org; Wed, 02 Apr 2008 18:26:29 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JhBPW-0001oT-8z for emacs-devel@gnu.org; Wed, 02 Apr 2008 18:26:26 -0400 Original-Received: from harpegolden.net ([65.99.215.13]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JhBPW-0000uI-1A for emacs-devel@gnu.org; Wed, 02 Apr 2008 18:26:26 -0400 Original-Received: from golden1.harpegolden.net (86-43-170-98.b-ras2.prp.dublin.eircom.net [86.43.170.98]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "David De La Harpe Golden", Issuer "David De La Harpe Golden Personal CA rev 2" (verified OK)) by harpegolden.net (Postfix) with ESMTP id 35C8C8050 for ; Wed, 2 Apr 2008 22:26:24 +0000 (UTC) User-Agent: Mozilla-Thunderbird 2.0.0.9 (X11/20080110) In-Reply-To: <87lk3woay9.fsf@member.fsf.org> X-Enigmail-Version: 0.95.0 X-detected-kernel: by monty-python.gnu.org: 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:94235 Archived-At: Tassilo Horn wrote: > martin rudalics writes: > > Hi Martin, > >> BTW, do we want a `split-width-threshold'? > > What would that do? > > Judging from the name I think it would inhibit splitting if the > resulting window would be smaller than that threshold and reuse the > least recently used window instead. I'd welcome such a feature (I > usually don't want windows that are smaller than 80 columns), but > wouldn't we need the same for height, too? > FWIW, I've currently got the following split-window-preferred function in my .emacs I don't really know the details of the relevant emacs internals, it just did roughly what I wanted, so I was happy. (setq split-window-preferred-function (lambda (window) (let ((w (window-width window)) (h (window-height window)) (force-vert nil) (w/h-ratio 2.0)) ; should be customizable. ;; Paranoia (when (> 1 w) (setq w 1)) (when (> 1 h) (setq h 1)) (when (>= 160 w) (setq force-vert t)) (if (and (not force-vert) (< (float w/h-ratio) (/ (float w) (float h)))) (split-window window nil 'horiz) (split-window window)))))