[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: re-generating a window-configuration by program
From: |
Kevin Rodgers |
Subject: |
Re: re-generating a window-configuration by program |
Date: |
Fri, 19 Dec 2003 10:21:20 -0700 |
User-agent: |
Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:0.9.4.1) Gecko/20020406 Netscape6/6.2.2 |
Klaus Berndl wrote:
Is this problem described understandable?
I have already a program which generates the layout above, means it
splits the frame in the windows A, B, C and E. Now suppose someone
splits the window E in arbitrary "subwindows"... Then i want to store
the window-layout of the area E as a window-config like described
above. Then a special window-deleter restores the layout above
(i.e. unsplits only area E) and then i want to run the algorithm i
asked for to restore the splitted layout of area E.
The problem is well-described, but your approach is flawed: your window
configuration data structure describes each window as a component of the
frame (at the same level as the other windows). But you want to restore
the configuration as if the windows form a hierarchy. The only way to
do that is to record the chain of events leading to the configuration;
e.g. window F was formed by splitting window E (horizontally or
vertically). Because of the numerous ways windows can be created,
deleted, and modified, I don't think it is workable to advise the
split-window-*, delete-window, etc. commands; instead, try to use these
(documented in the Window Hooks node of the Emacs Lisp manual):
- Variable: window-size-change-functions
This variable holds a list of functions to be called if the size
of any window changes for any reason. The functions are called
just once per redisplay, and just once for each frame on which
size changes have occurred.
Each function receives the frame as its sole argument. There is no
direct way to find out which windows on that frame have changed
size, or precisely how. However, if a size-change function
records, at each call, the existing windows and their sizes, it
can also compare the present sizes and the previous sizes.
Creating or deleting windows counts as a size change, and therefore
causes these functions to be called. Changing the frame size also
counts, because it changes the sizes of the existing windows.
...
- Variable: window-configuration-change-hook
A normal hook that is run every time you change the window
configuration of an existing frame. This includes splitting or
deleting windows, changing the sizes of windows, or displaying a
different buffer in a window. The frame whose window
configuration has changed is the selected frame when this hook
runs.
--
Kevin Rodgers