Index: ecb-layout.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/ecb/ecb-layout.el,v
retrieving revision 1.16
diff -u -r1.16 ecb-layout.el
--- ecb-layout.el	1 Dec 2004 16:05:01 -0000	1.16
+++ ecb-layout.el	15 Jan 2008 23:47:59 -0000
@@ -614,17 +614,17 @@
 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."
+ECB needs three permanent adivces even when ECB is deactivated: `split-window',
+`delete-window', `delete-other-windows'. But these advices do not change any
+behavior of these functions but only store in an internal ECB variable the fact
+that a window has been split or deleted, etc. In addition to this these advices
+are 100% error-safe, meaning the functionality of the original functions is
+performed in every\(!) case even if within the advice an error occurs \(but
+normally no errors can occur in these advices because they are very simple).
+Conclusion: If you really want all ECB-advices to be disabled after
+deactivating ECB then you have to set this option to some other value than
+'before-activation. But setting this variable to this value is really
+completely safe."
   :group 'ecb-layout
   :type '(radio (const :tag "Split as before ECB-start"
                        :value before-activation)
@@ -1966,7 +1966,7 @@
   ;; never take place for XEmacs-versions with the 4-arg version of
   ;; `display-buffer'!
   (setq shrink-to-fit (or ecb-temp-buffer-shrink-to-fit shrink-to-fit))
-  (let ((wconfig (current-window-configuration))
+  (let ((wconfig (ecb-current-window-configuration-wrapper))
         (result
          ;; We just simulate a `return' in C.  This function is way ugly
          ;; and does `returns' all over the place and there's no sense
@@ -2260,7 +2260,7 @@
                  (shrink-window-if-larger-than-buffer window))
                    
              (display-buffer-1 window)))))
-    (or (equal wconfig (current-window-configuration))
+    (or (equal wconfig (ecb-current-window-configuration-wrapper))
         (push-window-configuration wconfig))
     result))
 
@@ -2381,7 +2381,6 @@
 (defconst ecb-permanent-adviced-functions '((split-window . before)
                                             (delete-window . before)
                                             (delete-other-windows . before)))
-;;                                             (set-window-configuration . after)))
 
 (defmacro ecb-with-original-permanent-functions (&rest body)
   "Evaluates BODY with all adviced permanent-functions of ECB deactivated
@@ -4517,89 +4516,78 @@
 
 (defun ecb-window-configuration-invalidp (window-config)
   "Return non nil when WINDOW-CONFIG is probably not valid anymore.
-WINDOW-CONFIG must be got from the adviced version of
-`current-window-configuration'."
+WINDOW-CONFIG must be produced by `ecb-current-window-configuration-wrapper'."
   (not (equal (nth 3 window-config)
               (list ecb-frame ecb-layout-name ecb-compile-window-height
                     ecb-compile-window-width
                     ecb-windows-width ecb-windows-height))))
+
+(defun ecb-current-window-configuration-wrapper (&optional frame)
+  "Like `current-window-configuration', but also stores additional information
+needed by ECB about the window configuration."
+  (let ((config (current-window-configuration))
+	(f (or frame (selected-frame))))
+    (when (equal f ecb-frame)
+      (ecb-window-config-cache-add
+       (list config
+	     (if ecb-windows-hidden
+		 nil
+	       (ecb-get-current-visible-ecb-buffers))
+	     (if (ecb-compile-window-live-p)
+		 (ecb-position (ecb-canonical-windows-list)
+			       ecb-compile-window))
+	     ;; We add here as first element `ecb-frame' and also in the
+	     ;; check of `ecb-window-configuration-invalidp'! Then a
+	     ;; ecb-window-config made from a frame which is now deleted
+	     ;; would be always invalid, which would be more consistent
+	     ;; with the return-value of `set-window-configuration' (see
+	     ;; docstring)
+	     ;;
+	     ;; This element is only used in
+	     ;; `ecb-window-configuration-invalidp'!
+	     (list ecb-frame ecb-layout-name ecb-compile-window-height
+		   ecb-compile-window-width
+		   ecb-windows-width ecb-windows-height)
+	     ecb-edit-area-creators
+	     ecb-windows-hidden
+	     (ecb-window-configuration-data))))
+    config))
               
