Kim F. Storm wrote:
[EMAIL PROTECTED] (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... ;-)
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel