(defvar default-menubar)
(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)))
'ediff-setup-windows-multiframe
'ediff-setup-windows-plain)
"*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
+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.
If you don't like the two functions provided---write your own one.
The basic guidelines:
1. It should leave the control buffer current and the control window
- selected.
- 2. It should set ediff-window-A, ediff-window-B, ediff-window-C,
- and ediff-control-window to contain window objects that display
+ selected.
+ 2. It should set `ediff-window-A', `ediff-window-B', `ediff-window-C',
+ and `ediff-control-window' to contain window objects that display
the corresponding buffers.
3. It should accept the following arguments:
buffer-A, buffer-B, buffer-C, control-buffer
:group 'ediff-window)
(defconst ediff-control-frame-parameters
- (list
+ (list
'(name . "Ediff")
;;'(unsplittable . t)
'(minibuffer . nil)
;; don't lower and auto-raise
'(auto-lower . nil)
'(auto-raise . t)
+ '(visibility . nil)
+ ;; make initial frame small to avoid distraction
+ '(width . 1) '(height . 1)
;; this blocks queries from window manager as to where to put
;; ediff's control frame. we put the frame outside the display,
;; so the initial frame won't jump all over the screen
3000))
)
"Frame parameters for displaying Ediff Control Panel.
-Do not specify width and height here. These are computed automatically.")
+Used internally---not a user option.")
;; position of the mouse; used to decide whether to warp the mouse into ctl
;; frame
(defcustom ediff-grab-mouse t
"*If t, Ediff will always grab the mouse and put it in the control frame.
If 'maybe, Ediff will do it sometimes, but not after operations that require
-relatively long time. If nil, the mouse will be entirely user's
+relatively long time. If nil, the mouse will be entirely user's
responsibility."
:type 'boolean
:group 'ediff-window)
(defcustom ediff-control-frame-position-function 'ediff-make-frame-position
"Function to call to determine the desired location for the control panel.
Expects three parameters: the control buffer, the desired width and height
-of the control frame. It returns an association list
+of the control frame. It returns an association list
of the form \(\(top . <position>\) \(left . <position>\)\)"
:type 'function
:group 'ediff-window)
-(defcustom ediff-control-frame-upward-shift (if ediff-xemacs-p 42 14)
+(defcustom ediff-control-frame-upward-shift 42
"*The upward shift of control frame from the top of buffer A's frame.
Measured in pixels.
This is used by the default control frame positioning function,
-`ediff-make-frame-position'. This variable is provided for easy
-customization of the default."
+`ediff-make-frame-position'. This variable is provided for easy
+customization of the default control frame positioning."
:type 'integer
:group 'ediff-window)
Measured in characters.
This is used by the default control frame positioning function,
`ediff-make-frame-position' to adjust the position of the control frame
-when it shows the short menu. This variable is provided for easy
+when it shows the short menu. This variable is provided for easy
customization of the default."
:type 'integer
:group 'ediff-window)
Measured in characters.
This is used by the default control frame positioning function,
`ediff-make-frame-position' to adjust the position of the control frame
-when it shows the full menu. This variable is provided for easy
+when it shows the full menu. This variable is provided for easy
customization of the default."
:type 'integer
:group 'ediff-window)
;; t means Ediff is using wide display
(ediff-defvar-local ediff-wide-display-p nil "")
;; keeps frame config for toggling wide display
-(ediff-defvar-local ediff-wide-display-orig-parameters nil
+(ediff-defvar-local ediff-wide-display-orig-parameters nil
"Frame parameters to be restored when the user wants to toggle the wide
display off.")
(ediff-defvar-local ediff-wide-display-frame nil
"Frame to be used for wide display.")
(ediff-defvar-local ediff-make-wide-display-function 'ediff-make-wide-display
"The value is a function that is called to create a wide display.
-The function is called without arguments. It should resize the frame in
+The function is called without arguments. It should resize the frame in
which buffers A, B, and C are to be displayed, and it should save the old
frame parameters in `ediff-wide-display-orig-parameters'.
The variable `ediff-wide-display-frame' should be set to contain
This is only useful in Emacs and only for certain kinds of window managers,
such as TWM and its derivatives, since the window manager must permit
-keyboard input to go into icons. XEmacs completely ignores keyboard input
+keyboard input to go into icons. XEmacs completely ignores keyboard input
into icons, regardless of the window manager."
:type 'boolean
:group 'ediff-window)
(defun ediff-get-window-by-clicking (wind prev-wind wind-number)
(let (event)
(message
- "Select windows by clicking. Please click on Window %d " wind-number)
+ "Select windows by clicking. Please click on Window %d " wind-number)
(while (not (ediff-mouse-event-p (setq event (ediff-read-event))))
(if (sit-for 1) ; if sequence of events, wait till the final word
(beep 1))
(setq ediff-window-setup-function 'ediff-setup-windows-plain))
(or (ediff-keep-window-config control-buffer)
- (funcall
+ (funcall
(ediff-with-current-buffer control-buffer ediff-window-setup-function)
buffer-A buffer-B buffer-C control-buffer))
(run-hooks 'ediff-after-setup-windows-hook))
(if ediff-merge-job
(ediff-setup-windows-plain-merge
buffer-A buffer-B buffer-C control-buffer)
- (ediff-setup-windows-plain-compare
+ (ediff-setup-windows-plain-compare
buffer-A buffer-B buffer-C control-buffer)))
(defun ediff-setup-windows-plain-merge (buf-A buf-B buf-C control-buffer)
;; skip dedicated and unsplittable frames
(ediff-destroy-control-frame control-buffer)
(let ((window-min-height 1)
- split-window-function
+ split-window-function
merge-window-share merge-window-lines
wind-A wind-B wind-C)
(ediff-with-current-buffer control-buffer
(ediff-setup-control-buffer control-buffer)
;; go to the upper window and split it betw A, B, and possibly C
- (other-window 1)
+ (other-window 1)
(setq merge-window-lines
(max 2 (round (* (window-height) merge-window-share))))
(switch-to-buffer buf-A)
;;(if ediff-xemacs-p (sit-for 0))
(split-window-vertically (max 2 (- (window-height) merge-window-lines)))
- (if (eq (selected-window) wind-A)
+ (if (eq (selected-window) wind-A)
(other-window 1))
(setq wind-C (selected-window))
(switch-to-buffer buf-C)
(ediff-setup-control-buffer control-buffer)
;; go to the upper window and split it betw A, B, and possibly C
- (other-window 1)
+ (other-window 1)
(switch-to-buffer buf-A)
(setq wind-A (selected-window))
(if three-way-comparison
;;; 1. Never use frames that have dedicated windows in them---it is bad to
;;; destroy dedicated windows.
;;; 2. If A and B are in the same frame but C's frame is different--- use one
-;;; frame for A and B and use a separate frame for C.
+;;; frame for A and B and use a separate frame for C.
;;; 3. If C's frame is non-existent, then: if the first suitable
;;; non-dedicated frame is different from A&B's, then use it for C.
;;; Otherwise, put A,B, and C in one frame.
;;; 4. If buffers A, B, C are is separate frames, use them to display these
;;; buffers.
- ;; Skip dedicated or iconified frames.
+ ;; Skip dedicated or iconified frames.
;; Unsplittable frames are taken care of later.
(ediff-skip-unsuitable-frames 'ok-unsplittable)
(frame-B (if wind-B (window-frame wind-B)))
(frame-C (if wind-C (window-frame wind-C)))
;; on wide display, do things in one frame
- (force-one-frame
+ (force-one-frame
(ediff-with-current-buffer control-buf ediff-wide-display-p))
;; this lets us have local versions of ediff-split-window-function
- (split-window-function
+ (split-window-function
(ediff-with-current-buffer control-buf ediff-split-window-function))
(orig-wind (selected-window))
(orig-frame (selected-frame))
(if (and use-same-frame-for-AB ; implies wind A and B are suitable
(window-live-p wind-A))
- (progn
+ (progn
;; wind-A must already be displaying buf-A
(select-window wind-A)
(delete-other-windows)
(setq wind-A (selected-window))
(funcall split-window-function)
- (if (eq (selected-window) wind-A)
+ (if (eq (selected-window) wind-A)
(other-window 1))
(switch-to-buffer buf-B)
(setq wind-B (selected-window))
(split-window-vertically
(max 2 (- (window-height) merge-window-lines)))
- (if (eq (selected-window) wind-A)
+ (if (eq (selected-window) wind-A)
(other-window 1))
(setq wind-C (selected-window))
(switch-to-buffer buf-C)
(select-window wind-A)
(funcall split-window-function)
- (if (eq (selected-window) wind-A)
+ (if (eq (selected-window) wind-A)
(other-window 1))
(switch-to-buffer buf-B)
(setq wind-B (selected-window))
;; Window setup for all comparison jobs, including 3way comparisons
(defun ediff-setup-windows-multiframe-compare (buf-A buf-B buf-C control-buf)
;;; Algorithm:
-;;; If a buffer is seen in a frame, use that frame for that buffer.
+;;; If a buffer is seen in a frame, use that frame for that buffer.
;;; If it is not seen, use the current frame.
;;; If both buffers are not seen, they share the current frame. If one
;;; of the buffers is not seen, it is placed in the current frame (where
-;;; ediff started). If that frame is displaying the other buffer, it is
+;;; ediff started). If that frame is displaying the other buffer, it is
;;; shared between the two buffers.
;;; However, if we decide to put both buffers in one frame
;;; and the selected frame isn't splittable, we create a new frame and
(ctl-frame-exists-p (ediff-with-current-buffer control-buf
(frame-live-p ediff-control-frame)))
;; on wide display, do things in one frame
- (force-one-frame
+ (force-one-frame
(ediff-with-current-buffer control-buf ediff-wide-display-p))
;; this lets us have local versions of ediff-split-window-function
- (split-window-function
+ (split-window-function
(ediff-with-current-buffer control-buf ediff-split-window-function))
(three-way-comparison
(ediff-with-current-buffer control-buf ediff-3way-comparison-job))
(and (not (frame-live-p frame-A))
(or ctl-frame-exists-p
(eq frame-B (selected-frame))))))
- wind-A-start wind-B-start
+ wind-A-start wind-B-start
designated-minibuffer-frame
done-A done-B done-C)
3)))
(funcall split-window-function wind-width-or-height)
- (if (eq (selected-window) wind-A)
+ (if (eq (selected-window) wind-A)
(other-window 1))
(switch-to-buffer buf-B)
(setq wind-B (selected-window))
(or done-A ; Buf A to be set in its own frame
;;; or it was set before because use-same-frame = 1
- (progn
+ (progn
;; Buf-A was not set up yet as it wasn't visible,
;; and use-same-frame = nil
(select-window orig-wind)
))
(or done-B ; Buf B to be set in its own frame
;;; or it was set before because use-same-frame = 1
- (progn
+ (progn
;; Buf-B was not set up yet as it wasn't visible,
;; and use-same-frame = nil
(select-window orig-wind)
(if three-way-comparison
(or done-C ; Buf C to be set in its own frame
;;; or it was set before because use-same-frame = 1
- (progn
+ (progn
;; Buf-C was not set up yet as it wasn't visible,
;; and use-same-frame = nil
(select-window orig-wind)
(window-frame (minibuffer-window frame-A))))
;; It is unlikely that we'll implement a version of ediff-windows that
- ;; would compare 3 windows at once. So, we don't use buffer C here.
+ ;; would compare 3 windows at once. So, we don't use buffer C here.
(if ediff-windows-job
(progn
(set-window-start wind-A wind-A-start)
(or
(ediff-frame-has-dedicated-windows (selected-frame))
(ediff-frame-iconified-p (selected-frame))
+ ;; skip small frames
(< (frame-height (selected-frame))
(* 3 window-min-height))
+ ;; skip small windows
+ (< (window-height (selected-window))
+ (* 3 window-min-height))
(if ok-unsplittable
nil
(ediff-frame-unsplittable-p (selected-frame)))))
ans)
(select-frame frame)
(walk-windows
- (function (lambda (wind)
- (if (window-dedicated-p wind)
- (setq ans t))))
+ (lambda (wind) (if (window-dedicated-p wind)
+ (setq ans t)))
'ignore-minibuffer
frame)
(select-frame cur-fr)
(defun ediff-window-ok-for-display (wind)
(and
(window-live-p wind)
- (or
+ (or
;; only one window
(eq wind (next-window wind 'ignore-minibuffer (window-frame wind)))
;; none is dedicated
(defun ediff-setup-control-frame (ctl-buffer designated-minibuffer-frame)
(let ((window-min-height 1)
ctl-frame-iconified-p dont-iconify-ctl-frame deiconify-ctl-frame
- ctl-frame old-ctl-frame lines
+ ctl-frame old-ctl-frame lines
;; user-grabbed-mouse
- fheight fwidth adjusted-parameters)
+ fheight fwidth adjusted-parameters)
(ediff-with-current-buffer ctl-buffer
(if ediff-xemacs-p (set-buffer-menubar nil))
(setq ctl-frame (if (frame-live-p old-ctl-frame)
old-ctl-frame
(make-frame ediff-control-frame-parameters))
- ediff-control-frame ctl-frame))
+ ediff-control-frame ctl-frame)
+ (when (and ediff-emacs-p (face-attribute 'mode-line :box))
+ (set-face-attribute 'mode-line ctl-frame :box nil)))
(setq ctl-frame-iconified-p (ediff-frame-iconified-p ctl-frame))
(select-frame ctl-frame)
(ediff-setup-control-buffer ctl-buffer)
(setq dont-iconify-ctl-frame
(not (string= ediff-help-message ediff-brief-help-message)))
- (setq deiconify-ctl-frame
+ (setq deiconify-ctl-frame
(and (eq this-command 'ediff-toggle-help)
dont-iconify-ctl-frame))
(cons '(auto-raise . nil) adjusted-parameters)))
;; In XEmacs, buffer menubar needs to be killed before frame parameters
- ;; are changed.
+ ;; are changed.
(if (ediff-has-toolbar-support-p)
(progn
(set-specifier top-toolbar-height (list ctl-frame 2))
))
;; Under OS/2 (emx) we have to call modify frame parameters twice, in order
- ;; to make sure that at least once we do it for non-iconified frame. If
+ ;; to make sure that at least once we do it for non-iconified frame. If
;; appears that in the OS/2 port of Emacs, one can't modify frame
- ;; parameters of iconified frames. As a precaution, we do likewise for
+ ;; parameters of iconified frames. As a precaution, we do likewise for
;; windows-nt.
(if (memq system-type '(emx windows-nt windows-95))
(modify-frame-parameters ctl-frame adjusted-parameters))
(modify-frame-parameters ctl-frame adjusted-parameters)
(make-frame-visible ctl-frame)
- ;; This works around a bug in 19.25 and earlier. There, if frame gets
+ ;; This works around a bug in 19.25 and earlier. There, if frame gets
;; iconified, the current buffer changes to that of the frame that
;; becomes exposed as a result of this iconification.
;; So, we make sure the current buffer doesn't change.
(set-window-dedicated-p (selected-window) t)
- ;; Now move the frame. We must do it separately due to an obscure bug in
+ ;; Now move the frame. We must do it separately due to an obscure bug in
;; XEmacs
(modify-frame-parameters
ctl-frame
(frame-A-width (frame-width frame-A))
(ctl-frame ediff-control-frame)
horizontal-adjustment upward-adjustment
- ctl-frame-top ctl-frame-left)
+ ctl-frame-top ctl-frame-left)
;; Multiple control frames are clipped based on the value of
- ;; ediff-control-buffer-number. This is done in order not to obscure
+ ;; ediff-control-buffer-number. This is done in order not to obscure
;; other active control panels.
(setq horizontal-adjustment (* 2 ediff-control-buffer-number)
upward-adjustment (* -14 ediff-control-buffer-number))
This function modifies only the left margin and the width of the display.
It assumes that it is called from within the control buffer."
(if (not (fboundp 'ediff-display-pixel-width))
- (error "Can't determine display width."))
+ (error "Can't determine display width"))
(let* ((frame-A (window-frame ediff-window-A))
(frame-A-params (frame-parameters frame-A))
(cw (ediff-frame-char-width frame-A))
(wd (- (/ (ediff-display-pixel-width) cw) 5)))
- (setq ediff-wide-display-orig-parameters
+ (setq ediff-wide-display-orig-parameters
(list (cons 'left (max 0 (eval (cdr (assoc 'left frame-A-params)))))
(cons 'width (cdr (assoc 'width frame-A-params))))
ediff-wide-display-frame frame-A)
(if buf-C-state-merge
(concat " " buf-C-state-merge)
"")
- (if (ediff-get-state-of-ancestor
+ (if (ediff-get-state-of-ancestor
ediff-current-difference)
" AncestorEmpty"
"")
(list " " mode-line-buffer-identification)
(list "-- " mode-line-buffer-identification " Quick Help")))
;; control buffer id
- (setq mode-line-buffer-identification
+ (setq mode-line-buffer-identification
(if (ediff-narrow-control-frame-p)
(ediff-make-narrow-control-buffer-id 'skip-name)
(ediff-make-wide-control-buffer-id)))
(if skip-name
" "
(ediff-make-base-title))
- (cond ((< ediff-current-difference 0)
+ (cond ((< ediff-current-difference 0)
(format " _/%d" ediff-number-of-differences))
((>= ediff-current-difference ediff-number-of-differences)
(format " $/%d" ediff-number-of-differences))