From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.devel Subject: window groups Date: Wed, 28 May 2008 14:22:50 +0200 Message-ID: <483D4E9A.9020001@gmx.at> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1211977664 4839 80.91.229.12 (28 May 2008 12:27:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 28 May 2008 12:27:44 +0000 (UTC) To: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 28 14:28:25 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1K1KlR-0000om-Dr for ged-emacs-devel@m.gmane.org; Wed, 28 May 2008 14:28:21 +0200 Original-Received: from localhost ([127.0.0.1]:51295 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K1Kkf-0007CC-TK for ged-emacs-devel@m.gmane.org; Wed, 28 May 2008 08:27:33 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K1KjJ-0006s7-Do for emacs-devel@gnu.org; Wed, 28 May 2008 08:26:09 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K1KjI-0006rj-Ne for emacs-devel@gnu.org; Wed, 28 May 2008 08:26:08 -0400 Original-Received: from [199.232.76.173] (port=42333 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K1KjI-0006rc-Bb for emacs-devel@gnu.org; Wed, 28 May 2008 08:26:08 -0400 Original-Received: from mail.gmx.net ([213.165.64.20]:37014) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1K1KjI-000545-0y for emacs-devel@gnu.org; Wed, 28 May 2008 08:26:08 -0400 Original-Received: (qmail invoked by alias); 28 May 2008 12:26:05 -0000 Original-Received: from 62-47-51-191.adsl.highway.telekom.at (EHLO [62.47.51.191]) [62.47.51.191] by mail.gmx.net (mp047) with SMTP; 28 May 2008 14:26:05 +0200 X-Authenticated: #14592706 X-Provags-ID: V01U2FsdGVkX18OZXZzoJAOAQhYLhSLRugxKxxq+eEVSsB+QUsRVI NR8qo6cqytoxEt User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: de-DE, de, en-us, en X-Y-GMX-Trusted: 0 X-detected-kernel: by monty-python.gnu.org: Genre and OS details not recognized. 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:97895 Archived-At: 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'.