From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Borgman Newsgroups: gmane.emacs.help,gmane.emacs.devel Subject: Re: New balance-windows Date: Sun, 07 Aug 2005 04:17:21 +0200 Message-ID: <42F56F31.3080105@student.lu.se> References: <87pssv3kai.fsf@thalassa.informatimago.com> <1123035204.009217.187300@g14g2000cwa.googlegroups.com> <87fytr3ea2.fsf@thalassa.informatimago.com> <87vf2juij1.fsf@thalassa.informatimago.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1123382163 20534 80.91.229.2 (7 Aug 2005 02:36:03 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 7 Aug 2005 02:36:03 +0000 (UTC) Cc: help-gnu-emacs@gnu.org, Emacs Devel Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Aug 07 04:35:58 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1E1b0K-0005xm-Nr for geh-help-gnu-emacs@m.gmane.org; Sun, 07 Aug 2005 04:35:12 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E1b3G-0002PB-LI for geh-help-gnu-emacs@m.gmane.org; Sat, 06 Aug 2005 22:38:14 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1E1az5-0000bL-V9 for help-gnu-emacs@gnu.org; Sat, 06 Aug 2005 22:33:56 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1E1ayw-0000WP-Rs for help-gnu-emacs@gnu.org; Sat, 06 Aug 2005 22:33:48 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1E1ayw-0000Hs-Jx; Sat, 06 Aug 2005 22:33:46 -0400 Original-Received: from [81.228.8.83] (helo=pne-smtpout1-sn2.hy.skanova.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1E1awS-0006Fs-RQ; Sat, 06 Aug 2005 22:31:13 -0400 Original-Received: from [192.168.123.121] (83.249.202.239) by pne-smtpout1-sn2.hy.skanova.net (7.2.060.1) id 42BFBBD200639FC8; Sun, 7 Aug 2005 04:17:21 +0200 User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en Original-To: Pascal Bourguignon , Ehud Karni In-Reply-To: <87vf2juij1.fsf@thalassa.informatimago.com> X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:28505 gmane.emacs.devel:41645 X-Report-Spam: http://spam.gmane.org/gmane.emacs.help:28505 Pascal Bourguignon wrote: >"Ehud Karni" writes: > > > >>Following the recent discussion of `balance-windows' on help-gnu-emacs >>I looked into it and wrote a replacement (new) function based on >>somewhat different logic to achieve the balancing. >> >> > >Thanks very much. It's nice. But it's not perfect, see at the end. > > > >... >I think a correct algorithm should recover the split tree, then make >the balancing depending on the window counts in subtrees. > > I think Pascal is right. Though I think Ehud has made a very nice try I believe the split tree must be used. There is not enough information to solve the problem otherwise. Could it perhaps be done like this?: 1) Walk the tree of windows and compute and remember a weight for the childs in the subtree of each window and store that. 2) Walk the tree of windows once again and resize according to the weights from the top of the tree towards the bottom in each branch (recursively of course)! The weight could be computed as just the sum of childs but I think that should look odd and not be useful. Therefore I suggest that for each level in the subtree the weight is reduced by some factor. Naturally, in the usual mind of Emacs, this could be either a fixed fraction, say 0.7, or a list of fractions. I believe this should be easy to implement but I might have forgotten something?