Skip to content
Browse files

Introduce compatability layer for interactive-p

The interactive-p function is obsolete in Gnu Emacs as of 23.2.  This
change introduces a ecb-interactive-p compatibility function that will
call 'called-interactively-p' for new versions of Gnu Emacs and uses
the interactive-p function for all other Emacsen.

Conflicts:
	ecb-common-browser.el
	ecb-create-layout.el
	ecb-layout.el
	ecb-speedbar.el
	ecb-tod.el
	ecb-upgrade.el
	ecb-winman-support.el
	tree-buffer.el
  • Loading branch information...
1 parent 835c4e7 commit 85e6d2abd1430bb2a71d0c42fb5161f4fd765fc5 Ryan Ware committed with pwojnowski Oct 1, 2013
Showing with 38 additions and 287 deletions.
  1. +3 −3 ecb-common-browser.el
  2. +4 −4 ecb-create-layout.el
  3. +9 −259 ecb-layout.el
  4. +1 −1 ecb-speedbar.el
  5. +1 −1 ecb-tod.el
  6. +2 −2 ecb-upgrade.el
  7. +14 −13 ecb-util.el
  8. +3 −3 ecb-winman-support.el
  9. +1 −1 tree-buffer.el
View
6 ecb-common-browser.el
@@ -1499,7 +1499,7 @@ has been contained)."
(defmacro defecb-autocontrol/sync-function (fcn buffer-name-symbol
buffer-sync-option-symbol
- called-interactively-p docstring
+ ecb-interactive-p docstring
&rest body)
"Define a function run either by idle-timer or before or after each command.
Such a function is used either for automatic self-controlling certain aspects
@@ -1539,7 +1539,7 @@ exactly true when either:
- The value of BUFFER-SYNC-OPTION-SYMBOL is 'basic and the conditions above
are true for `ecb-basic-buffer-sync'.
-If CALLED-INTERACTIVELY-P is not nil then FCN will be defined as an interactice
+If ECB-INTERACTIVE-P is not nil then FCN will be defined as an interactice
command, i.e. it will containe the clause \(interactive \"P\").
The defined function is automatically prepared for tracing its calls when
@@ -1570,7 +1570,7 @@ hold in the variable `ecb-a-special-buffer-name'.
(defun ,fcn (&optional force)
,docstring
- ,(if called-interactively-p
+ ,(if ecb-interactive-p
'(interactive "P"))
(ecb-autotrace-autocontrol/sync-fcn-error (quote ,fcn)
"Begin: Cur-buf: %s" (current-buffer))
View
8 ecb-create-layout.el
@@ -259,9 +259,9 @@ other other frame!"
"Cancel layout-creation without saving the layout."
(interactive)
(when (ecb-create-layout-frame-ok)
- (ecb-create-layout-clear-all (called-interactively-p 'any))
+ (ecb-create-layout-clear-all (ecb-interactive-p))
(message "ECB Layout Creation canceled - the layout is not saved!")
- (and (called-interactively-p 'any) (ecb-activate))))
+ (and (ecb-interactive-p) (ecb-activate))))
(defun ecb-create-layout-clear-all (&optional delete-frame)
"Resets all stuff to state before `ecb-create-new-layout' was called. If
@@ -312,7 +312,7 @@ DELETE-FRAME is not nil then the new created frame will be deleted and the
(interactive)
(when (ecb-create-layout-frame-ok)
(if (ecb-create-layout-ready-for-save-p)
- (let ((delete-frame (called-interactively-p 'any)))
+ (let ((delete-frame (ecb-interactive-p)))
;; if an error occurs during `ecb-create-layout-save-layout' or the
;; user hits C-q we must clean the layout creation stuff!
(unwind-protect
@@ -464,7 +464,7 @@ DELETE-FRAME is not nil then the new created frame will be deleted and the
(concat "ECB " new-type) nil t)
;; setting the new buffer type in the buffer itself
(ecb-create-layout-set-buffer-type new-type)
- (when (called-interactively-p 'any)
+ (when (ecb-interactive-p)
(ecb-create-layout-gen-lisp-for-buffer-type new-type)
(ecb-create-layout-next-window))
new-type)))
View
268 ecb-layout.el
@@ -1681,7 +1681,7 @@ arguments. Do never set this variable; it is only set by
;; ECB and if `ecb-compile-window-temporally-enlarge' is either
;; after-selection or nil then we shrink to the
;; ecb-compile-window-height! Otherwise we run the normal job!
- (if (and (not (called-interactively-p 'any))
+ (if (and (not (ecb-interactive-p))
(equal (ad-get-arg 0) ecb-compile-window)
(member ecb-compile-window-temporally-enlarge
'(after-selection nil))
@@ -1697,7 +1697,7 @@ arguments. Do never set this variable; it is only set by
;; `ecb-compile-window-height'
(let ((window-min-height (if (and (equal (ad-get-arg 0) ecb-compile-window)
(and ecb-compile-window-prevent-shrink-below-height
- (not (called-interactively-p 'any)))
+ (not (ecb-interactive-p)))
window-min-height
ecb-compile-window-height-lines
(< window-min-height
@@ -1796,7 +1796,7 @@ for current layout."
;; `ecb-compile-window-height'
(window-min-height (if (and (equal (ad-get-arg 0) ecb-compile-window)
(and ecb-compile-window-prevent-shrink-below-height
- (not (called-interactively-p 'any)))
+ (not (ecb-interactive-p)))
window-min-height
ecb-compile-window-height-lines
(< window-min-height
@@ -3141,7 +3141,7 @@ If called for other frames it works like the original version."
;; algorithm of `ecb-toggle-compile-window-height' fails
;; (e.g. during `compile-internal'!).
(unless pop-up-frames
- (if (called-interactively-p 'any)
+ (if (ecb-interactive-p)
(ecb-set-compile-window-height)
(if (save-excursion
(set-buffer (ad-get-arg 0))
@@ -3236,256 +3236,6 @@ If called for other frames it works like the original version."
(ecb-with-original-basic-functions
ad-do-it)))
-;; (defecb-advice display-buffer around ecb-layout-basic-adviced-functions
-;; "Makes this function compatible with ECB if called in or for the ecb-frame.
-;; It displays all buffers which are \"compilation-buffers\" in the sense of
-;; `ecb-compilation-buffer-p' in the compile-window of ECB. If the compile-window
-;; is temporally hidden then it will be displayed first.
-
-;; If there is no compile-window \(`ecb-compile-window-height' is nil) then it
-;; splits the edit-window if unsplitted and displays BUFFER in the other
-;; edit-window but only if `pop-up-windows' is not nil \(otherwise the
-;; edit-window will not splitted).
-
-;; All buffers which are not \"compilation-buffers\" in the sense of
-;; `ecb-compilation-buffer-p' will be displayed in one of the edit-area and
-;; `display-buffer' behaves as if the edit-windows would be the only windows in
-;; the frame.
-
-;; If BUFFER is contained in `special-display-buffer-names' or matches
-;; `special-display-regexps' then `special-display-function' will be called \(if
-;; not nil). But this behavior depends on the value of the option
-;; `ecb-ignore-special-display'. The values of `same-window-buffer-names' and
-;; `same-window-regexps' are supported as well.
-
-;; See the value of the option `ecb-ignore-display-buffer-function'!
-
-;; If called for other frames it works like the original version."
-;; (if ecb-running-xemacs
-;; (ecb-layout-debug-error "display-buffer entered with: %s %s %s %s"
-;; (ad-get-arg 0)
-;; (ad-get-arg 1)
-;; (ad-get-arg 2)
-;; (ad-get-arg 3))
-;; (ecb-layout-debug-error "display-buffer entered with: %s %s %s"
-;; (ad-get-arg 0)
-;; (ad-get-arg 1)
-;; (ad-get-arg 2)))
-;; (if (and ecb-minor-mode
-;; (or (and (ad-get-arg 2)
-;; (framep (ad-get-arg 2))
-;; (equal (ad-get-arg 2) ecb-frame))
-;; (and (or (null (ad-get-arg 2))
-;; (equal (ad-get-arg 2) t)
-;; (equal (ad-get-arg 2) 0))
-;; (equal (selected-frame) ecb-frame)))
-;; (not (ecb-check-for-special-buffer (ad-get-arg 0)))
-;; (not (and (boundp 'display-buffer-function)
-;; (fboundp display-buffer-function)
-;; (not (ecb-ignore-display-buffer-function)))))
-;; (let ((special-display-function (if (ecb-ignore-special-display)
-;; nil
-;; special-display-function)))
-;; (cond ((ecb-compilation-buffer-p (ad-get-arg 0))
-;; (ecb-layout-debug-error "display-buffer for a comp-buffer: %s"
-;; (ad-get-arg 0))
-;; ;; we have to display the buffer in the compile-window if a
-;; ;; compile-window was set but currently hidden --> then we have
-;; ;; to show it now. `ecb-toggle-compile-window' preserves always
-;; ;; the selected window!
-;; (when (and (equal 'hidden (ecb-compile-window-state))
-;; ;; calling this from minibuffer (e.g. completions)
-;; ;; seems to cause problems
-;; (not (equal (minibuffer-window ecb-frame) (selected-window))))
-;; (ecb-layout-debug-error "display-buffer: comp-win will be toggled.")
-;; (save-excursion (ecb-toggle-compile-window 1)))
-;; (if (ecb-compile-window-live-p)
-;; ;; now we have to make the edit-window(s) dedicated
-;; (let ((edit-window-list (ecb-canonical-edit-windows-list))
-;; (pop-up-frames (if (ecb-ignore-pop-up-frames)
-;; nil
-;; pop-up-frames)))
-;; (ecb-layout-debug-error "display-buffer: buffer %s has to be displayed in the alive compile-window: %s"
-;; (ad-get-arg 0) ecb-compile-window)
-;; (unwind-protect
-;; (progn
-;; (mapc (function (lambda (w)
-;; (set-window-dedicated-p w t)))
-;; edit-window-list)
-;; (setq ecb-layout-temporary-dedicated-windows
-;; edit-window-list)
-;; ;; now we perform the original `display-buffer' but
-;; ;; now the only not dedicated window is the compile
-;; ;; window so `display-buffer' MUST use this.
-
-;; ;; `display-buffer' sometimes tries to split the
-;; ;; compile-window (e.g. if it is called from the
-;; ;; compile-window - e.g. calling help from the
-;; ;; compile-window - or with Emacs 23 also when
-;; ;; using a frame-width compile-window and do
-;; ;; completions). To avoid this we must temporally
-;; ;; make the ecb-frame unsplittable - but here we
-;; ;; can do this savely because here we have a live
-;; ;; compile-window and a buffer which should be
-;; ;; displayed there ==> display-buffer MUST
-;; ;; (because all other windows are temporally
-;; ;; dedicated) use exactly this window and there
-;; ;; is no need to split it
-;; (ecb-with-unsplittable-ecb-frame
-;; (if ecb-running-xemacs
-;; ;; XEmacs does not shrink to fit if
-;; ;; `pop-up-windows' is nil so we must set it
-;; ;; here temporally to t
-;; (let ((pop-up-windows t))
-;; (setq ad-return-value
-;; (ecb-display-buffer-xemacs (ad-get-arg 0)
-;; (ad-get-arg 1)
-;; (ad-get-arg 2)
-;; (ad-get-arg 3))))
-;; ad-do-it)))
-;; ;; making the edit-window(s) not dedicated
-;; (mapc (function (lambda (w)
-;; (set-window-dedicated-p w nil)))
-;; edit-window-list)
-;; ;;(modify-frame-parameters ecb-frame '((unsplittable . nil)))
-;; (setq ecb-layout-temporary-dedicated-windows nil)) ;; end unwind-protect
-
-;; ;; if called interactively we run now our
-;; ;; `ecb-toggle-compile-window-height' to set the height of
-;; ;; the compile-window according to the value of
-;; ;; `ecb-enlarged-compilation-window-max-height'. If called
-;; ;; non-interactively (e.g. by `compile-internal',
-;; ;; `with-output-to-temp-buffer' etc...) then all the
-;; ;; resizing or shrinking stuff is handled by
-;; ;; `compilation-set-window-height',
-;; ;; `resize-temp-buffer-window' (GNU Emacs) or
-;; ;; `shrink-window-if-larger-than-buffer' (called by the
-;; ;; SHRINK-TO-FIT arg of the XEmacs `display-buffer').
-
-;; ;; We can not do this in the non-interactive case because
-;; ;; here often after the call of display-buffer the buffer
-;; ;; to display does not contain its final contents so the
-;; ;; algorithm of `ecb-toggle-compile-window-height' fails
-;; ;; (e.g. during `compile-internal'!).
-;; (unless pop-up-frames
-;; (if (called-interactively-p 'any)
-;; (ecb-set-compile-window-height)
-;; (if (save-excursion
-;; (set-buffer (ad-get-arg 0))
-;; (= (point-min) (point-max)))
-;; ;; Klaus Berndl <klaus.berndl@sdm.de>: If this
-;; ;; makes trouble we remove it.
-;; (ecb-toggle-compile-window-height -1)))
-
-;; (if (member ecb-compile-window-temporally-enlarge
-;; '(after-selection both))
-;; (setq ecb-layout-prevent-handle-compile-window-selection t)))
-;; ) ;; end of let...
-
-;; ;; OK, we have really no compile-window...
-
-;; ;; needed for TAB-completion if this offers the completions in
-;; ;; a temp-buffer. Without this manually split the whole
-;; ;; edit-window would be used for the completions which is not
-;; ;; the default-behavior of Emacs.
-;; (let ((pop-up-frames (if (ecb-ignore-pop-up-frames)
-;; nil
-;; pop-up-frames)))
-;; ;; TODO: Klaus Berndl <klaus.berndl@sdm.de>: emacs 23
-;; ;; splits automatically when window-size allows this (see
-;; ;; split-width-threshold and split-height-threshold)...
-;; ;; Test and ev. modify (not a serious problem but not nice)
-;; (when (and (not (ecb-windows-all-hidden))
-;; (not (ecb-layout-top-p))
-;; pop-up-windows
-;; (not pop-up-frames)
-;; (not (ecb-edit-window-splitted))
-;; (not (ecb-check-for-same-window-buffer (ad-get-arg 0))))
-;; (ecb-layout-debug-error "display-buffer for comp-buffer %s - split edit-window:"
-;; (ad-get-arg 0))
-;; (split-window (car (ecb-canonical-edit-windows-list))))
-;; ;; Here the values of temp-buffer-max-height and
-;; ;; compilation-window-height take effect.
-;; (if ecb-running-xemacs
-;; (setq ad-return-value
-;; (ecb-display-buffer-xemacs (ad-get-arg 0)
-;; (ad-get-arg 1)
-;; (ad-get-arg 2)
-;; (ad-get-arg 3)))
-;; ad-do-it))))
-
-;; ((not (ecb-buffer-is-dedicated-special-buffer-p (ad-get-arg 0)))
-;; (ecb-layout-debug-error "display-buffer for normal buffer: %s"
-;; (ad-get-arg 0))
-;; (let ((edit-win-list (ecb-canonical-edit-windows-list))
-;; (pop-up-frames (if (ecb-ignore-pop-up-frames)
-;; nil
-;; pop-up-frames)))
-;; ;; maybe we have to split the edit-area here
-;; (when (and (or pop-up-windows (ad-get-arg 1))
-;; (not pop-up-frames)
-;; (not (ecb-edit-window-splitted edit-win-list))
-;; ;; if the BUFFER is already displayed in an
-;; ;; edit-window and NOT-THIS-WINDOW is nil then
-;; ;; we must not split the edit-window because
-;; ;; display-buffer then just uses this window for
-;; ;; displaying BUFFER.
-;; (not (and (not (ad-get-arg 1))
-;; (member (get-buffer-window (ad-get-arg 0) ecb-frame)
-;; edit-win-list)))
-;; ;; if we display a "normal" buffer from outside
-;; ;; the edit-windows then we have per se another
-;; ;; window because the buffer will displayed in
-;; ;; an edit-window ==> we only split if we are
-;; ;; already in an edit-window.
-;; (ecb-point-in-edit-window-number edit-win-list)
-;; (not (ecb-check-for-same-window-buffer (ad-get-arg 0))))
-;; (ecb-layout-debug-error "display-buffer for normal-buffer %s - split edit-window:"
-;; (ad-get-arg 0))
-;; (split-window (car edit-win-list)))
-;; (if (ecb-compile-window-live-p)
-;; (unwind-protect
-;; (progn
-;; (set-window-dedicated-p ecb-compile-window t)
-;; ;; now we perform the original `display-buffer' but
-;; ;; now the only not dedicated window(s) are the
-;; ;; edit-window(s)
-;; (setq ecb-layout-temporary-dedicated-windows
-;; (list ecb-compile-window))
-;; (if ecb-running-xemacs
-;; (setq ad-return-value
-;; (ecb-display-buffer-xemacs (ad-get-arg 0)
-;; (ad-get-arg 1)
-;; (ad-get-arg 2)
-;; (ad-get-arg 3)))
-;; ad-do-it))
-;; ;; making the compile-window not dedicated
-;; (set-window-dedicated-p ecb-compile-window nil)
-;; (setq ecb-layout-temporary-dedicated-windows nil))
-;; (if ecb-running-xemacs
-;; (setq ad-return-value
-;; (ecb-display-buffer-xemacs (ad-get-arg 0)
-;; (ad-get-arg 1)
-;; (ad-get-arg 2)
-;; (ad-get-arg 3)))
-;; ad-do-it))))
-
-;; (t ;; buffer is a special ecb-buffer
-;; (ecb-layout-debug-error "display-buffer for special ecb-buffer: %s" (ad-get-arg 0))
-;; (or (setq ad-return-value (get-buffer-window (ad-get-arg 0) ecb-frame))
-;; (ecb-error "display-buffer can not display not visible ecb-buffers!")))))
-
-;; (ecb-layout-debug-error "display-buffer - just run original version.")
-;; (ecb-with-original-basic-functions
-;; (if ecb-running-xemacs
-;; (setq ad-return-value
-;; (ecb-display-buffer-xemacs (ad-get-arg 0)
-;; (ad-get-arg 1)
-;; (ad-get-arg 2)
-;; (ad-get-arg 3)))
-;; ad-do-it))))
-
-
(defun ecb-get-other-window-minibuf-active (win-list
edit-win-list
ecb-win-list
@@ -3801,7 +3551,7 @@ compile-window then it will be hidden and otherwise the behavior depends on
(ecb-with-original-basic-functions
ad-do-it)
(ecb-do-with-unfixed-ecb-buffers
- (when (and (called-interactively-p 'any)
+ (when (and (ecb-interactive-p)
(null (ad-get-arg 0))
(member 'delete-window ecb-layout-always-operate-in-edit-window)
(not (ecb-point-in-compile-window))
@@ -3904,7 +3654,7 @@ behavior depends on `ecb-advice-window-functions-signal-error'."
(ecb-with-original-basic-functions
ad-do-it)
(ecb-do-with-unfixed-ecb-buffers
- (when (and (called-interactively-p 'any)
+ (when (and (ecb-interactive-p)
(null (ad-get-arg 0))
(member 'delete-other-windows
ecb-layout-always-operate-in-edit-window)
@@ -4028,7 +3778,7 @@ version."
;; used) then we maybe must first go to the edit-window.
;; The check for interactiv-p prevents that we jump to the edit-window if
;; called from within `split-window-vertically' for example.
- (when (and (called-interactively-p 'any)
+ (when (and (ecb-interactive-p)
(null (ad-get-arg 0))
(member 'split-window
ecb-layout-always-operate-in-edit-window)
@@ -6227,7 +5977,7 @@ if no compile-window is visible."
)
;; return the new compile-window height
(ecb-window-full-height))))
- (if (called-interactively-p 'any)
+ (if (ecb-interactive-p)
(ecb-info-message "No compile-window in current ECB-layout!"))
nil))
@@ -6294,7 +6044,7 @@ you have to quit with `C-g')."
(new-win nil))
(if new-state
(let ((height (or ecb-compile-window-height
- (and (called-interactively-p 'any)
+ (and (ecb-interactive-p)
(or (ecb-option-get-value 'ecb-compile-window-height
'saved-value)
(ecb-read-number "Insert height of the compile-window: " 6))))))
View
2 ecb-speedbar.el
@@ -203,7 +203,7 @@ after clicking onto a filename in the speedbar."
(defecb-advice speedbar-frame-mode around ecb-speedbar-adviced-functions
"During running speedbar within ECB this command is disabled!"
(if ecb-minor-mode
- (when (called-interactively-p 'any)
+ (when (ecb-interactive-p)
(ecb-info-message "speedbar-frame-mode takes no effect when running within ECB!"))
ad-do-it))
View
2 ecb-tod.el
@@ -124,7 +124,7 @@
(defun ecb-show-tip-of-the-day ()
"Show tip of the day if `ecb-tip-of-the-day' is not nil."
(interactive)
- (when (or (called-interactively-p 'any) ecb-tip-of-the-day)
+ (when (or (ecb-interactive-p) ecb-tip-of-the-day)
(ignore-errors (load-file ecb-tip-of-the-day-file))
(let* ((cursor (if (boundp 'ecb-tod-cursor)
ecb-tod-cursor
View
4 ecb-upgrade.el
@@ -1048,7 +1048,7 @@ your customization-file!"
;; now we display only the choice to save the ecb-options-version but only
;; if ecb-options-version != ecb-version and (either the command is called
;; interactively or first-time called by program)
- (when (and (or (called-interactively-p 'any)
+ (when (and (or (ecb-interactive-p)
(not (get 'ecb-display-upgraded-options
'ecb-options-version-save-displayed)))
(not (ecb-options-version=ecb-version-p)))
@@ -1111,7 +1111,7 @@ If FULL-NEWS is not nil then the NEWS-file is displayed in another window."
(if (and ecb-old-ecb-version
(or (not (get 'ecb-display-news-for-upgrade
'ecb-news-for-upgrade-displayed))
- (called-interactively-p 'any)))
+ (ecb-interactive-p)))
(progn
(with-output-to-temp-buffer "*News for the new ECB-version*"
(princ (format "You have upgraded ECB from version %s to %s.\n\n"
View
27 ecb-util.el
@@ -2339,19 +2339,20 @@ cons-cell \('test-inner-loop . \"test\")"
)
'exit))))
-;; (defun ecb-test-throw-on-input-new ()
-;; "Test that while-no-input will work even better."
-;; (interactive)
-;; (message "Exit Code: %s"
-;; (while-no-input
-;; (let ((inhibit-quit nil)
-;; (message-log-max nil))
-;; (while t
-;; (message "Looping ...")
-;; (while t nil)
-;; "test")
-;; 'exit))))
-
+;; Compatibility Functions ---------------------------------
+
+;; A number of functions in Gnu Emacs have been obsoleted in the
+;; last few years. To ensure compatibility with versions of
+;; emacs that do not track Gnu Emacs the below functions so
+;; ecb is implementing compatibilty functions
+
+;; interactive-p is obsolete as of Emacs 23.2
+(defmacro ecb-interactive-p (&optional kind)
+ (if (or (> emacs-major-version 23)
+ (and (>= emacs-major-version 23)
+ (>= emacs-minor-version 2)))
+ `(called-interactively-p ,kind)
+ `(interactive-p)))
;;; ----- Provide ------------------------------------------
View
6 ecb-winman-support.el
@@ -294,17 +294,17 @@ ecb-frame. This advice is a permanent advice set!"
(when-ecb-running-xemacs
(defecb-advice push-window-configuration before ecb-winman-not-supported-function-advices
(if (and (equal (selected-frame) ecb-frame)
- (called-interactively-p 'any))
+ (ecb-interactive-p))
(ecb-error "Can't use interactive push-window-configuration in the ecb-frame.")))
(defecb-advice pop-window-configuration before ecb-winman-not-supported-function-advices
(if (and (equal (selected-frame) ecb-frame)
- (called-interactively-p 'any))
+ (ecb-interactive-p))
(ecb-error "Can't use interactive pop-window-configuration in the ecb-frame.")))
(defecb-advice unpop-window-configuration before ecb-winman-not-supported-function-advices
(if (and (equal (selected-frame) ecb-frame)
- (called-interactively-p 'any))
+ (ecb-interactive-p))
(ecb-error "Can't use interactive unpop-window-configuration in the ecb-frame.")))
)
View
2 tree-buffer.el
@@ -2580,7 +2580,7 @@ Example for the usage of this macro:
"then the current node at point in the currently selected tree-buffer is used.\n"
"REST-ARG-LIST is a list of zero or more extra arguments passed to this command.")
(interactive)
- (let ((node (if (and (called-interactively-p 'any) (null node))
+ (let ((node (if (and (ecb-interactive-p) (null node))
(tree-buffer-get-node-at-point)
node)))
(when node

0 comments on commit 85e6d2a

Please sign in to comment.
Something went wrong with that request. Please try again.