emacs-devel
[Top][All Lists]
Advanced

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

window groups


From: martin rudalics
Subject: window groups
Date: Wed, 28 May 2008 14:22:50 +0200
User-agent: Mozilla Thunderbird 1.0 (Windows/20041206)

Here is my proposal:

(1) A window group is a collection of windows displayed within the root
    window of a frame.  For any window group there exists one designated
    window - the root window of that group.  A group root window is
    either the frame's root window or is a window whose parent window
    does not belong to any group (hence groups don't nest).  Every other
    window of a group is a subwindow of the group root window.  Internal
    windows of a group have at least two children (so a group contains
    at least two leaf windows).

(2) Window groups can be created by `split-window' which gets three
    additional parameters:

    Optional argument SAFE non-nil means ignore actual settings for
    `window-min-height' and `window-min-weight' but use safe defaults
    for minimum sizes instead.

    Optional argument INVERT non-nil means create the new window above
    or left of WINDOW, leave SIZE lines or columns in the original
    window, and return the newly created window.  The lower or rightmost
    window is the original window and remains selected if it was
    selected before.

    Optional argument GROUP non-nil means if the original window does
    not belong to a window group yet, create a new window group with the
    original and the new window as its only members.  If GROUP is
    non-nil and the original window already belongs to a group, the new
    window is obtained by splitting the original window and becomes a
    member of the original window's group.

    If GROUP is nil and the original window belongs to a group, the new
    window is obtained by splitting the root window of that group.  In
    this case the new window does not become a member of the original
    window's group.  The original window remains selected if it was
    selected before.  When INVERT is nil the new window is created below
    or to the right of the root window.  INVERT non-nil means the new
    window is created above or to the left of the root window.

    If GROUP is nil and the original window does not belong to a group,
    split the original window as usual.

    As a special case, GROUP `root' means assume the root window of the
    current frame forms a window group and proceed as with GROUP set to
    nil.  Thus with HORIZONTAL and INVERT non-nil and GROUP `root' the
    new window is created above all other windows of WINDOW's frame, the
    group status of the new window is set to nil, and the group status
    of all other windows remains unchanged.

(3) A group automatically ceases to exist when the number of its leaf
    windows becomes less than two.  The function `dissolve-window-group'
    dissolves the group an arbitrary window belongs to.

(4) All windows of a group share the same group number.  Windows
    belonging to different groups have different group numbers (unless
    you create more groups than an integer can hold).  For any window
    the function `window-group' returns the number of the group the
    window belongs to or nil if the window does not belong to any group.

(5) The function `clone-window-configuration' puts a window group or the
    root window of a frame into an arbitrary target frame's root window,
    window group, or window.  `clone-window-configuration' takes three
    arguments - CONFIGURATION, OLD and NEW.  CONFIGURATION must be a
    value previously returned by `current-window-configuration'.
    Optional argument OLD nil or omitted means clone the root window of
    that configuration.  If OLD is a window group (a value previously
    returned by `window-group') only windows belonging to that group are
    cloned.  An error is signalled if that group is empty.  Optional
    argument NEW nil or omitted means display the clone in the selected
    frame's root window.  NEW non-nil means display the clone in the
    selected window, or, if that window is part of a window group, in
    the root window of that group.

    Note that cloning does not reuse any windows or groups.  Rather, all
    windows and groups are created anew.

(6) The function `frame-root-window-tree' returns a list structure
    representing the layout of the root window of a frame including the
    group status of all subwindows and the buffer names of leaf windows.
    The function `clone-frame-root-window-tree' restores that layout
    from such a list structure in the root window of an arbitrary frame.

Conceptually, (2) should be sufficient to satisfy the requirements of
most IDE layouts like those of ECB or Eclipse "perspectives".

- IDEs would typically specify one window group ("edit-area" in ECB,
  "editor" in Eclipse) for each frame.  Splitting any window of that
  group would be done by setting the GROUP argument for `split-window'
  to t.  Other applications would not interfere with the layout of that
  group since, by default, their GROUP argument would not be t.

- IDE windows around that group (Eclipse "views") would be created as
  follows: For the first such window either (i) call `split-window' with
  GROUP set to `root' to obtain a full-height|width view, or (ii) call
  `split-window' with GROUP set to nil to obtain a window just as
  high|wide as the window group.  Further windows would be created by
  splitting an existing window with GROUP set to nil (or t for the more
  complex layout-outlines of ECB ).

  Approach (i) appears best for displaying views on the left or right of
  the edit area (file or tag views like the speedbar).  Approach (ii)
  might be given preference for displaying windows above or below the
  edit area (compile, shell, or grep views).

`current-window-configuration', `set-window-configuration', and
`save-window-excursion' retain their traditional semantics modulo saving
and restoring any window groups present in the configuration.

Cloning window configuration (5) is useful to restore a layout earlier
used in the same Emacs session or to switch between a layout where only
the edit area is seen and a layout displaying all sorts of views around
it.

Cloning the root window of a frame (6) is needed only to store a layout
in a desktop (or IDE specific) file to restore that root window in
another Emacs session.  Ideally, an IDE would come with preconfigured
layouts created via `frame-root-window-tree'.





reply via email to

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