-(defadvice current-window-configuration (after ecb)
-  "Stores some additional informations about the window-configurations needed
-by ECB."
-  (condition-case oops
-      (let ((f (or (ad-get-arg 0) (selected-frame))))
-        (when (equal f ecb-frame)
-          (ecb-window-config-cache-add
-           (list ad-return-value
-                 (if ecb-windows-hidden
-                     nil
-                   (ecb-get-current-visible-ecb-buffers))
-                 (if (ecb-compile-window-live-p)
-                     (ecb-position (ecb-canonical-windows-list)
-                                   ecb-compile-window))
-                 ;; We add here as first element `ecb-frame' and also in the
-                 ;; check of `ecb-window-configuration-invalidp'! Then a
-                 ;; ecb-window-config made from a frame which is now deleted
-                 ;; would be always invalid, which would be more consistency
-                 ;; with the return-value of `set-window-configuration' (see
-                 ;; docstring)
-                 ;;
-                 ;; This element is only used in
-                 ;; `ecb-window-configuration-invalidp'!
-                 (list ecb-frame ecb-layout-name ecb-compile-window-height
-                       ecb-compile-window-width
-                       ecb-windows-width ecb-windows-height)
-                 ecb-edit-area-creators
-                 ecb-windows-hidden
-                 (ecb-window-configuration-data)))))
-    (error
-     (ecb-layout-debug-error "advice of current-window-configuration failed: (error-type: %S, error-data: %S)"
-                             (car oops) (cdr oops))))
-  ad-return-value)
-
-
-(defadvice set-window-configuration (after ecb)
-  "Resets some internal window-configuration-states needed by ECB. These
-internal ECB-states were stored by `current-window-configuration' in a
-ring-cache as add-on to CONFIGURATION."
-  (condition-case oops
-      (when (equal (selected-frame) ecb-frame)
-        (let ((config (ecb-window-config-cache-get (ad-get-arg 0))))
-          (when (and config
-                     (not (ecb-window-configuration-invalidp config)))
-            (ecb-make-windows-not-dedicated ecb-frame)
-            ;; we have to reset the dedicated state because it is not
-            ;; preserved by `current-window-configuration' and
-            ;; `set-window-configuration'! At least not with GNU Emacs 21.X,
-            ;; In addition we have to reset ecb-compile-window and also to set
-            ;; ecb-windows-hidden correctly
-            (and (nth 1 config)
-                 (ecb-set-windows-dedicated-state (nth 1 config) t))
-            (when (nth 2 config)
-              (let ((win-list (ecb-canonical-windows-list)))
-                (and ecb-compile-window-height
-                     (setq ecb-compile-window (nth (nth 2 config) win-list)))))
-            ;; (nth 3 config) is not used and needed within this function!
-            (setq ecb-edit-area-creators (nth 4 config))
-            (setq ecb-windows-hidden (nth 5 config))
-            (ecb-set-minor-mode-text))))
-    (error
-     (ecb-layout-debug-error "advice of set-window-configuration failed: (error-type: %S, error-data: %S)"
-                             (car oops) (cdr oops))))
-  ad-return-value)
+(defun ecb-set-window-configuration-wrapper (configuration)
+  "Resets some internal window configuration states needed by ECB. These
+internal ECB-states were stored by `ecb-current-window-configuration-wrapper'
+in a ring-cache as add-on to CONFIGURATION."
+  (set-window-configuration configuration)
+  (when (equal (selected-frame) ecb-frame)
+    (let ((config (ecb-window-config-cache-get configuration)))
+      (when (and config (not (ecb-window-configuration-invalidp config)))
+	(ecb-make-windows-not-dedicated ecb-frame)
+	;; we have to reset the dedicated state because it is not
+	;; preserved by `current-window-configuration' and
+	;; `set-window-configuration'! At least not with GNU Emacs 21.X,
+	;; In addition we have to reset ecb-compile-window and also to set
+	;; ecb-windows-hidden correctly
+	(and (nth 1 config)
+	     (ecb-set-windows-dedicated-state (nth 1 config) t))
+	(when (nth 2 config)
+	  (let ((win-list (ecb-canonical-windows-list)))
+	    (and ecb-compile-window-height
+		 (setq ecb-compile-window (nth (nth 2 config) win-list)))))
+	;; (nth 3 config) is not used and needed within this function!
+	(setq ecb-edit-area-creators (nth 4 config))
+	(setq ecb-windows-hidden (nth 5 config))
+	(ecb-set-minor-mode-text)))))
 
 (defun ecb-current-window-configuration ()
   "Return the current ecb-window-configuration"
   (progn
-    (current-window-configuration)
+    (ecb-current-window-configuration-wrapper)
     (ecb-window-config-cache-get-latest)))
 
 (defun ecb-set-window-configuration (ecb-window-config)
   "Sets the window-configuration of ECB-WINDOW-CONFIG. The additional
-informations needed by ECB will be set by the adviced version of
-`set-window-configuration'."
-  (set-window-configuration (car ecb-window-config)))
+information needed by ECB is set by `ecb-set-window-configuration-wrapper'."
+  (ecb-set-window-configuration-wrapper (car ecb-window-config)))
 
 (defmacro ecb-save-window-excursion (&rest body)
   "Same as `save-window-excursion' but it takes care of the ECB-needs."
@@ -4610,20 +4598,20 @@
              ,@body)
          (ecb-set-window-configuration ,current-window-config)))))
 
