help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: balance-windows again


From: Lennart Borgman
Subject: Re: balance-windows again
Date: Fri, 30 Sep 2005 14:03:25 +0200
User-agent: Mozilla Thunderbird 1.0.6 (Windows/20050716)

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...  ;-)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]