Commits

Anonymous committed 5315697

Sync with current upstream 2.20

Comments (0)

Files changed (28)

+2004-02-07  Klaus Berndl  <klaus.berndl@sdm.de>
+	
+	* Sync with current upstream 2.20, see NEWS for details.
+
 2003-11-18  Norbert Koch  <viteno@xemacs.org>
 
 	* Makefile (VERSION): XEmacs package 1.14 released.
 # Boston, MA 02111-1307, USA.
 
 VERSION = 1.14
-AUTHOR_VERSION = 2.11
+AUTHOR_VERSION = 2.20
 MAINTAINER = Klaus Berndl <klaus.berndl@sdm.de>
 PACKAGE = ecb
 PKG_TYPE = regular
 	ecb-upgrade.elc ecb-layout-defs.elc ecb-tod.elc silentcomp.elc \
 	ecb-create-layout.elc ecb-examples.elc ecb-autogen.elc ecb-jde.elc \
 	ecb-winman-support.elc ecb-file-browser.elc ecb-method-browser.elc \
-	ecb-semantic-wrapper.elc
+	ecb-semantic-wrapper.elc ecb-compatibility.elc
 
 
 EXTRA_SOURCES = NEWS README RELEASE_NOTES
 DATA_14_FILES = $(wildcard ecb-images/directories/height-21/*.xpm)
 DATA_14_DEST = $(PACKAGE)/ecb-images/directories/height-21
 
+DATA_15_FILES = $(wildcard ecb-images/default/height-10/*.xpm)
+DATA_15_DEST = $(PACKAGE)/ecb-images/default/height-10
+DATA_16_FILES = $(wildcard ecb-images/directories/height-10/*.xpm)
+DATA_16_DEST = $(PACKAGE)/ecb-images/directories/height-10
+
 
 PRELOADS = -l overlay -l compile -l timer -l ecb-util -l ecb-eshell \
 	-l ecb-layout -l tree-buffer -l esh-mode -l em-dirs -l jde-help \

Makefile.upstream

 
 # For the ECB-maintainers: Change the version-number here and not
 # elsewhere!
-ecb_VERSION=2.11
+ecb_VERSION=2.20
 
-
-RM=rm -f
-CP=cp
-MV=mv -f
-MKDIR=mkdir -p
-
-EBATCH=$(EMACS) -batch -no-site-file
-
-ecb_LISP_EL=tree-buffer.el ecb-util.el ecb-mode-line.el ecb-help.el \
-            ecb-layout.el ecb-layout-defs.el ecb-navigate.el ecb.el \
-            ecb-eshell.el ecb-cycle.el ecb-face.el ecb-compilation.el \
-            ecb-upgrade.el ecb-create-layout.el silentcomp.el \
-            ecb-speedbar.el ecb-examples.el ecb-tod.el ecb-autogen.el \
-	    ecb-jde.el ecb-file-browser.el ecb-method-browser.el \
-	    ecb-winman-support.el ecb-semantic-wrapper.el
-
-ecb_LISP_ELC=$(ecb_LISP_EL:.el=.elc)
-
-ecb_AUTOLOADS=ecb-autoloads.el
-
-ecb_ETC=NEWS README RELEASE_NOTES Makefile make.bat
-
-ecb_TEXI=ecb.texi
-
-ecb_INFO=$(ecb_TEXI:.texi=.info)
-ecb_HTML=$(ecb_TEXI:.texi=.html)
-ecb_HTML_DIR=html-help
-ecb_INFO_DIR=info-help
-
-ecb_DVI=$(ecb_TEXI:.texi=.dvi)
-ecb_PS=$(ecb_TEXI:.texi=.ps)
-ecb_PDF=$(ecb_TEXI:.texi=.pdf)
-
-ecb_IMAGE_DIR=ecb-images
-
-ecb_DISTRIB_FILES=$(ecb_LISP_EL) $(ecb_AUTOLOADS) $(ecb_TEXI) $(ecb_ETC)
+include ecb-makedef.mk
 
 ecb: $(ecb_LISP_EL)
 	@echo "Byte-compiling ECB with LOADPATH=${LOADPATH} ..."
+* Changes for ECB version
+
+** Advice for `balance-windows' so only the edit-windows are balanced.
+   Thanks to for <> suggestion.
+
+** New option `ecb-ignore-display-buffer-function'
+   Per default the adviced version of `display-buffer' ignores the value of
+   `display-buffer-function' when called for the ECB-frame. If this variable
+   should not be ignored then the function of `display-buffer-function' is
+   completely responsible which window is used for the buffer to display - no
+   smart ECB-logic will help to deal best with the ECB-window-layout! You can
+   define if and when `display-buffer-function' should be ignored: Always
+   (default), when a compile-window is used or never.
+
+** For XEmacs the package fsf-compat is no longer required by ECB.
+   But it is still necessary to check if fsf-compat is required by the
+   packages semantic, eieio and speedbar which in turn are required by ECB.
+      
+** Fixed Bugs
+
+*** If point stays in the current source-buffer on a function argument then still
+    ECB highlights the function in the Methods-buffer.
+    
+
+
+* Changes for ECB version 2.20
+
+** New customization group "ecb-most-important"
+   This group centralizes the most important options of ECB in one group which
+   is also offered by the "Preferences" submenu ob the ECB-menu. These are
+   options you should at least know that they exist.
+
+** The keybinding for the online-help has changed from [C-c . o] to [C-c . h]
+   This has been done because the key [C-c . o] is needed for the new command
+   `ecb-toggle-scroll-other-window-scrolls-compile'.
+
+** The options `ecb-major-modes-activate' and `ecb-majors-mode-deactivate' have
+   been replaced by one new option `ecb-major-modes-show-or-hide'. The purpose
+   of the old option is now quite out-of-date because:
+   - ECB supports window-managers like winring.el or escreen.el very well,
+   - as of version 2.20 ECB has no restrictions about the number of
+     edit-windows and
+   - the new option simplifies things a lot.
+      
+** The restriction of only two edit-windows has been gone!
+
+*** Beginning with this version 2.20 there are no restrictions about the
+    window-layout in the edit-area of ECB. This means you can split the
+    edit-area of ECB in as many windows as you like. The split-state of the
+    edit-area will be preserved when toggling the visibility of the
+    ECB-windows and even between activation and deactivation of ECB. Deleting
+    of certain edit-windows will never destroy the special ECB-windows or the
+    compile-window. Just work with the edit-area of ECB as if it would be an
+    extra frame!
+
+*** Option `ecb-split-edit-window' has been renamed in
+    `ecb-split-edit-window-after-start' because this new name reflects much
+    better the purpose of this option. In addition there is offered a new
+    value 'before-deactivation which is also the new default value. This new
+    value preserves the full state between activations of ECB, i.e. the
+    visibility of the ECB-windows, the visibility of a compile-window and also
+    the full split-state of the edit-area. ECB auto. upgrades your setting!
+
+*** Compile-window can now be displayed even when the ECB-windows are hidden.
+    So now you can have the same compile-window functionality when the
+    ECB-window are hidden as when the ECB-windows are visible. The state of
+    the compile-window will be preserved when toggling the ecb-windows or when
+    maximizing one ecb-windows! So you have the advantage of one special
+    window for all help-, grep or compile-output also when the ecb-windows are
+    hidden - a window which will not be deleted if you call
+    `delete-other-windows' (bound to [C-x 1]) for one of the edit-windows.
+    
+*** The option `ecb-primary-mouse-jump-destination' has been renamed to
+    `ecb-mouse-click-destination' and has also changed its default value to
+    'last-point. ECB autom. upgrades the old settings.
+
+*** New keybinding [C-c . g l] for selecting the last selected edit-window.
+    Also available via the ECB-menu. The command is
+    `ecb-goto-window-edit-last'.
+
+*** Option `ecb-other-window-jump-behavior' has been renamed to
+    `ecb-other-window-behavior' and has also two new allowed values: 'smart
+    (the new default) and an arbitrary function-symbol. With the latter one
+    the user can define his own other-window-behavior and the former one
+    chooses in a smart and intuitive way the "other window" for going to it
+    via `other-window' or for scrolling it via one of the "scroll another
+    window"-functions (e.g. `scroll-other-window'). Thanks to John S. Yates,
+    Jr. <john@yates-sheets.org> for suggesting the new smart behavior. ECB
+    autom. upgrades the old value of `ecb-other-window-jump-behavior' to the
+    new option-name.
+    
+*** New option `ecb-scroll-other-window-scrolls-compile-window' and new
+    command `ecb-toggle-scroll-other-window-scrolls-compile' (bound to [C-c .
+    o]). If this new option is nil then ECB chooses very smart and intuitive
+    the window which will be scrolled by commands like `scroll-other-window'
+    (see documentation of the the option `ecb-other-window-behavior'). But
+    sometimes the user wants to scroll the compile-window from another window.
+    With this new command the user can fest and easy toggle the behavior ECB
+    chooses another window for scrolling.
+
+*** Higher compatibility of ECB with other packages
+    Without the 2-edit-window-restriction ECB is now more compatible with
+    other packages. For example the package calculator.el can now also being
+    used without setting `calculator-electric-mode' to not nil - regardless in
+    how many edit-windows the edit-area of ECB is splitted. Also the package
+    bs.el (command `bs-show') benefits from the new layout-flexibility. As of
+    ECB-version 2.20 there should be no conflicts between this package and
+    ECB.
+
+** Enhancements to the tree-buffers of ECB
+    
+*** Enhancements to the popup-menus of the tree-buffers
+
+**** All popup-menus of the tree-buffers can be used with the tmm-library
+     The already existing command `tree-buffer-show-menu-keyboard' (bound to
+     [M-m] in every tree-buffer of ECB) accepts now a prefix argument. If called
+     with a prefix-argument (hit [C-u M-m]) then the popup-menu is displayed
+     with the tmm-mechanismus (like the Emacs-[menu-bar] is displayed when
+     `tmm-menubar' is called). Thanks for suggestion to Yvonne Thomson
+     <yvonne@thewatch.net>.
+
+**** Select an edit-window via popup where a source should be opened or a token
+     should be displayed.
+    
+**** The popup-menus can be dynamically extended.
+     See the new options `ecb-directories-menu-user-extension-function',
+     `ecb-sources-menu-user-extension-function',
+     `ecb-methods-menu-user-extension-function' and
+     `ecb-history-menu-user-extension-function'.
+
+**** All popup-menu-commands respect the setting of the option
+     `ecb-mouse-click-destination' (formerly known as
+     `ecb-primary-mouse-jump-destination' - see above).
+
+*** ECB supports the default modeline-mechanisms for deleting other windows.
+    GNU Emacs binds [mouse-2] in its modeline to `delete-other-window'. ECB
+    now supports this mechanism by binding a toggle-command to [mouse-2] in
+    the modeline of each tree-buffer: If all ECB-windows are visible then this
+    command maximizes the current tree-window and if current tree-window is
+    maximized all ECB-windows are displayed again. XEmacs binds a popup-menu
+    with some window commands to [button-3] in its modeline. ECB supports this
+    mechanism by replacing this menu by a menu which offers exactly 2
+    commands: Maximizing current tree-window and displaying all ECB-windows.
+
+*** Now all commands for selecting a tree-buffer work even when this buffer is
+    not visible because another tree-buffer is maximized. If the tree-buffer
+    is contained in the layout then the layout is redrawn with all its
+    tree-buffers visible so that tree-buffer can be selected. Same for
+    maximizing. An example for such a command is `ecb-goto-window-methods'.
+
+*** New option `ecb-maximize-ecb-window-after-selection'.
+    Automatic maximizing of a tree-window after selecting it. Thanks for
+    suggestion to John S. Yates, Jr. <john@yates-sheets.org>.
+       
+*** Changes to the image-icons of the tree-buffers
+
+**** Alle image-files have been renamed from <IMAGENAME>.xpm to
+     ecb-<IMAGENAME>.xpm. This was necessary because the icons for "open" and
+     "close" in Emacs toolbar got superseeded by ECB's icons for "open" and
+     "close". The problem was, that ECB was using the same names for the icon
+     files "open.xpm" and "close.xpm" as emacs toolbar does. This problem
+     occurs if the image-directory of ECB is contained in the `load-path' which
+     is when ECB is installed in the site-lisp directory of Emacs with the
+     default subdirs.el of Emacs which adds automatically all subdirectories to
+     the load-path (and therefore also subdirectories which does not contain
+     elisp-files but only images - btw: not really smart;-). Thanks for
+     pointing out that to Roland Schaeuble <roland.schaeuble@siemens.com>.
+
+**** Added all image-icons in a 10-point height.
+     Thanks to Nick Cross <nick@goots.org> for sizing down the images.
+
+** New default-value for `ecb-post-process-semantic-taglist'.
+   Now for buffers with major-mode `c-mode' all function-prototypes are
+   filtered out. For example this is useful for editing C files which have the
+   function prototypes defined at the top of the file and the implementations
+   at the bottom. This means that everything appears twice in the methods
+   buffer, but probably nobody wants to jump to the prototypes, they are
+   only wasting space in the methods buffer. Of course in C-header-files
+   function-prototypes will be displayed!
+
+   Thanks for suggestion and a first implementation to Rob Walker
+   <rob.lists@tenfoot.org.uk>.
+
+** Changes for the compile-window
+   
+*** The command `ecb-toggle-compile-window' now displays a compile-window even if
+    the option `ecb-compile-window-height' is nil. This is a shortcut for
+    customizing this option via the customize-feature if you just want
+    displaying a compile-window for the current Emacs-session. In this
+    situation ECB asks for the height of the compile-window, sets this height
+    as new value of `ecb-compile-window-height' and displays the
+    compile-window.
+
+*** New option `ecb-change-layout-preserves-compwin-state'.
+    Changing the layout preserves now the state of the compile-window if this
+    option is not nil. This is for example useful if the user toggles between
+    several layouts and wants to preserve the hidden-state of the
+    compile-window. Thanks to John S. Yates, Jr. <john@yates-sheets.org> for
+    suggestion.
+
+*** Adviced `delete-window' and `delete-other-windows' handle compile-window.
+    The former one hides the compile-window if called in or for that window
+    whereas the latter one hides the compile-window if called in or for an
+    unsplitted edit-window. Thanks to John S. Yates, Jr.
+    <john@yates-sheets.org> for the suggestion.
+
+** New option `ecb-activation-selects-ecb-frame-if-already-active'.
+   See the docstring for more details. Thanks for suggestion to Jeff Jensen
+   <jeffjensen@nospam.visi.com>
+
+** The command `ecb-redraw-layout' can be called with prefix-argument(s).
+   Called with ONE prefix-argument the command behaves as with ECB-versions <
+   2.20, i.e. redrawing the full layout regardless of the current
+   visibility-state of the ecb-windows or the compile-window. Called without a
+   prefix-arg this command now preserves the state of the ecb-windows as well
+   as the state of the compile-window. Called with TWO prefix-args means an
+   emergence-redraw (see documentation of `ecb-redraw-layout').
+
+** New command `ecb-display-news-for-upgrade'.
+   ECB autom. displays after an upgrade a short summary of the most important
+   NEWS. With the new command you can do this also on demand.
+      
+** Fixed Bugs
+
+*** Adviced `display-buffer' handles `same-window-buffer-names' and
+    `same-window-regexps' correctly.
+
+*** Fixed a bug preventing tree-buffers with expand-symbol "before" to work
+
+*** Fixed a bug in the adviced version of `other-window'.
+    Now it works correctly also when a durable compile-window is set but
+    currently hidden.
+
+*** Fixed a bug when scrolling a window from within the minibuffer.
+    For example this bug has prevented scrolling the *Completion* buffer from
+    within the minibuffer. Now `minibuffer-scroll-window' is set correctly.
+
+*** Toggling the compile-window has not worked when `ecb-compile-window-height'
+    has not been saved for future sessions. This is fixed now.
+
+*** `ecb-cycle-through-compilation-buffers' works with hidden compile-window.
+
+*** Fixed a bug when an ECB-window was maximized and the user has stored sizes
+    for this layout.
+
+*** Fixed a bug in `ecb-major-modes-activate' and `ecb-major-modes-deactivate'
+
+*** Fixed a bug in the handling of the option `ecb-kill-buffer-clears-history'
+
+*** Fixed a bug which prevents some older version of XEmacs 21.4 working well.
+    For XEmacs 21.4.6 a bug was reported which causes this XEmacs-version to
+    fail when `compile' or `grep' is called. The reason for this was that
+    these old versions of XEmacs 21.4 contain versions of `display-buffer'
+    and/or `get-frame-for-buffer' which do not have the fourth argument
+    SHRINK-TO-FIT. Now ECB has fixed this and handles correctly the option
+    `temp-buffer-shrink-to-fit' and all shades of displaying and compiling
+    buffers even for these versions of XEmacs.
+
+    
+
 * Changes for ECB version 2.11
 
 ** Using semanticdb to jump to type-tags defined in other files.
-README for the Emacs Code Browser (ECB) version 2.11
+README for the Emacs Code Browser (ECB) version 2.20
 
 
 About
 - Optional: If Java code is edited the ECB works best when the JDEE package
   (http://sunsite.auc.dk/jde) is installed.
 
-If you use XEmacs you must have the packages fsf-compat (contains overlay.el)
-and c-support (contains hideshow.el) installed. If you want to read the
-online-help of ECB in HTML-format you must have the library browse-url (part
-of the mail-lib XEmacs package) installed; this package is also needed for
-submitting problem-reports to the ECB-maintainers!
+If you use XEmacs you must have installed the package c-support (contains
+hideshow.el). If you want to read the online-help of ECB in HTML-format you
+must have the library browse-url (part of the mail-lib XEmacs package)
+installed; this package is also needed for submitting problem-reports to the
+ECB-maintainers!
 
 
 Using the beta of cedet 1.0 (contains semantic 2.0)
 
 Call "M-x ecb-activate" to activated ECB.
 
+Call "M-x ecb-customize-most-important" to get a list of the most important
+options of ECB. These are options you should at least know that they exist.
+
 Call "M-x ecb-show-help" to get a detailed online-help for ECB. If you are
 using ECB the first time you should read the online help accurately!
 
-This file contains some important release-notes for ECB version 2.11
+This file contains some important release-notes for ECB version 2.20
 
 General:
 --------
 No special notes beyond the contents of README.
 
 
+Upgrading from any version:
+---------------------------
+
+All user-defined extensions written for and added to one of the options
+`ecb-directories-menu-user-extension', `ecb-sources-menu-user-extension',
+`ecb-methods-menu-user-extension' or `ecb-history-menu-user-extension' MUST be
+rewritten and redefined via the new macro `tree-buffer-defpopup-command'!
+
+The option `ecb-primary-mouse-jump-destination' has been renamed to
+`ecb-mouse-click-destination' and has also changed its default value to
+'last-point.
+
+The option `ecb-split-edit-window' has been renamed in
+`ecb-split-edit-window-after-start'. In addition the value t is not allowed
+anymore for this option - use 'before-activation instead. In a further
+addition this option has a new default value 'before-deactivation. See the
+docstring of this option to get all details.
+
+The Option `ecb-other-window-jump-behavior' has been renamed to
+`ecb-other-window-behavior'.
+
+ ECB autom. upgrades your old settings to the new option types/names!
+
+    
+Upgrading from versions < 2.11:
+-------------------------------
+
+The type of the option `ecb-post-process-semantic-taglist' has been changed.
+ECB autom. upgrades the old-value of that option to the new type! There is
+nothing to do for you. 
+
+
 Upgrading from versions < 2.01:
 -------------------------------
 
-;;; ecb-buffertab.el --- 
-
-;; $Id$
-
-;; Copyright (C) 2000-2003 Free Software Foundation, Inc.
-;; Copyright (C) 2000-2003 Kevin A. Burton (burton@openprivacy.org)
-
-;; Author: Kevin A. Burton (burton@openprivacy.org)
-;; Maintainer: Kevin A. Burton (burton@openprivacy.org)
-;; Location: http://relativity.yi.org
-;; Keywords: 
-;; Version: 1.0.0
-
-;; This file is [not yet] part of GNU Emacs.
-
-;; This program is free software; you can redistribute it and/or modify it under
-;; the terms of the GNU General Public License as published by the Free Software
-;; Foundation; either version 2 of the License, or any later version.
-;;
-;; This program is distributed in the hope that it will be useful, but WITHOUT
-;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-;; FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
-;; details.
-;;
-;; You should have received a copy of the GNU General Public License along with
-;; this program; if not, write to the Free Software Foundation, Inc., 59 Temple
-;; Place - Suite 330, Boston, MA 02111-1307, USA.
-
-;;; Commentary:
-
-;; NOTE: If you enjoy this software, please consider a donation to the EFF
-;; (http://www.eff.org)
-
-;;; Code:
-
-;;; TODO: make sure we don't do this TOO many times.
-;;
-;; - we need to define a property with 'local-map set correctly.
-;;
-;; - write a function that generates a popup menu
-;;
-;; - the popup menu should allow the user to check a buffer view to set it as
-;;   the default when opening new files.
-;;
-;;   - is this possible?  I think it might but I would need to set it up
-;;   correctly.
-
-(require 'ecb-compilation)
-
-(defface ecb-buffertab-face '((t (:bold t :foreground "lightyellow")))
-  "Face used to highlight the annotation lines to the left of the annotate buffer.")
-
-(defcustom ecb-buffertab-map (make-sparse-keymap)
-  "Key map used for buffertab navigation")
-
-(define-key ecb-buffertab-map [mode-line down-mouse-1] 'ecb-buffertab-popup-menu)
-
-(defun ecb-buffertab-popup-menu()
-  ""
-  (interactive)
-  
-  (popup-menu (ecb-buffertab-make-menu "Compilation Buffers")))
-
-(defun ecb-buffertab-make-menu(name)
-  "Make a menu for use on the buffertab."
-
-  (let((menu (list 'keymap name)))
-
-    (dolist(entry (ecb-compilation-get-buffers))
-
-      (add-to-list 'menu (list 'menu-item 'menu-item (car entry) (car entry)) t))
-
-    menu))
-
-(defun ecb-buffertab-setup-modeline()
-  ""
-  (interactive)
-
-  (let((modeline-tab ""))
-
-    ;;FIXME: figure out what modeline tab to use
-    (setq modeline-tab "   ECB: ")
-
-    (set-text-properties 0 (length modeline-tab) (list 'local-map ecb-buffertab-map
-                                                       'face 'ecb-buffertab-face) modeline-tab)
-
-    (setq mode-line-format modeline-tab)))
-
-(provide 'ecb-buffertab)
-
-;;; ecb-buffertab.el ends here

ecb-compatibility.el

+;;; ecb-compatibility.el --- ECB-compatibility for other packages
+
+;; Copyright (C) 2000 - 2003 Jesper Nordenberg,
+;;                           Klaus Berndl,
+;;                           Kevin A. Burton,
+;;                           Free Software Foundation, Inc.
+
+;; Author: Klaus Berndl <klaus.berndl@sdm.de>
+;; Maintainer: Klaus Berndl <klaus.berndl@sdm.de>
+;;             Kevin A. Burton <burton@openprivacy.org>
+;; Keywords: browser, code, programming, tools
+;; Created: 2004
+
+;; This program is free software; you can redistribute it and/or modify it under
+;; the terms of the GNU General Public License as published by the Free Software
+;; Foundation; either version 2, or (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful, but WITHOUT
+;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+;; FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
+;; details.
+
+;; You should have received a copy of the GNU General Public License along with
+;; GNU Emacs; see the file COPYING.  If not, write to the Free Software
+;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+;; $Id$
+
+;;; Commentary:
+;;
+;; Contains compatibility-code for other-packages.
+;;
+;; Whenever commands of other packages are not fully compatible with ECB then
+;; this library should contain the necessary code to make it fully compatible
+;; - or at least working acceptable.
+;;
+;; This file is part of the ECB package which can be found at:
+;; http://ecb.sourceforge.net
+
+(eval-when-compile
+  (require 'silentcomp))
+
+
+(require 'ecb-util)
+(require 'ecb-layout)
+
+;; To add compatibilty code for packages just do:
+;;
+;; 1. Add the needed advice(s) to `ecb-compatibility-advices'
+;; 2. Add the advice-code below.
+;;
+;; All advices of `ecb-compatibility-advices' will be autom. enabled when ECB
+;; starts and autom. disabled when ECB shuts down.
+
+(defvar ecb-compatibility-advices '((bs-show . before))
+  "Contains all advices needed for package-compatibility.")
+
+(defadvice bs-show (before ecb)
+  "Ensures `bs-show' works well when called from another window as an
+edit-window. Does nothing if called in another frame as the `ecb-frame'."
+  (when (equal (selected-frame) ecb-frame)
+    (unless (ecb-point-in-edit-window)
+      (ecb-select-edit-window))
+    ;; now we handle if bs-show should always display in the compile-window
+    (let ((my-bs-buffer (get-buffer-create "*buffer-selection*")))
+      ;; ecb-compilation-buffer-p needs a living buffer!
+      (if (and (ecb-compilation-buffer-p my-bs-buffer)
+               ecb-compile-window-height)
+          (ecb-with-adviced-functions
+           (display-buffer (buffer-name my-bs-buffer)))))))
+
+
+
+;; we disable the advices at load-time
+(ecb-disable-advices ecb-compatibility-advices)
+
+(silentcomp-provide 'ecb-compatibility)
+
+;;; ecb-compatibility.el ends here

ecb-compilation.el

 not be the result of a real `compile-internal'. A good example would be the
 *Help* buffer.
 
-BUFFER-OR-NAME can be the name of a buffer or a buffer-object.
+BUFFER-OR-NAME can be the name of a living\(!) buffer or a buffer-object.
 
 This function returns the buffer-object of BUFFER-OR-NAME - i.e.
 BUFFER-OR-NAME will be treated as compilation-buffer - if:
 ;; can slow down Emacs/ECB dramatically. Now we add an idle-times
 ;; check-function `ecb-compilation-buffer-list-changed-p' which checks if the
 ;; buffer-list has changed. If yes, then the variable
-;; `ecb-compilation-update-menu-p' is set to t. Only if this variable if not
+;; `ecb-compilation-update-menu-p' is set to t. Only if this variable is not
 ;; nil the menu-bar-update-hook `ecb-compilation-update-menu' updates the
 ;; ECB-menu.
 

ecb-create-layout.el

 (defun ecb-create-layout-split-ver (&optional fraction)
   (let ((factor (or fraction
                     (/ (float (count-lines (window-start) (point)))
-                       (float (- (window-height) 2))))))
+                       (float (- (ecb-window-full-height) 2))))))
     (ecb-split-ver factor t)
     (ecb-create-layout-gen-lisp `(ecb-split-ver ,factor t))
     factor))
   (switch-to-buffer (generate-new-buffer ecb-create-layout-buf-prefix))
   (erase-buffer)
   (unless do-not-fill
-    (dotimes (i (window-height))
+    (dotimes (i (ecb-window-full-height))
       (insert
        (format "%s\n"
                (make-string (- (window-width)
 Afterwards always the compile-window of ECB is selected."
 
   (interactive "P")
-  (if (not (numberp (car (get 'ecb-compile-window-height 'saved-value))))
+  (if (not (numberp ecb-compile-window-height))
       (ecb-error "This command needs a durable compile window!")
     (if choose-buffer
         (ecb-with-adviced-functions
                                             (ecb-compilation-get-buffers))))
       
       (let* ((compilation-buffers (ecb-compilation-get-buffers))
-             ;; This works even if ecb-compile-window is nil (means temporally
-             ;; hidden) --> then current-buffer is the buffer of the currently
-             ;; selected window!
-             (current-buffer (window-buffer ecb-compile-window))
+             ;; This works even if ecb-compile-window is nil or not alive
+             ;; (means temporally hidden) --> then current-buffer is the
+             ;; buffer of the currently selected window!
+             (current-buffer (or (and (ecb-compile-window-live-p)
+                                      (window-buffer ecb-compile-window))
+                                 (current-buffer)))
              (current-buffer-name (buffer-name current-buffer))
              (current nil)
              (index nil))
                                 (regexp-quote eshell-buffer-name)
                                 ".*")
                         t)))
-    (if (or ecb-compile-window-height
-            (numberp (car (get 'ecb-compile-window-height 'saved-value))))
+    (if ecb-compile-window-height
         (progn
           (add-to-list 'ecb-compilation-buffer-names-internal new-elem)
           (add-to-list 'ecb-compilation-major-modes-internal 'eshell-mode))
             (delete 'eshell-mode ecb-compilation-major-modes-internal))))
   
   ;; maybe we have to auto toggle our compile-window if temporally hidden
-  (when (and (numberp (car (get 'ecb-compile-window-height 'saved-value)))
-             (not (ecb-compile-window-live-p)))
+  (when (equal 'hidden (ecb-compile-window-state))
     (ecb-layout-debug-error "eshell around-advice: comp-win will be toggled.")
     (ecb-toggle-compile-window 1))
 

ecb-file-browser.el

 Each path can have an optional alias that is used as it's display name. If no
 alias is set, the path is used as display name."
   :group 'ecb-directories
+  :group 'ecb-most-important
   :initialize 'custom-initialize-default
   :set (function (lambda (symbol value)
 		   (set symbol value)
 Please note: If you want your home-dir being cached then you MUST NOT use
 \"~\" because ECB tries always to match full path-names!"
   :group 'ecb-directories
+  :group 'ecb-most-important
   :type `(repeat (cons (regexp :tag "Directory-regexp")
                        (integer :tag "Filenumber threshold" :value 1000))))
 
 Tips for the directory- and file-regexps: \"$^\" matches no files/directories,
 \".*\" matches all files/directories."
   :group 'ecb-sources
+  :group 'ecb-most-important
   :type '(repeat (cons :tag "Directory file-spec"
                        (regexp :tag "Directory regexp")
                        (choice :tag "Files to display"
                 (const :tag "File name"
                        :value file-name)))
 
-
 (defcustom ecb-directories-menu-user-extension
   '(("Version Control"
      (ecb-dir-popup-cvs-status "CVS Status" )
      (ecb-dir-popup-cvs-examine "CVS Examine")
      (ecb-dir-popup-cvs-update "CVS Update")))
-  "*User extensions for the popup-menu of the directories buffer.
+  "*Static user extensions for the popup-menu of the directories buffer.
 Value is a list of elements of the following type: Each element defines a new
 menu-entry and is either:
 
 a) Menu-command: A list containing two sub-elements, whereas the first is the
-   function \(a function symbol or a lambda-expression) being called if the
-   menu-entry is selected and the second is the name of the menu-entry.
+   function \(a function symbol) being called if the menu-entry is selected
+   and the second is the name of the menu-entry.
 b) Separator: A one-element-list and the element is the string \"---\": Then a
    non-selectable menu-separator is displayed.
 c) Submenu: A list where the first element is the title of the submenu
    displayed in the main-menu and all other elements are either menu-commands
    \(see a) or separators \(see b).
 
-The function of a menu-command must follow the following guidelines:
-It takes one argument which is the tree-buffer-node of the selected node \(means
-the node for which the popup-menu has been opened). With the function
-`tree-node-get-data' the related data of this node is accessible and returns
-in case of the directories buffer the directory for which the popup-menu has
-been opened. The function can do any arbitrary things with this directory.
+The function of a menu-command must follow the following guidelines: Such a
+function must be defined with the macro `tree-buffer-defpopup-command! This
+macro defines a new popup-command whereas the newly defined command gets one
+argument NODE. See the docstring of `tree-buffer-defpopup-command' for further
+details.
 
-Example for such a menu-function:
+Example for the definition of such a popupmenu-command:
 
-\(defun ecb-my-special-dir-popup-function \(node)
+\(tree-buffer-defpopup-command ecb-my-special-dir-popup-function
+  \"Prints the name of the directory of the node under point.\"
   \(let \(\(node-data=dir \(tree-node-get-data node)))
      \(message \"Dir under node: %s\" node-data=dir)))
 
-Per default the user-extensions are added at the beginning of the built-in
-menu-entries of `ecb-directories-menu' but the whole menu can be re-arranged
-with `ecb-directories-menu-sorter'.
+Per default the static user-extensions are added at the beginning of the
+built-in menu-entries of `ecb-directories-menu' but the whole menu can be
+re-arranged with `ecb-directories-menu-sorter'.
 
-If you change this option you have to restart ECB to take effect."
+These menu-extensions are static. A dynamic menu-extension can be achieved via
+`ecb-directories-menu-user-extension-function'."
   :group 'ecb-directories
   :type '(repeat (choice :tag "Menu-entry" :menu-tag "Menu-entry"
                          :value (ignore "")
                                                                :value ignore)
                                                      (string :tag "Entry-name"))))))))
 
+(defcustom ecb-directories-menu-user-extension-function nil
+  "*Dynamic user extensions for the popup-menu of the directories buffer.
+A function which has to return a list in the same format like the option
+`ecb-directories-menu-user-extension'. This function is called when the user
+opens the popup-menu for the directories buffer.
+
+Per default the dynamic user-extensions are added in front of the static
+extensions of `ecb-directories-menu-user-extension' but the whole menu can be
+re-arranged with `ecb-directories-menu-sorter'."
+  :group 'ecb-directories
+  :type 'function)
 
 (defcustom ecb-sources-menu-user-extension
   '(("Version control"
      (ecb-file-popup-vc-log "Revision history")
      (ecb-file-popup-vc-annotate "Annotate")
      (ecb-file-popup-vc-diff "Diff against last version")))
-  "*User extensions for the popup-menu of the sources buffer.
+  "*Static user extensions for the popup-menu of the sources buffer.
 For further explanations see `ecb-directories-menu-user-extension'.
 
 The node-argument of a menu-function contains as data the filename of the
 source for which the popup-menu has been opened.
 
-Per default the user-extensions are added at the beginning of the built-in
-menu-entries of `ecb-sources-menu' but the whole menu can be re-arranged
-with `ecb-sources-menu-sorter'.
-
-If you change this option you have to restart ECB to take effect."
+Per default the static user-extensions are added at the beginning of the
+built-in menu-entries of `ecb-sources-menu' but the whole menu can be
+re-arranged with `ecb-sources-menu-sorter'."
   :group 'ecb-sources
   :type '(repeat (choice :tag "Menu-entry" :menu-tag "Menu-entry"
                          :value (ignore "")
                                                                :value ignore)
                                                      (string :tag "Entry-name"))))))))
 
+(defcustom ecb-sources-menu-user-extension-function nil
+  "*Dynamic user extensions for the popup-menu of the sources buffer.
+A function which has to return a list in the same format like the option
+`ecb-sources-menu-user-extension'. This function is called when the user
+opens the popup-menu for the sources buffer.
+
+Per default the dynamic user-extensions are added in front of the static
+extensions of `ecb-sources-menu-user-extension' but the whole menu can be
+re-arranged with `ecb-sources-menu-sorter'."
+  :group 'ecb-sources
+  :type 'function)
 
 (defcustom ecb-history-menu-user-extension
   '(("Version control"
      (ecb-file-popup-vc-log "Revision history")
      (ecb-file-popup-vc-annotate "Annotate")
      (ecb-file-popup-vc-diff "Diff against last version")))
-  "*User extensions for the popup-menu of the history buffer.
+  "*Static user extensions for the popup-menu of the history buffer.
 For further explanations see `ecb-directories-menu-user-extension'.
 
 The node-argument of a menu-function contains as data the filename of the
 source for which the popup-menu has been opened.
 
-Per default the user-extensions are added at the beginning of the built-in
-menu-entries of `ecb-history-menu' but the whole menu can be re-arranged
-with `ecb-history-menu-sorter'.
-
-If you change this option you have to restart ECB to take effect."
+Per default the static user-extensions are added at the beginning of the
+built-in menu-entries of `ecb-history-menu' but the whole menu can be
+re-arranged with `ecb-history-menu-sorter'."
   :group 'ecb-history
   :type '(repeat (choice :tag "Menu-entry" :menu-tag "Menu-entry"
                          :value (ignore "")
                                                      (string :tag "Entry-name"))))))))
 
 
+(defcustom ecb-history-menu-user-extension-function nil
+  "*Dynamic user extensions for the popup-menu of the history buffer.
+A function which has to return a list in the same format like the option
+`ecb-history-menu-user-extension'. This function is called when the user
+opens the popup-menu for the history buffer.
+
+Per default the dynamic user-extensions are added in front of the static
+extensions of `ecb-history-menu-user-extension' but the whole menu can be
+re-arranged with `ecb-history-menu-sorter'."
+  :group 'ecb-history
+  :type 'function)
+
 (defcustom ecb-directories-menu-sorter nil
   "*Function which re-sorts the menu-entries of the directories buffer.
 If a function then this function is called to re-arrange the menu-entries of
        (tree-buffer-scroll (point-min) (point-min))))))
 
 
-(defun ecb-sources-filter-by-ext (node)
+(tree-buffer-defpopup-command ecb-sources-filter-by-ext
+  "Filter the sources by extension from popup."
   (let ((ext-str (read-string "Insert the filter-extension without leading dot: "
                               (and node
                                    (file-name-extension (tree-node-get-data node))))))
        (format "*.%s" ext-str)))))
        
   
-(defun ecb-sources-filter-by-regexp (node)
+(tree-buffer-defpopup-command ecb-sources-filter-by-regexp
+  "Filter the sources by regexp from popup."
   (let ((regexp-str (read-string "Insert the filter-regexp: ")))
     (if (> (length regexp-str) 0)
         (ecb-apply-filter-to-sources-buffer regexp-str))))
   
-(defun ecb-sources-filter-none (node)
+(tree-buffer-defpopup-command ecb-sources-filter-none
+  "Remove any filter from the sources by popup."
   (ecb-apply-filter-to-sources-buffer nil))
   
 
 displayed unless NO-EDIT-BUFFER-SELECTION is set to non nil. In such case
 the file is only loaded invisible in the background, all semantic-parsing
 and ECB-Buffer-updating is done but the content of the main-edit window
-is not changed."
+is not changed. For the allowed values of OTHER-EDIT-WINDOW see
+`ecb-combine-ecb-button/edit-win-nr'."
   (ecb-select-source-file filename)
   (if no-edit-buffer-selection
       ;; load the selected source in an invisible buffer, do all the
         (customize-save-variable 'ecb-source-path ecb-source-path)
       (customize-set-variable 'ecb-source-path ecb-source-path))))
 
-
-(defun ecb-add-source-path-node (node)
+(tree-buffer-defpopup-command ecb-add-source-path-node
+  "Runs `ecb-add-source-path' from popup."
   (call-interactively 'ecb-add-source-path))
 
 
-(defun ecb-node-to-source-path (node)
+(tree-buffer-defpopup-command ecb-node-to-source-path
+  "Add this node to the source-path."
   (ecb-add-source-path (tree-node-get-data node)))
 
 
       (cons (car sources) (ecb-delete-s child (cdr children) (cdr sources))))))
 
 
-(defun ecb-delete-source-path (node)
+(tree-buffer-defpopup-command ecb-delete-source-path
+  "Delete this source-path via popup."
   (let ((path (tree-node-get-data node)))
     (when (ecb-confirm (concat "Really delete source-path " path "?"))
       (setq ecb-source-path (ecb-delete-s
        (ecb-speedbar-update-contents)))
 
 
-(defun ecb-directory-clicked (node ecb-button shift-mode)
+(defun ecb-directory-clicked (node ecb-button edit-window-nr shift-mode)
+  "Handle clicking onto NODE in the directories-buffer. ECB-BUTTON can be 1, 2
+or 3. If 3 then EDIT-WINDOW-NR contains the number of the edit-window the NODE
+should be displayed. For 1 and 2 the value of EDIT-WINDOW-NR is ignored."
   (if (= 3 (tree-node-get-type node))
       (funcall (tree-node-get-data node))
-
     (ecb-update-directory-node node)
     (if shift-mode
         (ecb-mouse-over-directory-node node nil nil 'force))
            ;; Update the tree-buffer with optimized display of NODE
            (tree-buffer-update node)))
       (ecb-set-selected-source (tree-node-get-data node)
-			       (and (ecb-edit-window-splitted) (eq ecb-button 2))
+                               (ecb-combine-ecb-button/edit-win-nr ecb-button edit-window-nr)
 			       shift-mode))))
 
 
-(defun ecb-source-clicked (node ecb-button shift-mode)
+(defun ecb-source-clicked (node ecb-button edit-window-nr shift-mode)
+  "Handle clicking onto NODE in the sources-buffer. ECB-BUTTON can be 1, 2 or
+3. If 3 then EDIT-WINDOW-NR contains the number of the edit-window the NODE
+should be displayed. For 1 and 2 the value of EDIT-WINDOW-NR is ignored."
   (if shift-mode
       (ecb-mouse-over-source-node node nil nil 'force))
   (ecb-set-selected-source (tree-node-get-data node)
-			   (and (ecb-edit-window-splitted) (eq ecb-button 2))
+                           (ecb-combine-ecb-button/edit-win-nr ecb-button edit-window-nr)
 			   shift-mode))
 
 
-(defun ecb-history-clicked (node ecb-button shift-mode)
+(defun ecb-history-clicked (node ecb-button edit-window-nr shift-mode)
+  "Handle clicking onto NODE in the history-buffer. ECB-BUTTON can be 1, 2 or
+3. If 3 then EDIT-WINDOW-NR contains the number of the edit-window the NODE
+should be displayed. For 1 and 2 the value of EDIT-WINDOW-NR is ignored."
   (if shift-mode
       (ecb-mouse-over-history-node node nil nil 'force))
   (ecb-set-selected-source (tree-node-get-data node)
-			   (and (ecb-edit-window-splitted) (eq ecb-button 2))
-			   shift-mode))
-
+                           (ecb-combine-ecb-button/edit-win-nr ecb-button edit-window-nr)
+                           shift-mode))
 
 (defun ecb-expand-directory-nodes (level)
   "Set the expand level of the nodes in the ECB-directories-buffer.
 
 
 ;; needs methods
-(defun ecb-create-source (node)
+(tree-buffer-defpopup-command ecb-create-source
   "Creates a new sourcefile in current directory."
   (let* ((use-dialog-box nil)
          (dir (ecb-fix-filename
 
 
 (defun ecb-grep-directory-internal (node find)
-  (select-window (or ecb-last-edit-window-with-point ecb-edit-window))
+  (ecb-select-edit-window)
   (let ((default-directory (concat (ecb-fix-filename
                                     (if (file-directory-p
                                          (tree-node-get-data node))
                               'grep)))))
 
 
-(defun ecb-grep-find-directory (node)
+(tree-buffer-defpopup-command ecb-grep-find-directory
+  "Runs grep-find for current directory."
   (ecb-grep-directory-internal node t))
 
 
-(defun ecb-grep-directory (node)
+(tree-buffer-defpopup-command ecb-grep-directory
+  "Runs grep for current directory."
   (ecb-grep-directory-internal node nil))
 
 
   (tree-buffer-update))
 
 
-(defun ecb-delete-directory (node)
-  "Deletes current directory."
+(tree-buffer-defpopup-command ecb-delete-directory
+  "Delete current directory."
   (let ((dir (tree-node-get-data node)))
     (when (ecb-confirm (concat "Really delete directory" dir "? "))
       (delete-directory (tree-node-get-data node))
 
 
 (defun ecb-dired-directory-internal (node &optional other)
-  (if (not (ecb-edit-window-splitted))
-      (ecb-select-edit-window)
-    (select-window (or (and ecb-last-edit-window-with-point
-                            (window-live-p ecb-last-edit-window-with-point)
-                            ecb-last-edit-window-with-point)
-                       ecb-edit-window)))
+  (ecb-select-edit-window)
   (let ((dir (ecb-fix-filename
               (funcall (if (file-directory-p (tree-node-get-data node))
                            'identity
               dir))))
 
 
-(defun ecb-dired-directory (node)
+(tree-buffer-defpopup-command ecb-dired-directory
+  "Run dired for this directory."
   (ecb-dired-directory-internal node))
 
 
-(defun ecb-dired-directory-other-window (node)
+(tree-buffer-defpopup-command ecb-dired-directory-other-window
+  "Run dired for this directory in the other window."
   (ecb-dired-directory-internal node 'other))
 
 
     (funcall op dir op-arg-list)))
 
 
-(defun ecb-dir-popup-cvs-status (node)
+(tree-buffer-defpopup-command ecb-dir-popup-cvs-status
   "Check status of directory \(and below) in pcl-cvs mode."
   (ecb-dir-run-cvs-op node 'cvs-status '("-v")))
 
 
-(defun ecb-dir-popup-cvs-examine (node)
+(tree-buffer-defpopup-command ecb-dir-popup-cvs-examine
   "Examine directory \(and below) in pcl-cvs mode."
   (ecb-dir-run-cvs-op node 'cvs-examine '("-d" "-P")))
 
 
-(defun ecb-dir-popup-cvs-update (node)
+(tree-buffer-defpopup-command ecb-dir-popup-cvs-update
   "Update directory \(and below) in pcl-cvs mode."
   (ecb-dir-run-cvs-op node 'cvs-update '("-d" "-P")))
 
 function which is called with current node and has to return a string.")
 
 
+(tree-buffer-defpopup-command ecb-open-source-in-editwin1
+  "Open current source-file the 1. edit-window."
+  ;; We can use `ecb-source-clicked' for history-buffer too because shift-mode
+  ;; is nil.
+  (ecb-source-clicked node 3 1 nil))
+(tree-buffer-defpopup-command ecb-open-source-in-editwin2
+  "Open current source-file the 2. edit-window."
+  (ecb-source-clicked node 3 2 nil))
+(tree-buffer-defpopup-command ecb-open-source-in-editwin3
+  "Open current source-file the 3. edit-window."
+  (ecb-source-clicked node 3 3 nil))
+(tree-buffer-defpopup-command ecb-open-source-in-editwin4
+  "Open current source-file the 4. edit-window."
+  (ecb-source-clicked node 3 4 nil))
+(tree-buffer-defpopup-command ecb-open-source-in-editwin5
+  "Open current source-file the 5. edit-window."
+  (ecb-source-clicked node 3 5 nil))
+(tree-buffer-defpopup-command ecb-open-source-in-editwin6
+  "Open current source-file the 6. edit-window."
+  (ecb-source-clicked node 3 6 nil))
+(tree-buffer-defpopup-command ecb-open-source-in-editwin7
+  "Open current source-file the 7. edit-window."
+  (ecb-source-clicked node 3 7 nil))
+(tree-buffer-defpopup-command ecb-open-source-in-editwin8
+  "Open current source-file the 8. edit-window."
+  (ecb-source-clicked node 3 8 nil))
+
+(defun ecb-dir/source/hist-menu-editwin-entries ()
+  "Generate popup-menu-entries for each edit-window if there are at least 2
+edit-windows. Otherwise return nil."
+  (let ((edit-win-list (ecb-canonical-edit-windows-list))
+        (result nil))
+    (when (> (length edit-win-list) 1)
+      (dotimes (i (min 8 (length edit-win-list)))
+        (setq result
+              (append result
+                      (list (list (intern (format "ecb-open-source-in-editwin%d" (1+ i)))
+                                  (format "edit-window %d" (1+ i)))))))
+      (append (list (list "---")) ;; we want a separator
+              (list (append (list "Open source-file in ...")
+                            result))))))
+
+
+(defun ecb-directories-menu-creator (tree-buffer-name)
+  "Creates the popup-menus for the directories-buffer."
+  (setq ecb-layout-prevent-handle-ecb-window-selection t)
+  (let ((dyn-user-extension
+         (and (functionp ecb-directories-menu-user-extension-function)
+              (funcall ecb-directories-menu-user-extension-function)))
+        (dyn-builtin-extension (ecb-dir/source/hist-menu-editwin-entries)))
+    (list (cons 0 (funcall (or ecb-directories-menu-sorter
+                               'identity)
+                           (append dyn-user-extension
+                                   ecb-directories-menu-user-extension
+                                   ecb-directories-menu)))
+          (cons 1 (funcall (or ecb-sources-menu-sorter
+                               'identity)
+                           (append dyn-user-extension
+                                   ecb-sources-menu-user-extension
+                                   ecb-sources-menu
+                                   dyn-builtin-extension)))
+          (cons 2 (funcall (or ecb-directories-menu-sorter
+                               'identity)
+                           (append dyn-user-extension
+                                   ecb-directories-menu-user-extension
+                                   ecb-source-path-menu))))))
+
+
 (defvar ecb-source-path-menu nil
   "Built-in menu for the directories-buffer for directories which are elements of
 `ecb-source-path'.")
          (ecb-maximize-ecb-window-menu-wrapper "Maximize window"))))
 
 
-(defun ecb-delete-source (node)
+(tree-buffer-defpopup-command ecb-delete-source
   "Deletes current sourcefile."
   (let* ((file (tree-node-get-data node))
          (dir (ecb-fix-filename (file-name-directory file))))
       (ecb-set-selected-directory dir t))))
 
 
-(defun ecb-file-popup-ediff-revision (node)
+(tree-buffer-defpopup-command ecb-file-popup-ediff-revision
   "Diff file against repository with ediff."
   (let ((file (tree-node-get-data node)))
     (ediff-revision file)))
 
 
-(defun ecb-file-popup-vc-next-action (node)
+(tree-buffer-defpopup-command ecb-file-popup-vc-next-action
   "Checkin/out file."
   (let ((file (tree-node-get-data node)))
     (find-file file)
     (vc-next-action nil)))
 
 
-(defun ecb-file-popup-vc-log (node)
+(tree-buffer-defpopup-command ecb-file-popup-vc-log
   "Print revision history of file."
   (let ((file (tree-node-get-data node)))
     (find-file file)
     (vc-print-log)))
 
 
-(defun ecb-file-popup-vc-annotate (node)
+(tree-buffer-defpopup-command ecb-file-popup-vc-annotate
   "Annotate file"
   (let ((file (tree-node-get-data node)))
     (find-file file)
     (vc-annotate nil)))
 
 
-(defun ecb-file-popup-vc-diff (node)
+(tree-buffer-defpopup-command ecb-file-popup-vc-diff
   "Diff file against last version in repository."
   (let ((file (tree-node-get-data node)))
     (find-file file)
   "The menu-title for the sources menu. See
 `ecb-directories-menu-title-creator'.")
 
+(defun ecb-sources-menu-creator (tree-buffer-name)
+  "Creates the popup-menus for the sources-buffer."
+  (setq ecb-layout-prevent-handle-ecb-window-selection t)
+  (let ((dyn-user-extension
+         (and (functionp ecb-sources-menu-user-extension-function)
+              (funcall ecb-sources-menu-user-extension-function)))
+        (dyn-builtin-extension (ecb-dir/source/hist-menu-editwin-entries)))
+    (list (cons 0 (funcall (or ecb-sources-menu-sorter
+                               'identity)
+                           (append dyn-user-extension
+                                   ecb-sources-menu-user-extension
+                                   ecb-sources-menu
+                                   dyn-builtin-extension))))))
+
 ;; history popups
 
-(defun ecb-history-kill-buffer (node)
+(tree-buffer-defpopup-command ecb-history-kill-buffer
   "Kills the buffer for current entry."
   (let ((data (tree-node-get-data node)))
     (when (get-file-buffer data)
       (kill-buffer (get-file-buffer data)))))
 
-(defun ecb-history-filter-by-ext (node)
+(tree-buffer-defpopup-command ecb-history-filter-by-ext
+  "Filter history entries by extension."
   (let ((ext-str (read-string "Insert the filter-extension without leading dot: "
                               (and node
                                    (file-name-extension (tree-node-get-data node))))))
   (ecb-add-buffers-to-history))
        
   
-(defun ecb-history-filter-by-regexp (node)
+(tree-buffer-defpopup-command ecb-history-filter-by-regexp
+  "Filter history entries by regexp."
   (let ((regexp-str (read-string "Insert the filter-regexp: ")))
     (if (> (length regexp-str) 0)
         (setq ecb-history-filter
                     regexp-str))))
   (ecb-add-buffers-to-history))
   
-(defun ecb-history-filter-all-existing (node)
+(tree-buffer-defpopup-command ecb-history-filter-all-existing
+  "No history filter, i.e. add all existing file-buffers to the history."
   (ecb-add-all-buffers-to-history))
   
 
   "The menu-title for the history menu. See
 `ecb-directories-menu-title-creator'.")
 
+(defun ecb-history-menu-creator (tree-buffer-name)
+  "Creates the popup-menus for the history-buffer."
+  (setq ecb-layout-prevent-handle-ecb-window-selection t)
+  (let ((dyn-user-extension
+         (and (functionp ecb-history-menu-user-extension-function)
+              (funcall ecb-history-menu-user-extension-function)))
+        (dyn-builtin-extension (ecb-dir/source/hist-menu-editwin-entries)))
+    (list (cons 0 (funcall (or ecb-history-menu-sorter
+                               'identity)
+                           (append dyn-user-extension
+                                   ecb-history-menu-user-extension
+                                   ecb-history-menu
+                                   dyn-builtin-extension))))))
+
+
 (silentcomp-provide 'ecb-file-browser)
 
 ;;; ecb-file-browser.el ends here
 Note: If you got ECB as a standard XEmacs-package maybe the
 HTML-online-documentation is not included."
   :group 'ecb-help
+  :group 'ecb-most-important
   :type '(choice :tag "Online-help format" :menu-tag "Online-help format"
                  (const :tag "Info" :value info)
                  (const :tag "Html" :value html)))
           (insert "\n\n\n")
           (forward-line -2))
       (goto-char (point-max))
-      (insert "\n\n")) 
+      (insert "\n\n"))
+    ;; ecb-faces
+    (let ((ecb-face-list (delq nil (mapcar (function
+                                            (lambda (f)
+                                              (if (string-match "^ecb-"
+                                                                (symbol-name f))
+                                                  f
+                                                nil)))
+                                           (face-list)))))
+      (insert "\n\n-----------------------------------------------------\n")
+      (insert "The attributes of the ECB-faces are:\n\n")
+      (dolist (f ecb-face-list)
+        (when f
+          (insert (format "%s: %s\n"
+                          (symbol-name f)
+                          (funcall (if ecb-running-xemacs
+                                       'face-custom-attributes-get
+                                     'custom-face-attributes-get)
+                                   f ecb-frame)))))
+      (insert "\n-----------------------------------------------------\n\n"))
     (let* ((messages-buffer 
 	    (get-buffer
 	     (if ecb-running-xemacs " *Message-Log*" "*Messages*")))
                                          'jde-mode-hook)
                                     system-type
                                     window-system
+                                    max-specpdl-size
+                                    max-lisp-eval-depth
                                     ,(if (boundp 'ediff-quit-hook)
                                          'ediff-quit-hook)))
                           (function (lambda (l r)
                                    ecb-use-semantic-grouping
                                    ecb-idle-timer-alist
                                    ecb-post-command-hooks
+                                   ecb-max-specpdl-size-old
+                                   ecb-max-lisp-eval-depth-old
                                    ecb-minor-mode
-                                   ecb-toggle-layout-state)
+                                   ecb-last-window-config-before-deactivation
+                                   ecb-edit-area-creators
+                                   ecb-windows-hidden
+                                   ecb-toggle-layout-state
+                                   ecb-current-maximized-ecb-buffer-name
+                                   ecb-tree-buffers-of-current-layout)
                                  (function (lambda (l r)
                                              (string< (symbol-name l)
                                                       (symbol-name r)))))))
 (silentcomp-defun jde-open-find-java-file-name)
 (silentcomp-defun jde-gen-class-buffer)
 
-(silentcomp-defun end-of-thing)
-
 (require 'ecb-util)
 (require 'ecb-layout)
 (require 'ecb-file-browser)
              (equal major-mode 'jde-mode))
     (if (jde-open-functions-exist)
         (let* (
-               (thing-of-interest (thing-at-point 'symbol))
-               (pair (save-excursion (end-of-thing 'symbol)
+               (thing-of-interest (ecb-thing-at-point 'symbol))
+               (pair (save-excursion (ecb-end-of-thing 'symbol)
                                      (jde-parse-java-variable-at-point)))
                (class-to-open (jde-open-get-class-to-open
                                pair thing-of-interest))
 ;; 1. Now all user-layouting is done by customizing the new option
 ;;    `ecb-layout-name' or by the command `ecb-change-layout'. The function
 ;;    `ecb-redraw-layout' (formally known as 'ecb-set-layout) can still be
-;;    called interactively but without arguments because it does only a redraw
-;;    of the layout specified in `ecb-layout-name'. All changes to the layout
-;;    must be made by customizing this new option. Please read the very
-;;    detailed comment of `ecb-layout-name'!
+;;    called interactively. But it just redraws the layout specified in
+;;    `ecb-layout-name'. All changes to the layout must be made by customizing
+;;    this new option. Please read the very detailed comment of
+;;    `ecb-layout-name'!
 ;; 2. Adding new layouts is now much easier and more straightforward: We have
 ;;    now a main core-layout function (`ecb-redraw-layout-full') which is the
 ;;    "environment" for the specific "layout-functions". The core function
 ;;    command `ecb-create-new-layout'!
 ;;
 ;; Background-info: For each layout-type (ecb-windows left, right, top and
-;; left-right) there are two functions:
-;; - 'ecb-delete-other-windows-ecb-windows[left|right|top|left-right]' and
-;; - 'ecb-delete-window-ecb-windows[left|right|top|left-right]'.
+;; left-right) there is one function:
+;; 'ecb-delete-window-ecb-windows-[left|right|top|leftright]'.
 ;; These functions follow these guide-lines:
 ;; - Preconditions for these functions:
-;;   + the edit window is splitted
-;;   + The function gets one argument 'split' which can have the values
-;;     'horizontal and 'vertical.
-;;   + These functions are always(!) called with deactivated advice of
+;;   + the edit-area is splitted - at least in two edit-windows
+;;   + The function gets two arguments: The window to delete (if nil then the
+;;     current window has to be deleted) and the list of all current
+;;     edit-windows.
+;;   + These functions are always(!) called with deactivated advices of
 ;;     `delete-window' function.
-;; - What must they do:
-;;   1. Checking if the point is in one of the two parts of the splitted
-;;      edit-window. If in another window, do nothing and return nil.
-;;   2. Checking in which part of the splitted edit-window the point is.
-;;   3. Doing the appropriate action (e.g.
-;;      `ecb-delete-window-ecb-windows-left' must delete this half-part
-;;      of the splitted edit-window which contains the point, so the other
-;;      half-part fills the whole edit-window. If the split has been undone
-;;      then non nil must be returned! This action must be done appropriate
-;;      for the current ECB-layout type.
-;;   4. These functions can only use `delete-window' of the set of maybe
-;;      adviced window functions, because of a bug in advice.el only one
-;;      function�s advice can be deactivated within a advice itself!
+;;   + These functions can only use `delete-window' of the set of maybe
+;;     adviced window functions, because of a bug in advice.el only one
+;;     function�s advice can be deactivated within a advice itself!
+;; - What must they do: Doing the appropriate action (e.g.
+;;   `ecb-delete-window-ecb-windows-left' must delete the window. This action
+;;   must be done appropriate for the current ECB-layout type (see
+;;   postconditions)
 ;; - Postcondition of these functions:
-;;   + The edit-window must not be splitted and the point must reside in
-;;     the not deleted edit-window.
+;;   + The named edit-window must be deleted and all ecb-windows in the
+;;     ecb-frame must have the layout like before the delete.
+;;   + If the current window has been deleted then point must reside after
+;;     deletion in the next edit-window in a circular meaning (i.e. if the
+;;     last edit-window has been deleted, point must stay afterwards in the
+;;     first edit-window). If a window unequal the current window has been
+;;     deleted point must stay in the window before deletion at the same
+;;     place.
 ;;
 ;; New adviced intelligent window-functions as replacement for these originals:
 ;; - `other-window'
 ;; - `switch-to-buffer'
 ;; - `switch-to-buffer-other-window'
 ;; - `other-window-for-scrolling'
+;; - `balance-windows'
 ;; The behavior of the adviced functions is:
 ;; - All these function behaves exactly like their corresponding original
 ;;   functions but they always act as if the edit-window(s) of ECB would be the
 (silentcomp-defvar pre-display-buffer-function)
 (silentcomp-defvar split-width-threshold)
 (silentcomp-defvar split-width-threshold)
+(silentcomp-defun popup-menu-and-execute-in-window)
 ;; for the display-buffer stuff of XEmacs
 (silentcomp-defun last-nonminibuf-frame)
 (silentcomp-defun check-argument-type)
         (load-file ecb-create-layout-file))
     (setq ecb-layouts-reload-needed nil)))
 
-(defconst ecb-use-dedicated-windows t
-  "Use dedicated windows for the ECB buffers.")
-
 (defgroup ecb-layout nil
   "Settings for the screen-layout of the Emacs code browser."
   :group 'ecb
 	      (when (and (boundp 'ecb-minor-mode)
                          ecb-minor-mode
                          (frame-live-p ecb-frame))
-                (let ((curr-frame (selected-frame))
-                      (ecb-redraw-layout-quickly nil))
+                (let ((curr-frame (selected-frame)))
                   (unwind-protect
                       (progn
                         (select-frame ecb-frame)
 (defcustom ecb-new-ecb-frame nil
   "*Create a new frame at activation time of ECB."
   :group 'ecb-layout
+  :group 'ecb-most-important
   :type 'boolean)
 
 (defcustom ecb-activate-before-new-frame-created-hook nil
   :group 'ecb-layout
   :type 'hook)
 
-
 (defcustom ecb-layout-name "left8"
   "*Select a window layout of ECB.
 Value is any arbitrary string. There are four different types of layouts:
 left, right, top and left-right, which means the location of the
 ECB-tree-windows in the ECB-frame. Currently there are 20 predefined layouts;
-names the below. You can savely try out any of them by changing this value and
+names see below. You can savely try out any of them by changing this value and
 saving it only for the current session. If you are sure which layout you want
 you can save it for future sessions. To get a picture of the layout for name
 <name> call `ecb-show-layout-help'.
 changed the ECB-screen-layout by any action you can always go back to this
 layout with `ecb-redraw-layout'"
   :group 'ecb-layout
+  :group 'ecb-most-important
   :initialize 'custom-initialize-default
   :set (function (lambda (symbol value)
                    (ecb-load-layouts)
 
 If you do not set a durable compilation window then doing a compilation or
 displaying temp-buffers \(e.g. *Help*-buffers) splits temporally the edit
-window vertically if the edit window is not splitted already or uses the
-\"other\" edit window temporally for compilation output if the edit window is
-already splitted. This is the recommended value for this option because this
-is the standard-behavior of Emacs.
+window vertically if the edit window is not splitted already or uses another
+edit window temporally for compilation output if the edit window is already
+splitted. This is the recommended value for this option because this is the
+standard-behavior of Emacs.
 
 Beware: If you set a durable compilation window then ECB displays all buffers
 for which `ecb-compilation-buffer-p' returns not nil in that durable
 `ecb-enlarged-compilation-window-max-height' and also the command
 `ecb-toggle-compile-window-height'!
 
+ECB offers the functionality of such a durable compile-window regardless if
+the special ECB-windows are visible or not \(see the command
+`ecb-toggle-ecb-windows').
+
 Regardless of the settings you define here: If you have destroyed or
 changed the ECB-screen-layout by any action you can always go back to this
 layout with `ecb-redraw-layout'"
   :group 'ecb-compilation
+  :group 'ecb-most-important
   :initialize 'custom-initialize-default
+  ;; we can not use here ' ecb-layout-option-set-function' because here we
+  ;; must call `ecb-redraw-layout-full' with NO-ECB-WINDOWS depending on the
+  ;; value of `ecb-windows-hidden'! Same for `ecb-compile-window-width'. If
+  ;; this is necessary for other options too then we should
+  ;; `ecb-layout-option-set-function' to a function with an additional
+  ;; parameter which decides if ecb-window-hidden should be used for
+  ;; NO-ECB-WINDOWS or not.
   :set (function (lambda (symbol value)
                    (ecb-set-window-size-fixed nil)
-                   (funcall ecb-layout-option-set-function
-                            symbol value)))
+                   (set symbol value)
+                   ;; we must check this because otherwise the layout would be
+                   ;; drawn if we have changed the initial value regardless if
+                   ;; ECB is activated or not.
+                   (when (and (boundp 'ecb-minor-mode)
+                              ecb-minor-mode
+                              (frame-live-p ecb-frame))
+                     (let ((curr-frame (selected-frame)))
+                       (unwind-protect
+                           (progn
+                             (select-frame ecb-frame)
+                             (ecb-redraw-layout-full nil nil nil
+                                                     ecb-windows-hidden))
+                         (select-frame curr-frame))))))
   :type '(radio (const :tag "No compilation window" nil)
                 (number :tag "Window height" :value 6)))
 
 
 This option takes only effect if `ecb-compile-window-height' is not nil!"
   :group 'ecb-compilation
+  :group 'ecb-most-important
   :initialize 'custom-initialize-default
   :set (function (lambda (symbol value)
-                   (funcall ecb-layout-option-set-function
-                            symbol value)))
+                   (ecb-set-window-size-fixed nil)
+                   (set symbol value)
+                   ;; we must check this because otherwise the layout would be
+                   ;; drawn if we have changed the initial value regardless if
+                   ;; ECB is activated or not.
+                   (when (and (boundp 'ecb-minor-mode)
+                              ecb-minor-mode
+                              (frame-live-p ecb-frame))
+                     (let ((curr-frame (selected-frame)))
+                       (unwind-protect
+                           (progn
+                             (select-frame ecb-frame)
+                             (ecb-redraw-layout-full nil nil nil
+                                                     ecb-windows-hidden))
+                         (select-frame curr-frame))))))
   :type '(radio (const :tag "Width of ECB-frame" :value frame)
                 (const :tag "Width of edit-window" :value edit-window)))
 
+(defcustom ecb-change-layout-preserves-compwin-state t
+  "*Changing the layout preserves the state of the compile-window.
+This is for example useful if the user toggles between several layouts \(see
+`ecb-toggle-layout') and wants to preserve the hidden-state of the
+compile-window."
+  :group 'ecb-compilation
+  :type 'boolean)
+
 (defcustom ecb-compile-window-temporally-enlarge 'after-display
   "*Let Emacs temporally enlarge the compile-window of the ECB-layout.
 This option has only an effect if `ecb-compile-window-height' is not nil!
 To restore the ECB-layout after such a buffer-enlarge just call
 `ecb-toggle-compile-window-height' or `ecb-redraw-layout'."
   :group 'ecb-compilation
-  :initialize 'custom-initialize-default
-  :set ecb-layout-option-set-function
   :type '(radio (const :tag "After displaying a buffer in the compile-window"
                        :value after-display)
                 (const :tag "After selecting the compile window"
                        :value half)
                 (number :tag "Height" :value 0.3)))
 
+(defcustom ecb-scroll-other-window-scrolls-compile-window nil
+  "*`scroll-other-window' scrolls always the compile-window.
+For all details about the scroll-behavior of `scroll-other-window' see the
+advice documentation of `other-window-for-scrolling'."
+  :group 'ecb-compilation
+  :type 'boolean)
+
 (defcustom ecb-ignore-special-display 'compile-window
   "*Ignore special-display-handling.
 This means, that all values of `special-display-function',
 (defsubst ecb-ignore-special-display ()
   (or (equal ecb-ignore-special-display 'always)
       (and (equal ecb-ignore-special-display 'compile-window)
-           (numberp (car (get 'ecb-compile-window-height 'saved-value))))))
-
-(defcustom ecb-split-edit-window t
-  "*Sets how and if the edit window should be splitted.
-But be aware: This option determines only if the edit-window should be
-splitted at start-time of ECB."
+           ecb-compile-window-height)))
+
+(defcustom ecb-ignore-display-buffer-function 'always
+  "*Adviced `display-buffer' ignores `display-buffer-function'.
+This means, that the adviced version of `display-buffer' \(see
+`ecb-advice-window-functions') ignores the value of `display-buffer-function'
+when called for the `ecb-frame'. If this variable should not be ignored then
+the function of `display-buffer-function' is completely responsible which
+window is used for the buffer to display - no smart ECB-logic will help to
+deal best with the ECB-window-layout! You can define if and when
+`display-buffer-function' should be ignored:
+- only when durable compile window is used - i.e. if
+  `ecb-compile-window-height' is not nil
+- always when ECB is active - that means ignore when ECB is active otherwise
+  not - this is the default value
+- never, the adviced version of `display-buffer' always uses the value of
+  `display-buffer-function' if the value is a function."
   :group 'ecb-layout
-  :type '(radio (const :tag "Split as before ECB-start" :value t)
+  :type '(radio (const :tag "When a durable compile-window is used"
+                       :value compile-window)
+                (const :tag "Always" :value always)
+                (const :tag "Never" nil)))
+
+(defsubst ecb-ignore-display-buffer-function ()
+  (or (equal ecb-ignore-display-buffer-function 'always)
+      (and (equal ecb-ignore-display-buffer-function 'compile-window)
+           ecb-compile-window-height)))
+
+(defcustom ecb-split-edit-window-after-start 'before-deactivation
+  "*Sets how and if the edit window should be splitted after ECB-start.
+But be aware: This option determines only if and how the edit-window should be
+splitted at start-time of ECB. There are five different values allowed for
+this option:
+- nil: Do not split the edit-area of ECB after activation, i.e. there will be
+  only one edit-window after starting ECB.
+- 'horizontal: Split the edit-area in 2 edit-windows side by side.
+- 'vertical: Split the edit-area in 2 edit-windows, one above the other.
+- 'before-activation: Split the edit-area as before the ECB-start, i.e. the
+  edit-area will have after start a window-layout as the whole frame had
+  before the start of ECB.
+- 'before-deactivation: Split the edit-area into a window-layout ECB had in
+  its edit-area direct before the ECB-deactivation. This value preserves the
+  full state between activations of ECB, i.e. the visibility of the
+  ECB-windows, the visibility of a compile-window and also the full
+  split-state of the edit-area. But this can only be done if important
+  layout-options have not been changed in the meanwhile. These are the options
+  `ecb-layout-name', `ecb-compile-window-height', `ecb-compile-window-width',
+  `ecb-windows-width' and `ecb-windows-height'.
+
+Default value is 'before-deactivation.
+
+Some remarks to the value 'before-activation: If this value has been set then
+ECB needs four permanent adivces even when ECB is deactivated: `split-window',
+`delete-window', `delete-other-windows' and `set-window-configuration'. But
+these advices do not change any behavior of these functions but only storing
+in an internal ECB-variable the facts that a window has been splitted or
+deleted etc. In addition to this these advices are 100% error-save, means the
+functionality of the original functions will be performed in every\(!) case
+even if within the advice an error occurs \(but normally there can no errors
+occur in these advices because they are very simple). Conclusion: If you want
+really all ECB-advices being disabled after deactivating ECB then you have to
+set this option to other values then 'before-activation. But setting this
+variable to this value is really completely save."
+  :group 'ecb-layout
+  :type '(radio (const :tag "Split as before ECB-start"
+                       :value before-activation)
+                (const :tag "Split as before last ECB-deactivation"
+                       :value before-deactivation)
                 (const :tag "Split horizontally"
                        :value horizontal)
                 (const :tag "Split vertically"
                                       nil
                                     fix)))))))
 
-
 (defmacro ecb-do-with-unfixed-ecb-buffers (&rest body)
   "Evaluate BODY with unfixed size of all current-visible ecb-buffers and
 ensure that at the end \(either after finishing of BODY or after an error
      (ecb-set-window-size-fixed (ecb-get-window-fix-type ecb-layout-name))))
 
 
-(defcustom ecb-other-window-jump-behavior 'all
-  "*Which windows of ECB should be accessible by the command `other-window'.
-This has an effect if `other-window' is adviced by ECB, see
-`ecb-advice-window-functions'. The following settings are possible:
-- 'all: ECB will cycle through all windows of ECB, means it behaves like the
-  original `other-window'.
-- 'only-edit: ECB will only cycle through the \(max. 2) edit-windows of ECB.
-- 'edit-and-compile: Like 'only-edit plus the compile window if any."
+
+(defcustom ecb-other-window-behavior 'smart
+  "*The behavior of ECB concerning getting an \"other window\".
+This has an effect if either `other-window' or `other-window-for-scrolling' is
+adviced by ECB, see `ecb-advice-window-functions'. The following settings are
+possible:
+
+'all:
+
+ECB will cycle through all windows of the ECB-frame or scroll simply
+the next window in the ECB-frame, means it behaves like the original
+`other-window' rsp. the original `other-window-for-scrolling'.
+
+'only-edit:
+
+ECB will only cycle through the edit-windows of ECB or only
+scroll another edit-window. If the selected window is not an edit-window
+then it behaves like with value 'all.
+
+'edit-and-compile:
+
+Like 'only-edit plus the compile window if any. If the
+selected window is neither an edit-window nor the compile-window then it
+behaves like with value 'all.
+
+'smart:
+
+With this setting ECB tries to choose the `other-window'-destination or the
+\"other window\" to scroll in a smart and intuitive way: If point is in one of
+the edit-windows and if the edit-area is splitted then always the \"next\"
+edit-window is choosen \(whereas the next edit-window of the last edit-window
+is the first edit-window)- if the edit-area is unsplitted then the
+compile-window is used if there is one. In the context of an
+`other-window'-call the ARG of `other-window' will be taken into account.
+
+If one of the special ecb-windows is selected then always the \"next\"
+ecb-window is choosen \(whereas the next ecb-window of the last ecb-window is
+the first ecb-window). In the context of an `other-window'-call the ARG of
+`other-window' will be taken into account.
+
+If the compile-window is selected then always the last selected edit-window
+will be used unless `other-window' has been called with a prefix-argument
+unequal 1.
+
+If there is an active minibuffer:
+
+Regardless of the allowed values above ECB handles the situation of an active
+minibuffer during a call to `other-window' or `scroll-other-window' like
+follows:
+
+If the minibuffer-window is selected then ECB always chooses the window
+`minibuffer-scroll-window' points to \(when this variable is set, otherwise
+the compile-window or the last selected edit-window is choosen) when the
+called command is called to choose the 1. next window \(always true for
+scrolling another window or true when `other-window' called without prefix-arg
+or with prefix-arg equal 1). Otherwise the window ARG steps away is choosen
+\(in case of `other-window).
+
+If there is an active minibuffer but the minibuffer-window is not selected
+then `other-window' and `scroll-other-window' behave like the original
+version.
+
+In addition to the allowed values above the value of this option can also be a
+function:
+
+This function gets seven arguments:
+1. A canonical list of all currently visible windows of the `ecb-frame'
+2. A canonical list of all currently visible edit-windows
+3. A canonical list of all currently visible ecb-windows
+4. The window-object of the compile-window if there is any.
+5. The minibuffer-window of the ECB-frame if there is an active minibuffer.
+5. The result of the function `ecb-where-is-point' - see the documentation
+   of this function for details.
+6. An integer which indicates how many steps away from the current selected
+   window the \"other-window\ is. Is nil when this function is called in
+   another context then for `other-window'.
+The function has to return a window-object which is then used as \"other
+window\" for the command `other-window' or for scrolling another window
+\(e.g. with `scroll-other-window').
+
+This function has to handle all properly situations for itself.
+`ecb-get-other-window-smart' is an example for such a function."
   :group 'ecb-layout
-  :type '(radio (const :tag "All windows" all)
+  :group 'ecb-most-important
+  :type '(radio (const :tag "Smart" :value smart)
+                (const :tag "All windows" all)
                 (const :tag "Only edit windows" only-edit)
-                (const :tag "Edit + compile window" edit-and-compile)))
+                (const :tag "Edit + compile window" edit-and-compile)
+                (function :tag "User defined" :value ignore)))
 
 (defcustom ecb-advice-window-functions '(other-window
                                          delete-window
                                          split-window
                                          switch-to-buffer
                                          switch-to-buffer-other-window
-                                         display-buffer)
+                                         display-buffer
+                                         other-window-for-scrolling
+                                         balance-windows)
   "*Advice functions to be more intelligent if used with ECB.
 You can choose the following functions to be adviced by ECB so they behave as
 if the edit-window\(s) of ECB would be the only windows\(s) of the ECB-frame:
 - `other-window'
-  For this one see also the option `ecb-other-window-jump-behavior'!
+  For this one see also the option `ecb-other-window-behavior'!
 - `delete-window'
 - `delete-other-windows'
 - `delete-windows-on'
 - `display-buffer'
   Especially if `ecb-compile-window-height' is not nil it is strongly
   recommended not to disable this advice!
-- `other-window-for-scrolling'
-  If this advice is enabled then the following functions scroll always the
-  first edit-window if the edit-window is splitted, point stays in the
-  \"other\" edit-window and there is no durable compilation-window \(see
-  `ecb-compile-window-height'):
+- `other-window-for-scrolling': If this advice is enabled then the behavior of
+  the following functions depends on `ecb-other-window-behavior':
   - `scroll-other-window'
   - `scroll-other-window-down'
   - `beginning-of-buffer-other-window'
   - `end-of-buffer-other-window'
-  This advice is per default not enabled.
+- `balance-windows': Only the edit-windows of the ecb-frame are balanced.
 
 For working most conveniently with ECB it is the best to advice all these
 functions, because then all the standard shortcuts of these functions are also
               (const :tag "display-buffer"
                      :value display-buffer)
               (const :tag "other-window-for-scrolling"
-                     :value other-window-for-scrolling)))
+                     :value other-window-for-scrolling)
+              (const :tag "balance-windows"
+                     :value balance-windows)))
 
 (defcustom ecb-advice-window-functions-signal-error nil
   "*Signal an error if an adviced function can not do its job.
     switch-to-buffer)
   "*Adviced window functions work always in the edit-window.
 If we are in an ECB special buffer (methods, directories, etc), and any of the
-adviced windowing functions is called \(see `ecb-advice-window-functions'), we
-will select the `ecb-edit-window' first. This is useful if you have any
-functions that use such functions and you don't want them to just error with a
-method complaining that the current buffer can not be split, or something
+adviced windowing functions is called interactively \(see
+`ecb-advice-window-functions'), we will select first an edit-window according
+to the value of `ecb-mouse-click-destination'. This is useful if you have any
+functions that use such functions and you don't want them to fail with an
+error complaining that the current buffer can not be split, or something
 similar.
 
-Because this may not be desirable in all situations and all adviced functions
-this can be enabled separately for every advisable function \(see also
-`ecb-advice-window-functions'). If the symbol of an adviced function is
+Because this may not be desirable in all situations and for all adviced
+functions this can be enabled separately for every advicable function \(see
+also `ecb-advice-window-functions'). If the symbol of an adviced function is
 contained in the value of this option, then the edit-window is first selected
-otherwise either an error is reported or some other special reaction; see the
-documentation of the adviced functions for this.
+otherwise either an error is reported or some other special reaction (depends
+on `ecb-advice-window-functions-signal-error'); see the documentation of the
+adviced functions for this.
 
 For `other-window', `other-window-for-scrolling' and
 `switch-to-buffer-other-window' this makes no sense, therefore you can not
 enable this for them.
 
-Per default this is enabled for `delete-window', `delete-other-windows',
-`switch-to-buffer' and `display-buffer'."
+Per default this is enabled for `switch-to-buffer' and `display-buffer'."
   :group 'ecb-layout
   :type '(set (const :tag "delete-window"
                      :value delete-window)
               (const :tag "switch-to-buffer"
                      :value switch-to-buffer)))
 
-(defun ecb-canonical-ecb-windows-list ()
+(defun ecb-canonical-ecb-windows-list (&optional winlist)
   "Return a list of all current visible special dedicated ECB-windows
 \(starting from the left-most top-most window) in the order `other-window'
 would walk through these windows."
-  (delete nil (mapcar (function (lambda (elem)
-                                  (if (window-dedicated-p elem)
-                                      elem)))
-                      (ecb-window-list ecb-frame 0
-                                       (frame-first-window ecb-frame)))))
+  (let ((windows-list (or winlist
+                          (ecb-window-list ecb-frame 0
+                                           (frame-first-window ecb-frame)))))
+    (delete nil (mapcar (function (lambda (elem)
+                                    (if (window-dedicated-p elem)
+                                        elem)))
+                        windows-list))))
+
+(defun ecb-canonical-edit-windows-list (&optional winlist)
+  "Return a list of all current edit-windows \(starting from the left-most
+top-most window) in the order `other-window' would walk through these windows.
+These are all windows in the `ecb-frame' which are not identical to the
+compile-window and not identical to one of the visible ECB-windows."
+  (let ((comp-win-state (ecb-compile-window-state))
+        (windows-list (or winlist
+                          (ecb-window-list ecb-frame 0
+                                           (frame-first-window ecb-frame)))))
+    (delete nil (mapcar (function (lambda (elem)
+                                    (if (and (not (window-dedicated-p elem))
+                                             (or (not (equal comp-win-state 'visible))
+                                                 (not (equal elem ecb-compile-window))))
+                                        elem)))
+                        windows-list))))
 
 (defcustom ecb-layout-window-sizes nil
   "*Specifies the sizes of the ECB windows for each layout.
 
 (defcustom ecb-toggle-layout-sequence '("left9" "left14")
   "*Toggle sequence for layout toggling with `ecb-toggle-layout'.
-Every element of this list has to be a valid layout-name \"string) i.e. either
-one of the predefined layouts or one of the user-defined layouts \(see
+Every element of this list has to be a valid layout-name \(a string) i.e.
+either one of the predefined layouts or one of the user-defined layouts \(see
 `ecb-create-new-layout').
 
 You can add here as many layouts as you want but to use this option most
                                     name)))
                    (set symbol value))))
 
-
 (defcustom ecb-hide-ecb-windows-before-hook nil
   "*Hook run direct before the ECB windows will be hidden.
 Hiding is done either by `ecb-toggle-ecb-windows' or `ecb-hide-ecb-windows'.
 This means that at runtime of this hook all the ECB-tree-windows of current
-layout are visible."
+layout are visible.
+
+IMPORTANT: Showing the hidden ECB-windows is internally done by calling
+`ecb-redraw-layout' and therefore also the hooks
+`ecb-redraw-layout-before-hook' and `ecb-redraw-layout-after-hook' are
+evaluated. The hook-sequence is analogous to that described in
+`ecb-show-ecb-windows-before-hook'."
   :group 'ecb-layout
   :type 'hook)
 
 (defcustom ecb-hide-ecb-windows-after-hook nil
   "*Hooks run direct after the ECB windows have been hidden.
-Hiding was done either by `ecb-toggle-ecb-windows' or `ecb-hide-ecb-windows'."
+Hiding was done either by `ecb-toggle-ecb-windows' or `ecb-hide-ecb-windows'.
+
+IMPORTANT: Showing the hidden ECB-windows is internally done by calling
+`ecb-redraw-layout' and therefore also the hooks
+`ecb-redraw-layout-before-hook' and `ecb-redraw-layout-after-hook' are
+evaluated. The hook-sequence is analogous to that described in
+`ecb-show-ecb-windows-after-hook'."
   :group 'ecb-layout
   :type 'hook)
 
 
 
 (defvar ecb-frame nil
-  "Frame where ECB runs")
+  "Frame where ECB runs. This frame is only set if this variable is nil or the
+value points to a dead frame. Deactivation and activation of ECB does not set
+this variable to nil!")
 
 (defvar ecb-edit-window nil
-  "Window to edit source in. If this window is splitted in two windows then
-`ecb-edit-window' is always the leftmost/topmost window of the two
-edit-windows! ")
+  "Only used internally by `ecb-redraw-layout-full'. Do not refer to this
+variable because the value is not predictable!")
 (defvar ecb-last-edit-window-with-point nil
   "The edit-window of ECB which had the point before an emacs-command is
 done.")
 (defvar ecb-compile-window-was-selected-before-command nil
   "Not nil only if the `ecb-compile-window' was selected before most recent
 command.")
+(defvar ecb-windows-hidden nil
+  "Used with `ecb-toggle-ecb-windows'. If true the ECB windows are hidden. Do
+not change this variable!")
+(defvar ecb-tree-buffers-of-current-layout nil)
 
 (defun ecb-initialize-layout ()
-  (setq ecb-frame nil
-        ecb-edit-window nil
+  ;; We do not initialize the `ecb-frame'!
+  (setq ecb-edit-window nil
         ecb-last-edit-window-with-point nil
         ecb-last-source-buffer nil
         ecb-last-compile-buffer-in-compile-window nil
         ecb-current-maximized-ecb-buffer-name nil
         ecb-cycle-ecb-buffer-state nil
+        ecb-tree-buffers-of-current-layout nil
         ecb-windows-hidden nil
         ecb-compile-window nil
-        ecb-compile-window-was-selected-before-command nil))
+        ecb-layout-prevent-handle-compile-window-selection nil
+        ecb-layout-prevent-handle-ecb-window-selection nil
+        ecb-ecb-window-was-selected-before-command nil
+        ecb-compile-window-was-selected-before-command nil)
+  (ecb-window-config-cache-clear))
 
 (defun ecb-layout-debug-error (&rest args)
   "Run ARGS through `format' and write it to the *Messages*-buffer."
 
 
 (defun ecb-compile-window-live-p (&optional display-msg)
-  (if (and ecb-compile-window
-           (window-live-p ecb-compile-window)
-           (not ecb-windows-hidden))
+  (if (and ecb-compile-window-height
+           ecb-compile-window
+           (window-live-p ecb-compile-window))
       t
     (if display-msg
         (message "No compile-window visible in current ECB-layout!"))
     nil))
 
+(defun ecb-get-compile-window-buffer ()
+  "Return the buffer currently displayed in the compile-window or nil if there
+is no compile-window displayed."
+  (if (ecb-compile-window-live-p)
+      (window-buffer ecb-compile-window)))
+
+;; Klaus Berndl <klaus.berndl@sdm.de>: This function is only there for
+;; backward compatibility and is not needed for ECB-versions > 2.11
 (defun ecb-edit-window-live-p ()
-  (and ecb-edit-window (window-live-p ecb-edit-window)))
+  "At least one edit-window is always alive."
+  t)
 
 (defun ecb-window-live-p (buffer-name)
   "Return not nil if buffer BUFFER-NAME is displayed in an active window."
 
 (defadvice compilation-set-window-height (around ecb)
   "Makes the function compatible with ECB."
-  (if (or (not (equal (window-frame (ad-get-arg 0)) ecb-frame))
-          ecb-windows-hidden)
+;;   (if (or (not (equal (window-frame (ad-get-arg 0)) ecb-frame))
+  (if (not (equal (window-frame (ad-get-arg 0)) ecb-frame))
       (ecb-with-original-basic-functions
        (ecb-with-original-functions
         ad-do-it))
                      (progn
                        (select-window (ad-get-arg 0))
                        (enlarge-window (- compilation-window-height
-                                          (window-height))))
+                                          (ecb-window-full-height))))
                    ;; The enlarge-window above may have deleted W, if
                    ;; compilation-window-height is large enough.
                    (when (window-live-p w)
 ;; `scroll-other-window' uses per default not the function
 ;; `other-window-for-scrolling'.
 (defadvice scroll-other-window (around ecb)
-  "The behavior depends on the advice of `other-window-for-scrolling' \(see
-`ecb-advice-window-functions')."
-  (if (not (equal (ecb-point-in-edit-window) 2))
-      ad-do-it
-    (let ((other-window-scroll-buffer (window-buffer (other-window-for-scrolling))))
+  "The behavior depends if `other-window-for-scrolling' is adviced \(see
+`ecb-advice-window-functions'). See the advice-documentation of
+`other-window-for-scrolling' to get all details which window will be scrolled."
+  (if (or (not ecb-minor-mode)
+          (not (equal (selected-frame) ecb-frame))
+          (and (equal (selected-window) (minibuffer-window ecb-frame))
+               minibuffer-scroll-window))
+      (ecb-with-original-basic-functions
+       (ecb-with-original-functions
+        ad-do-it))
+    (let* ((o-w (other-window-for-scrolling))
+           (o-w-s-b (window-buffer o-w))
+           (other-window-scroll-buffer (if (or (equal (current-buffer) o-w-s-b)
+                                               (equal (minibuffer-window ecb-frame)
+                                                      o-w))
+                                           nil
+                                         o-w-s-b)))
       ad-do-it)))
 
 
 (defadvice scroll-all-mode (after ecb)
   "With active ECB `scroll-all-mode' scrolls only the two edit-windows if point
-stays in one of them. In all other situations just the selected window is scrolled."
+stays in one of them. In all other situations just the selected window is
+scrolled."
   (if scroll-all-mode
       ;; scroll all mode needs 'only-edit as value for
-      ;; `ecb-other-window-jump-behavior'
-      (setq ecb-other-window-jump-behavior 'only-edit)
+      ;; `ecb-other-window-behavior'
+      (setq ecb-other-window-behavior 'only-edit)
     ;; setting back to the old user customized value
-    (setq ecb-other-window-jump-behavior
-          (ecb-option-get-value 'ecb-other-window-jump-behavior))))
+    (setq ecb-other-window-behavior
+          (ecb-option-get-value 'ecb-other-window-behavior))))
 
 (defadvice count-windows (around ecb)
   "If the selected frame is the ecb-frame and `scroll-all-mode' is not nil
 if `scroll-all-mode' is nil return the number of visible windows."
   (if (and (equal (selected-frame) ecb-frame)
            ecb-minor-mode
-           (not ecb-windows-hidden)
            (boundp 'scroll-all-mode)
            scroll-all-mode)
-      (setq ad-return-value (if (and (ecb-point-in-edit-window)
-                                     (ecb-edit-window-splitted))
-                                2
+      (setq ad-return-value (if (ecb-point-in-edit-window)
+                                (length (ecb-canonical-edit-windows-list))
                               1))
     (ecb-with-original-basic-functions
      (ecb-with-original-functions
       ad-do-it))))
 
<