-;; test of the advices of set-window-configuration and
-;; current-window-configuration.
+;; test of ecb-set-window-configuration-wrapper and
+;; ecb-current-window-configuration-wrapper.
 
 ;; Show a compile-window and split the edit-area and then run this code. At
 ;; the end the layout has to be as before.
-;;   (let ((config (current-window-configuration)))
+;;   (let ((config (ecb-current-window-configuration-wrapper)))
 ;;     (ecb-with-original-functions
 ;;      (delete-other-windows))
 ;;     ;; set ecb-compile-window and ecb-edit-area-creators to some crap. If the
-;;     ;; test is ok, then the adviced set-window-configuration must reset these
+;;     ;; test is ok, then ecb-set-window-configuration-wrapper must reset these
 ;;     ;; variables correctly!
 ;;     (setq ecb-compile-window nil)
 ;;     (setq ecb-edit-area-creators '(1 2 3 4))
-;;     (set-window-configuration config))
+;;     (ecb-set-window-configuration-wrapper config))
 
 ;; run `ecb-test-store' when some splitted layout is active. Then do anything
 ;; what you want to change the split-state of the layout and/or the
@@ -4632,10 +4620,10 @@
 ;;   (defvar ecb-test-config nil)
 ;;   (defun ecb-test-store ()
 ;;     (interactive)
-;;     (setq ecb-test-config (current-window-configuration)))
+;;     (setq ecb-test-config (ecb-current-window-configuration-wrapper)))
 ;;   (defun ecb-test-restore ()
 ;;     (interactive)
-;;     (set-window-configuration ecb-test-config))
+;;     (ecb-set-window-configuration-wrapper ecb-test-config))
 
 
 ;; redrawing the layout
Index: ecb-util.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/ecb/ecb-util.el,v
retrieving revision 1.13
diff -u -r1.13 ecb-util.el
--- ecb-util.el	1 Dec 2004 16:05:07 -0000	1.13
+++ ecb-util.el	15 Jan 2008 23:47:59 -0000
@@ -90,7 +90,7 @@
 ;;; ----- Some constants -----------------------------------
 
 ;;;###autoload
-(defconst ecb-running-xemacs (string-match "XEmacs\\|Lucid" emacs-version))
+(defconst ecb-running-xemacs (featurep 'xemacs))
 ;;;###autoload
 (defconst ecb-running-emacs-21 (and (not ecb-running-xemacs)
                                     (> emacs-major-version 20)))
@@ -340,8 +340,6 @@
                                             (pop-to-buffer . around)
                                             (find-file . around)
                                             (find-file-other-window . around)
-                                            (current-window-configuration . after)
-                                            (set-window-configuration . after)
                                             (scroll-other-window . around)
                                             (custom-save-all . around)
                                             (count-windows . around)
@@ -355,8 +353,6 @@
                                           (pop-to-buffer . around)
                                           (find-file . around)
                                           (find-file-other-window . around)
-                                          (current-window-configuration . after)
-                                          (set-window-configuration . after)
                                           (enlarge-window . around)
                                           (shrink-window . around)
                                           (tmm-prompt . around)
@@ -1638,7 +1634,7 @@
 WINDOW default to the selected ones. Optional second arg MINIBUF t means count
 the minibuffer window even if not active. If MINIBUF is neither t nor nil it
 means not to count the minibuffer even if it is active."
-  (if ecb-running-emacs-21
+  (if (or ecb-running-emacs-21 ecb-running-xemacs)
       ;; TODO: Klaus Berndl <klaus.berndl@sdm.de>: There seems to be
       ;; mysterious behavior when running our own window-list version with
       ;; GNU Emacs >= 21.3 - especially when running an igrep when the
