diff options
Diffstat (limited to 'lisp/ediff-wind.el')
-rw-r--r-- | lisp/ediff-wind.el | 52 |
1 files changed, 31 insertions, 21 deletions
diff --git a/lisp/ediff-wind.el b/lisp/ediff-wind.el index e791b4a4def..c5a53b47b3b 100644 --- a/lisp/ediff-wind.el +++ b/lisp/ediff-wind.el @@ -39,18 +39,17 @@ (defvar top-gutter) (defvar frame-icon-title-format) (defvar ediff-diff-status) -(defvar ediff-emacs-p) (eval-when-compile (let ((load-path (cons (expand-file-name ".") load-path))) (or (featurep 'ediff-init) - (load "ediff-init.el" nil nil 'nosuffix)) + (load "ediff-init.el" nil t 'nosuffix)) (or (featurep 'ediff-util) - (load "ediff-util.el" nil nil 'nosuffix)) + (load "ediff-util.el" nil t 'nosuffix)) (or (featurep 'ediff-help) - (load "ediff-help.el" nil nil 'nosuffix)) + (load "ediff-help.el" nil t 'nosuffix)) (or (featurep 'ediff-tbar) - ediff-emacs-p + (featurep 'emacs) (load "ediff-tbar.el" 'noerror nil 'nosuffix)) )) ;; end pacifier @@ -58,7 +57,7 @@ (require 'ediff-init) ;; be careful with ediff-tbar -(if ediff-xemacs-p +(if (featurep 'xemacs) (condition-case nil (require 'ediff-tbar) (error @@ -72,15 +71,15 @@ :group 'frames) -(defcustom ediff-window-setup-function (if (ediff-window-display-p) - 'ediff-setup-windows-multiframe - 'ediff-setup-windows-plain) +(defcustom ediff-window-setup-function 'ediff-setup-windows-automatic "*Function called to set up windows. -Ediff provides a choice of two functions: `ediff-setup-windows-plain', for -doing everything in one frame, and `ediff-setup-windows-multiframe', -which sets the control panel in a separate frame. Also, if the latter -function detects that one of the buffers A/B is seen in some other frame, -it will try to keep that buffer in that frame. +Ediff provides a choice of three functions: `ediff-setup-windows-plain', for +doing everything in one frame, `ediff-setup-windows-multiframe', which sets +the control panel in a separate frame, and +`ediff-setup-windows-automatic' (the default), which chooses an appropriate +behavior based on the current window system. If the multiframe function +detects that one of the buffers A/B is seen in some other frame, it will try +to keep that buffer in that frame. If you don't like the two functions provided---write your own one. The basic guidelines: @@ -94,7 +93,8 @@ The basic guidelines: Buffer C may not be used in jobs that compare only two buffers. If you plan to do something fancy, take a close look at how the two provided functions are written." - :type '(choice (const :tag "Multi Frame" ediff-setup-windows-multiframe) + :type '(choice (const :tag "Automatic" ediff-setup-windows-automatic) + (const :tag "Multi Frame" ediff-setup-windows-multiframe) (const :tag "Single Frame" ediff-setup-windows-plain) (function :tag "Other function")) :group 'ediff-window) @@ -147,6 +147,10 @@ In this case, Ediff will use those frames to display these buffers." :type 'function :group 'ediff-window) +;; Definitions hidden from the compiler by compat wrappers. +(declare-function ediff-display-pixel-width "ediff-init") +(declare-function ediff-display-pixel-height "ediff-init") + (defconst ediff-control-frame-parameters (list '(name . "Ediff") @@ -212,7 +216,7 @@ customization of the default control frame positioning." :type 'integer :group 'ediff-window) -(defcustom ediff-narrow-control-frame-leftward-shift (if ediff-xemacs-p 7 3) +(defcustom ediff-narrow-control-frame-leftward-shift (if (featurep 'xemacs) 7 3) "*The leftward shift of control frame from the right edge of buf A's frame. Measured in characters. This is used by the default control frame positioning function, @@ -335,6 +339,12 @@ into icons, regardless of the window manager." buffer-A buffer-B buffer-C control-buffer)) (run-hooks 'ediff-after-setup-windows-hook)) +;; Set up windows using the correct method based on the current window system. +(defun ediff-setup-windows-automatic (buffer-A buffer-B buffer-C control-buffer) + (if (ediff-window-display-p) + (ediff-setup-windows-multiframe buffer-A buffer-B buffer-C control-buffer) + (ediff-setup-windows-plain buffer-A buffer-B buffer-C control-buffer))) + ;; Just set up 3 windows. ;; Usually used without windowing systems ;; With windowing, we want to use dedicated frames. @@ -373,7 +383,7 @@ into icons, regardless of the window manager." ;; XEmacs used to have a lot of trouble with display ;; It did't set things right unless we tell it to sit still ;; 19.12 seems ok. - ;;(if ediff-xemacs-p (sit-for 0)) + ;;(if (featurep 'xemacs) (sit-for 0)) (split-window-vertically (max 2 (- (window-height) merge-window-lines))) (if (eq (selected-window) wind-A) @@ -436,7 +446,7 @@ into icons, regardless of the window manager." ;; XEmacs used to have a lot of trouble with display ;; It did't set things right unless we told it to sit still ;; 19.12 seems ok. - ;;(if ediff-xemacs-p (sit-for 0)) + ;;(if (featurep 'xemacs) (sit-for 0)) (funcall split-window-function wind-width-or-height) @@ -1036,7 +1046,7 @@ into icons, regardless of the window manager." (or (eq this-command 'ediff-quit) (not (eq ediff-grab-mouse t))))) - (if ediff-xemacs-p + (if (featurep 'xemacs) (ediff-with-current-buffer ctl-buffer (ediff-cond-compile-for-xemacs-or-emacs (make-local-hook 'select-frame-hook) ; xemacs @@ -1231,7 +1241,7 @@ It assumes that it is called from within the control buffer." (defun ediff-refresh-control-frame () - (if ediff-emacs-p + (if (featurep 'emacs) ;; set frame/icon titles for Emacs (modify-frame-parameters ediff-control-frame @@ -1281,7 +1291,7 @@ It assumes that it is called from within the control buffer." ;; If buff is not live, return nil (defun ediff-get-visible-buffer-window (buff) (if (ediff-buffer-live-p buff) - (if ediff-xemacs-p + (if (featurep 'xemacs) (get-buffer-window buff t) (get-buffer-window buff 'visible)))) |