From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Lennart Borgman Newsgroups: gmane.emacs.devel,gmane.emacs.help Subject: Re: balance-windows again Date: Fri, 30 Sep 2005 14:03:25 +0200 Message-ID: <433D298D.8060301@student.lu.se> References: <4328B58E.6010103@student.lu.se> <432A6DC2.30606@student.lu.se> <432ABE47.1010909@student.lu.se> 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 1128084773 24707 80.91.229.2 (30 Sep 2005 12:52:53 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 30 Sep 2005 12:52:53 +0000 (UTC) Cc: help-gnu-emacs@gnu.org, Emacs Devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 30 14:52:40 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1ELKMm-0004oz-CS for ged-emacs-devel@m.gmane.org; Fri, 30 Sep 2005 14:51:56 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ELKMk-0007Q0-J0 for ged-emacs-devel@m.gmane.org; Fri, 30 Sep 2005 08:51:54 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ELJiV-0001Pm-0k for emacs-devel@gnu.org; Fri, 30 Sep 2005 08:10:19 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ELJiQ-0001Nn-Ka for emacs-devel@gnu.org; Fri, 30 Sep 2005 08:10:15 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ELJiG-0001FJ-S1; Fri, 30 Sep 2005 08:10:05 -0400 Original-Received: from [81.228.8.164] (helo=pne-smtpout2-sn2.hy.skanova.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1ELJbw-0004RD-I1; Fri, 30 Sep 2005 08:03:33 -0400 Original-Received: from [192.168.123.121] (83.249.200.73) by pne-smtpout2-sn2.hy.skanova.net (7.2.060.1) id 42B94E290121D95B; Fri, 30 Sep 2005 14:03:26 +0200 User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en Original-To: "Kim F. Storm" In-Reply-To: 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:43385 gmane.emacs.help:29827 Archived-At: Kim F. Storm wrote: >storm@cua.dk (Kim F. Storm) writes: > > > >>The following patch adds a window-split-tree function which returns a simple >>tree presentation of the window split. You can use window-edges on the >>elements of the tree to get the dimensions (and build your representation). >> >> > >I think exposing the "container windows" as my previous patch did was >a really bad idea. Instead, I prefer to explicitly include the >window-edges of those windows. Below is a different patch which >implements this. > >The new window-split-tree function doesn't return the format Lennart >requested, but it is trivial to convert it to his proposed format: > >(defun balance-window-split (&optional frame) > (balance-window-split-1 (car (window-split-tree frame)))) > >(defun balance-window-split-1 (split) > (if (windowp split) > split > (let ((dir (car split)) > (edges (car (cdr split))) > (childs (cdr (cdr split)))) > (list > (cons 'dir (if dir 'ver 'hor)) > (cons 'b (nth 3 edges)) > (cons 'r (nth 2 edges)) > (cons 't (nth 1 edges)) > (cons 'l (nth 0 edges)) > (cons 'childs (mapcar #'balance-window-split-1 childs)))))) > > >Here's the revised patch: > > Thanks Kim, Very nice! I have tested a little bit now and done some trivial changes to bw.el to test your code. It seems to be working fine, but I have not tested very much yet. The new version of bw.el (where I have not cleaned up the old code yet) is here: http://ourcomments.org/Emacs/DL/elisp/test/ And now back to what I really have to do today... ;-)