Commit | Line | Data |
---|---|---|
475f9031 | 1 | ;;; ediff-wind.el --- window manipulation utilities |
b578f267 | 2 | |
0d30b337 | 3 | ;; Copyright (C) 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003, |
114f9c96 | 4 | ;; 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. |
475f9031 | 5 | |
50a07e18 | 6 | ;; Author: Michael Kifer <kifer@cs.stonybrook.edu> |
bd78fa1d | 7 | ;; Package: ediff |
475f9031 KH |
8 | |
9 | ;; This file is part of GNU Emacs. | |
10 | ||
eb3fa2cf | 11 | ;; GNU Emacs is free software: you can redistribute it and/or modify |
475f9031 | 12 | ;; it under the terms of the GNU General Public License as published by |
eb3fa2cf GM |
13 | ;; the Free Software Foundation, either version 3 of the License, or |
14 | ;; (at your option) any later version. | |
475f9031 KH |
15 | |
16 | ;; GNU Emacs is distributed in the hope that it will be useful, | |
17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 | ;; GNU General Public License for more details. | |
20 | ||
21 | ;; You should have received a copy of the GNU General Public License | |
eb3fa2cf | 22 | ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
475f9031 | 23 | |
3afbc435 PJ |
24 | ;;; Commentary: |
25 | ||
b578f267 | 26 | ;;; Code: |
71296446 | 27 | |
475f9031 | 28 | |
bbe6126c MK |
29 | ;; Compiler pacifier |
30 | (defvar icon-title-format) | |
31 | (defvar top-toolbar-height) | |
32 | (defvar bottom-toolbar-height) | |
33 | (defvar left-toolbar-height) | |
34 | (defvar right-toolbar-height) | |
35 | (defvar left-toolbar-width) | |
36 | (defvar right-toolbar-width) | |
37 | (defvar default-menubar) | |
50a07e18 | 38 | (defvar top-gutter) |
bbe6126c | 39 | (defvar frame-icon-title-format) |
ddc90f39 MK |
40 | (defvar ediff-diff-status) |
41 | ||
acb93bb2 MK |
42 | ;; declare-function does not exist in XEmacs |
43 | (eval-and-compile | |
44 | (unless (fboundp 'declare-function) (defmacro declare-function (&rest r)))) | |
45 | ||
ddc90f39 | 46 | (eval-when-compile |
2d84cc27 | 47 | (require 'ediff-util) |
8480ec72 | 48 | (require 'ediff-help)) |
bbe6126c MK |
49 | ;; end pacifier |
50 | ||
ddc90f39 MK |
51 | (require 'ediff-init) |
52 | ||
53 | ;; be careful with ediff-tbar | |
e83d1fe8 | 54 | (if (featurep 'xemacs) |
a5254f37 | 55 | (require 'ediff-tbar) |
ddc90f39 MK |
56 | (defun ediff-compute-toolbar-width () 0)) |
57 | ||
58 | (defgroup ediff-window nil | |
4491bde3 | 59 | "Ediff window manipulation." |
ddc90f39 MK |
60 | :prefix "ediff-" |
61 | :group 'ediff | |
62 | :group 'frames) | |
63 | ||
475f9031 | 64 | |
2d84cc27 MK |
65 | ;; Determine which window setup function to use based on current window system. |
66 | (defun ediff-choose-window-setup-function-automatically () | |
67 | (if (ediff-window-display-p) | |
68 | 'ediff-setup-windows-multiframe | |
69 | 'ediff-setup-windows-plain)) | |
70 | ||
71 | (defcustom ediff-window-setup-function (ediff-choose-window-setup-function-automatically) | |
9201cc28 | 72 | "Function called to set up windows. |
2d84cc27 MK |
73 | Ediff provides a choice of two functions: `ediff-setup-windows-plain', for |
74 | doing everything in one frame and `ediff-setup-windows-multiframe', which sets | |
75 | the control panel in a separate frame. By default, the appropriate function is | |
76 | chosen automatically depending on the current window system. | |
77 | However, `ediff-toggle-multiframe' can be used to toggle between the multiframe | |
78 | display and the single frame display. | |
79 | If the multiframe function detects that one of the buffers A/B is seen in some | |
80 | other frame, it will try to keep that buffer in that frame. | |
81 | ||
82 | If you don't like any of the two provided functions, write your own one. | |
475f9031 KH |
83 | The basic guidelines: |
84 | 1. It should leave the control buffer current and the control window | |
6628e7f8 DL |
85 | selected. |
86 | 2. It should set `ediff-window-A', `ediff-window-B', `ediff-window-C', | |
87 | and `ediff-control-window' to contain window objects that display | |
475f9031 KH |
88 | the corresponding buffers. |
89 | 3. It should accept the following arguments: | |
90 | buffer-A, buffer-B, buffer-C, control-buffer | |
91 | Buffer C may not be used in jobs that compare only two buffers. | |
92 | If you plan to do something fancy, take a close look at how the two | |
ddc90f39 | 93 | provided functions are written." |
2d84cc27 | 94 | :type '(choice (const :tag "Multi Frame" ediff-setup-windows-multiframe) |
e5184e9f MR |
95 | (const :tag "Single Frame" ediff-setup-windows-plain) |
96 | (function :tag "Other function")) | |
ddc90f39 | 97 | :group 'ediff-window) |
475f9031 KH |
98 | |
99 | ;; indicates if we are in a multiframe setup | |
100 | (ediff-defvar-local ediff-multiframe nil "") | |
101 | ||
102 | ;; Share of the frame occupied by the merge window (buffer C) | |
103 | (ediff-defvar-local ediff-merge-window-share 0.45 "") | |
104 | ||
105 | ;; The control window. | |
106 | (ediff-defvar-local ediff-control-window nil "") | |
107 | ;; Official window for buffer A | |
108 | (ediff-defvar-local ediff-window-A nil "") | |
109 | ;; Official window for buffer B | |
110 | (ediff-defvar-local ediff-window-B nil "") | |
111 | ;; Official window for buffer C | |
112 | (ediff-defvar-local ediff-window-C nil "") | |
113 | ;; Ediff's window configuration. | |
114 | ;; Used to minimize the need to rearrange windows. | |
115 | (ediff-defvar-local ediff-window-config-saved "" "") | |
116 | ||
e756eb9f MK |
117 | ;; Association between buff-type and ediff-window-* |
118 | (defconst ediff-window-alist | |
119 | '((A . ediff-window-A) | |
120 | (?A . ediff-window-A) | |
121 | (B . ediff-window-B) | |
122 | (?B . ediff-window-B) | |
123 | (C . ediff-window-C) | |
124 | (?C . ediff-window-C))) | |
125 | ||
475f9031 | 126 | |
ddc90f39 | 127 | (defcustom ediff-split-window-function 'split-window-vertically |
9201cc28 | 128 | "The function used to split the main window between buffer-A and buffer-B. |
475f9031 KH |
129 | You can set it to a horizontal split instead of the default vertical split |
130 | by setting this variable to `split-window-horizontally'. | |
131 | You can also have your own function to do fancy splits. | |
132 | This variable has no effect when buffer-A/B are shown in different frames. | |
ddc90f39 | 133 | In this case, Ediff will use those frames to display these buffers." |
c12b5b00 RS |
134 | :type '(choice |
135 | (const :tag "Split vertically" split-window-vertically) | |
136 | (const :tag "Split horizontally" split-window-horizontally) | |
137 | function) | |
ddc90f39 | 138 | :group 'ediff-window) |
475f9031 | 139 | |
ddc90f39 | 140 | (defcustom ediff-merge-split-window-function 'split-window-horizontally |
9201cc28 | 141 | "The function used to split the main window between buffer-A and buffer-B. |
475f9031 KH |
142 | You can set it to a vertical split instead of the default horizontal split |
143 | by setting this variable to `split-window-vertically'. | |
144 | You can also have your own function to do fancy splits. | |
145 | This variable has no effect when buffer-A/B/C are shown in different frames. | |
ddc90f39 | 146 | In this case, Ediff will use those frames to display these buffers." |
c12b5b00 RS |
147 | :type '(choice |
148 | (const :tag "Split vertically" split-window-vertically) | |
149 | (const :tag "Split horizontally" split-window-horizontally) | |
150 | function) | |
ddc90f39 | 151 | :group 'ediff-window) |
475f9031 | 152 | |
8e2075ea | 153 | ;; Definitions hidden from the compiler by compat wrappers. |
acb93bb2 MK |
154 | (declare-function ediff-display-pixel-width "ediff-init") |
155 | (declare-function ediff-display-pixel-height "ediff-init") | |
8e2075ea | 156 | |
475f9031 | 157 | (defconst ediff-control-frame-parameters |
6628e7f8 | 158 | (list |
4ae69eac MK |
159 | '(name . "Ediff") |
160 | ;;'(unsplittable . t) | |
161 | '(minibuffer . nil) | |
162 | '(user-position . t) ; Emacs only | |
163 | '(vertical-scroll-bars . nil) ; Emacs only | |
164 | '(scrollbar-width . 0) ; XEmacs only | |
6de0156c | 165 | '(scrollbar-height . 0) ; XEmacs only |
4ae69eac | 166 | '(menu-bar-lines . 0) ; Emacs only |
7d027816 | 167 | '(tool-bar-lines . 0) ; Emacs 21+ only |
ec6aebe8 MK |
168 | '(left-fringe . 0) |
169 | '(right-fringe . 0) | |
2e955a8b | 170 | ;; don't lower but auto-raise |
4ae69eac MK |
171 | '(auto-lower . nil) |
172 | '(auto-raise . t) | |
3af0304a MK |
173 | '(visibility . nil) |
174 | ;; make initial frame small to avoid distraction | |
175 | '(width . 1) '(height . 1) | |
4ae69eac MK |
176 | ;; this blocks queries from window manager as to where to put |
177 | ;; ediff's control frame. we put the frame outside the display, | |
178 | ;; so the initial frame won't jump all over the screen | |
179 | (cons 'top (if (fboundp 'ediff-display-pixel-height) | |
180 | (1+ (ediff-display-pixel-height)) | |
181 | 3000)) | |
182 | (cons 'left (if (fboundp 'ediff-display-pixel-width) | |
183 | (1+ (ediff-display-pixel-width)) | |
184 | 3000)) | |
185 | ) | |
475f9031 | 186 | "Frame parameters for displaying Ediff Control Panel. |
3af0304a | 187 | Used internally---not a user option.") |
475f9031 | 188 | |
6853a937 MK |
189 | ;; position of the mouse; used to decide whether to warp the mouse into ctl |
190 | ;; frame | |
191 | (ediff-defvar-local ediff-mouse-pixel-position nil "") | |
192 | ||
193 | ;; not used for now | |
50893fe9 | 194 | (defvar ediff-mouse-pixel-threshold 30 |
6853a937 MK |
195 | "If the user moves mouse more than this many pixels, Ediff won't warp mouse into control window.") |
196 | ||
ddc90f39 | 197 | (defcustom ediff-grab-mouse t |
9201cc28 | 198 | "If t, Ediff will always grab the mouse and put it in the control frame. |
6853a937 | 199 | If 'maybe, Ediff will do it sometimes, but not after operations that require |
3af0304a | 200 | relatively long time. If nil, the mouse will be entirely user's |
ddc90f39 MK |
201 | responsibility." |
202 | :type 'boolean | |
203 | :group 'ediff-window) | |
6853a937 | 204 | |
ddc90f39 | 205 | (defcustom ediff-control-frame-position-function 'ediff-make-frame-position |
475f9031 KH |
206 | "Function to call to determine the desired location for the control panel. |
207 | Expects three parameters: the control buffer, the desired width and height | |
3af0304a | 208 | of the control frame. It returns an association list |
ddc90f39 | 209 | of the form \(\(top . <position>\) \(left . <position>\)\)" |
1e70790f | 210 | :type 'function |
ddc90f39 | 211 | :group 'ediff-window) |
475f9031 | 212 | |
3af0304a | 213 | (defcustom ediff-control-frame-upward-shift 42 |
9201cc28 | 214 | "The upward shift of control frame from the top of buffer A's frame. |
475f9031 KH |
215 | Measured in pixels. |
216 | This is used by the default control frame positioning function, | |
3af0304a MK |
217 | `ediff-make-frame-position'. This variable is provided for easy |
218 | customization of the default control frame positioning." | |
ddc90f39 MK |
219 | :type 'integer |
220 | :group 'ediff-window) | |
475f9031 | 221 | |
e83d1fe8 | 222 | (defcustom ediff-narrow-control-frame-leftward-shift (if (featurep 'xemacs) 7 3) |
9201cc28 | 223 | "The leftward shift of control frame from the right edge of buf A's frame. |
475f9031 KH |
224 | Measured in characters. |
225 | This is used by the default control frame positioning function, | |
226 | `ediff-make-frame-position' to adjust the position of the control frame | |
3af0304a | 227 | when it shows the short menu. This variable is provided for easy |
ddc90f39 MK |
228 | customization of the default." |
229 | :type 'integer | |
230 | :group 'ediff-window) | |
475f9031 | 231 | |
ddc90f39 | 232 | (defcustom ediff-wide-control-frame-rightward-shift 7 |
9201cc28 | 233 | "The rightward shift of control frame from the left edge of buf A's frame. |
475f9031 KH |
234 | Measured in characters. |
235 | This is used by the default control frame positioning function, | |
236 | `ediff-make-frame-position' to adjust the position of the control frame | |
3af0304a | 237 | when it shows the full menu. This variable is provided for easy |
ddc90f39 MK |
238 | customization of the default." |
239 | :type 'integer | |
240 | :group 'ediff-window) | |
475f9031 KH |
241 | |
242 | ||
243 | ;; Wide frame display | |
244 | ||
245 | ;; t means Ediff is using wide display | |
246 | (ediff-defvar-local ediff-wide-display-p nil "") | |
247 | ;; keeps frame config for toggling wide display | |
6628e7f8 | 248 | (ediff-defvar-local ediff-wide-display-orig-parameters nil |
475f9031 KH |
249 | "Frame parameters to be restored when the user wants to toggle the wide |
250 | display off.") | |
251 | (ediff-defvar-local ediff-wide-display-frame nil | |
252 | "Frame to be used for wide display.") | |
253 | (ediff-defvar-local ediff-make-wide-display-function 'ediff-make-wide-display | |
254 | "The value is a function that is called to create a wide display. | |
3af0304a | 255 | The function is called without arguments. It should resize the frame in |
475f9031 KH |
256 | which buffers A, B, and C are to be displayed, and it should save the old |
257 | frame parameters in `ediff-wide-display-orig-parameters'. | |
258 | The variable `ediff-wide-display-frame' should be set to contain | |
259 | the frame used for the wide display.") | |
260 | ||
261 | ;; Frame used for the control panel in a windowing system. | |
262 | (ediff-defvar-local ediff-control-frame nil "") | |
263 | ||
ddc90f39 | 264 | (defcustom ediff-prefer-iconified-control-frame nil |
9201cc28 | 265 | "If t, keep control panel iconified when help message is off. |
475f9031 | 266 | This has effect only on a windowing system. |
50893fe9 | 267 | If t, hitting `?' to toggle control panel off iconifies it. |
475f9031 KH |
268 | |
269 | This is only useful in Emacs and only for certain kinds of window managers, | |
270 | such as TWM and its derivatives, since the window manager must permit | |
3af0304a | 271 | keyboard input to go into icons. XEmacs completely ignores keyboard input |
ddc90f39 MK |
272 | into icons, regardless of the window manager." |
273 | :type 'boolean | |
274 | :group 'ediff-window) | |
475f9031 KH |
275 | |
276 | ;;; Functions | |
277 | ||
278 | (defun ediff-get-window-by-clicking (wind prev-wind wind-number) | |
279 | (let (event) | |
280 | (message | |
3af0304a | 281 | "Select windows by clicking. Please click on Window %d " wind-number) |
475f9031 KH |
282 | (while (not (ediff-mouse-event-p (setq event (ediff-read-event)))) |
283 | (if (sit-for 1) ; if sequence of events, wait till the final word | |
284 | (beep 1)) | |
285 | (message "Please click on Window %d " wind-number)) | |
286 | (ediff-read-event) ; discard event | |
f6d49b2f GM |
287 | (setq wind (if (featurep 'xemacs) |
288 | (event-window event) | |
289 | (posn-window (event-start event)))))) | |
71296446 | 290 | |
475f9031 | 291 | |
55d7ff38 | 292 | ;; Select the lowest window on the frame. |
475f9031 | 293 | (defun ediff-select-lowest-window () |
f6d49b2f | 294 | (if (featurep 'xemacs) |
2d84cc27 | 295 | (select-window (frame-lowest-window)) |
f6d49b2f GM |
296 | (let* ((lowest-window (selected-window)) |
297 | (bottom-edge (car (cdr (cdr (cdr (window-edges)))))) | |
298 | (last-window (save-excursion | |
299 | (other-window -1) (selected-window))) | |
300 | (window-search t)) | |
301 | (while window-search | |
302 | (let* ((this-window (next-window)) | |
303 | (next-bottom-edge | |
304 | (car (cdr (cdr (cdr (window-edges this-window))))))) | |
305 | (if (< bottom-edge next-bottom-edge) | |
306 | (setq bottom-edge next-bottom-edge | |
307 | lowest-window this-window)) | |
308 | (select-window this-window) | |
309 | (when (eq last-window this-window) | |
310 | (select-window lowest-window) | |
311 | (setq window-search nil))))))) | |
475f9031 | 312 | |
475f9031 KH |
313 | |
314 | ;;; Common window setup routines | |
315 | ||
316 | ;; Set up the window configuration. If POS is given, set the points to | |
317 | ;; the beginnings of the buffers. | |
318 | ;; When 3way comparison is added, this will have to choose the appropriate | |
319 | ;; setup function based on ediff-job-name | |
320 | (defun ediff-setup-windows (buffer-A buffer-B buffer-C control-buffer) | |
321 | ;; Make sure we are not in the minibuffer window when we try to delete | |
322 | ;; all other windows. | |
6853a937 | 323 | (run-hooks 'ediff-before-setup-windows-hook) |
475f9031 KH |
324 | (if (eq (selected-window) (minibuffer-window)) |
325 | (other-window 1)) | |
71296446 | 326 | |
18b5607f KH |
327 | ;; in case user did a no-no on a tty |
328 | (or (ediff-window-display-p) | |
329 | (setq ediff-window-setup-function 'ediff-setup-windows-plain)) | |
71296446 | 330 | |
475f9031 | 331 | (or (ediff-keep-window-config control-buffer) |
6628e7f8 | 332 | (funcall |
e756eb9f | 333 | (ediff-with-current-buffer control-buffer ediff-window-setup-function) |
475f9031 | 334 | buffer-A buffer-B buffer-C control-buffer)) |
6853a937 | 335 | (run-hooks 'ediff-after-setup-windows-hook)) |
475f9031 KH |
336 | |
337 | ;; Just set up 3 windows. | |
338 | ;; Usually used without windowing systems | |
339 | ;; With windowing, we want to use dedicated frames. | |
340 | (defun ediff-setup-windows-plain (buffer-A buffer-B buffer-C control-buffer) | |
e756eb9f | 341 | (ediff-with-current-buffer control-buffer |
475f9031 KH |
342 | (setq ediff-multiframe nil)) |
343 | (if ediff-merge-job | |
344 | (ediff-setup-windows-plain-merge | |
345 | buffer-A buffer-B buffer-C control-buffer) | |
6628e7f8 | 346 | (ediff-setup-windows-plain-compare |
475f9031 | 347 | buffer-A buffer-B buffer-C control-buffer))) |
71296446 | 348 | |
475f9031 | 349 | (defun ediff-setup-windows-plain-merge (buf-A buf-B buf-C control-buffer) |
18b5607f KH |
350 | ;; skip dedicated and unsplittable frames |
351 | (ediff-destroy-control-frame control-buffer) | |
4ae69eac | 352 | (let ((window-min-height 1) |
6628e7f8 | 353 | split-window-function |
475f9031 KH |
354 | merge-window-share merge-window-lines |
355 | wind-A wind-B wind-C) | |
e756eb9f | 356 | (ediff-with-current-buffer control-buffer |
475f9031 KH |
357 | (setq merge-window-share ediff-merge-window-share |
358 | ;; this lets us have local versions of ediff-split-window-function | |
359 | split-window-function ediff-split-window-function)) | |
360 | (delete-other-windows) | |
2d84cc27 | 361 | (set-window-dedicated-p (selected-window) nil) |
475f9031 KH |
362 | (split-window-vertically) |
363 | (ediff-select-lowest-window) | |
364 | (ediff-setup-control-buffer control-buffer) | |
71296446 | 365 | |
475f9031 | 366 | ;; go to the upper window and split it betw A, B, and possibly C |
6628e7f8 | 367 | (other-window 1) |
475f9031 KH |
368 | (setq merge-window-lines |
369 | (max 2 (round (* (window-height) merge-window-share)))) | |
370 | (switch-to-buffer buf-A) | |
371 | (setq wind-A (selected-window)) | |
71296446 | 372 | |
6853a937 MK |
373 | ;; XEmacs used to have a lot of trouble with display |
374 | ;; It did't set things right unless we tell it to sit still | |
375 | ;; 19.12 seems ok. | |
e83d1fe8 | 376 | ;;(if (featurep 'xemacs) (sit-for 0)) |
71296446 | 377 | |
475f9031 | 378 | (split-window-vertically (max 2 (- (window-height) merge-window-lines))) |
6628e7f8 | 379 | (if (eq (selected-window) wind-A) |
475f9031 KH |
380 | (other-window 1)) |
381 | (setq wind-C (selected-window)) | |
382 | (switch-to-buffer buf-C) | |
71296446 | 383 | |
475f9031 KH |
384 | (select-window wind-A) |
385 | (funcall split-window-function) | |
71296446 | 386 | |
475f9031 KH |
387 | (if (eq (selected-window) wind-A) |
388 | (other-window 1)) | |
389 | (switch-to-buffer buf-B) | |
390 | (setq wind-B (selected-window)) | |
71296446 | 391 | |
e756eb9f | 392 | (ediff-with-current-buffer control-buffer |
475f9031 KH |
393 | (setq ediff-window-A wind-A |
394 | ediff-window-B wind-B | |
395 | ediff-window-C wind-C)) | |
71296446 | 396 | |
475f9031 KH |
397 | (ediff-select-lowest-window) |
398 | (ediff-setup-control-buffer control-buffer) | |
399 | )) | |
400 | ||
71296446 | 401 | |
475f9031 KH |
402 | ;; This function handles all comparison jobs, including 3way jobs |
403 | (defun ediff-setup-windows-plain-compare (buf-A buf-B buf-C control-buffer) | |
404 | ;; skip dedicated and unsplittable frames | |
18b5607f | 405 | (ediff-destroy-control-frame control-buffer) |
4ae69eac | 406 | (let ((window-min-height 1) |
475f9031 KH |
407 | split-window-function wind-width-or-height |
408 | three-way-comparison | |
18b5607f | 409 | wind-A-start wind-B-start wind-A wind-B wind-C) |
e756eb9f | 410 | (ediff-with-current-buffer control-buffer |
475f9031 KH |
411 | (setq wind-A-start (ediff-overlay-start |
412 | (ediff-get-value-according-to-buffer-type | |
413 | 'A ediff-narrow-bounds)) | |
414 | wind-B-start (ediff-overlay-start | |
415 | (ediff-get-value-according-to-buffer-type | |
416 | 'B ediff-narrow-bounds)) | |
475f9031 KH |
417 | ;; this lets us have local versions of ediff-split-window-function |
418 | split-window-function ediff-split-window-function | |
419 | three-way-comparison ediff-3way-comparison-job)) | |
42acc581 MK |
420 | ;; if in minibuffer go somewhere else |
421 | (if (save-match-data | |
422 | (string-match "\*Minibuf-" (buffer-name (window-buffer)))) | |
423 | (select-window (next-window nil 'ignore-minibuf))) | |
475f9031 | 424 | (delete-other-windows) |
2d84cc27 | 425 | (set-window-dedicated-p (selected-window) nil) |
475f9031 KH |
426 | (split-window-vertically) |
427 | (ediff-select-lowest-window) | |
428 | (ediff-setup-control-buffer control-buffer) | |
71296446 | 429 | |
475f9031 | 430 | ;; go to the upper window and split it betw A, B, and possibly C |
6628e7f8 | 431 | (other-window 1) |
475f9031 KH |
432 | (switch-to-buffer buf-A) |
433 | (setq wind-A (selected-window)) | |
434 | (if three-way-comparison | |
435 | (setq wind-width-or-height | |
436 | (/ (if (eq split-window-function 'split-window-vertically) | |
437 | (window-height wind-A) | |
438 | (window-width wind-A)) | |
439 | 3))) | |
71296446 | 440 | |
6853a937 MK |
441 | ;; XEmacs used to have a lot of trouble with display |
442 | ;; It did't set things right unless we told it to sit still | |
443 | ;; 19.12 seems ok. | |
e83d1fe8 | 444 | ;;(if (featurep 'xemacs) (sit-for 0)) |
71296446 | 445 | |
475f9031 | 446 | (funcall split-window-function wind-width-or-height) |
71296446 | 447 | |
475f9031 KH |
448 | (if (eq (selected-window) wind-A) |
449 | (other-window 1)) | |
450 | (switch-to-buffer buf-B) | |
451 | (setq wind-B (selected-window)) | |
71296446 | 452 | |
475f9031 KH |
453 | (if three-way-comparison |
454 | (progn | |
455 | (funcall split-window-function) ; equally | |
456 | (if (eq (selected-window) wind-B) | |
457 | (other-window 1)) | |
458 | (switch-to-buffer buf-C) | |
459 | (setq wind-C (selected-window)))) | |
71296446 | 460 | |
e756eb9f | 461 | (ediff-with-current-buffer control-buffer |
475f9031 KH |
462 | (setq ediff-window-A wind-A |
463 | ediff-window-B wind-B | |
464 | ediff-window-C wind-C)) | |
71296446 | 465 | |
475f9031 KH |
466 | ;; It is unlikely that we will want to implement 3way window comparison. |
467 | ;; So, only buffers A and B are used here. | |
18b5607f | 468 | (if ediff-windows-job |
475f9031 KH |
469 | (progn |
470 | (set-window-start wind-A wind-A-start) | |
471 | (set-window-start wind-B wind-B-start))) | |
71296446 | 472 | |
475f9031 KH |
473 | (ediff-select-lowest-window) |
474 | (ediff-setup-control-buffer control-buffer) | |
475 | )) | |
476 | ||
71296446 | 477 | |
4ae69eac | 478 | ;; dispatch an appropriate window setup function |
475f9031 | 479 | (defun ediff-setup-windows-multiframe (buf-A buf-B buf-C control-buf) |
e756eb9f | 480 | (ediff-with-current-buffer control-buf |
475f9031 KH |
481 | (setq ediff-multiframe t)) |
482 | (if ediff-merge-job | |
483 | (ediff-setup-windows-multiframe-merge buf-A buf-B buf-C control-buf) | |
484 | (ediff-setup-windows-multiframe-compare buf-A buf-B buf-C control-buf))) | |
71296446 | 485 | |
475f9031 KH |
486 | (defun ediff-setup-windows-multiframe-merge (buf-A buf-B buf-C control-buf) |
487 | ;;; Algorithm: | |
bbe6126c MK |
488 | ;;; 1. Never use frames that have dedicated windows in them---it is bad to |
489 | ;;; destroy dedicated windows. | |
490 | ;;; 2. If A and B are in the same frame but C's frame is different--- use one | |
6628e7f8 | 491 | ;;; frame for A and B and use a separate frame for C. |
bbe6126c MK |
492 | ;;; 3. If C's frame is non-existent, then: if the first suitable |
493 | ;;; non-dedicated frame is different from A&B's, then use it for C. | |
494 | ;;; Otherwise, put A,B, and C in one frame. | |
495 | ;;; 4. If buffers A, B, C are is separate frames, use them to display these | |
496 | ;;; buffers. | |
475f9031 | 497 | |
6628e7f8 | 498 | ;; Skip dedicated or iconified frames. |
18b5607f | 499 | ;; Unsplittable frames are taken care of later. |
475f9031 | 500 | (ediff-skip-unsuitable-frames 'ok-unsplittable) |
71296446 | 501 | |
4ae69eac | 502 | (let* ((window-min-height 1) |
475f9031 KH |
503 | (wind-A (ediff-get-visible-buffer-window buf-A)) |
504 | (wind-B (ediff-get-visible-buffer-window buf-B)) | |
505 | (wind-C (ediff-get-visible-buffer-window buf-C)) | |
18b5607f KH |
506 | (frame-A (if wind-A (window-frame wind-A))) |
507 | (frame-B (if wind-B (window-frame wind-B))) | |
508 | (frame-C (if wind-C (window-frame wind-C))) | |
475f9031 | 509 | ;; on wide display, do things in one frame |
6628e7f8 | 510 | (force-one-frame |
e756eb9f | 511 | (ediff-with-current-buffer control-buf ediff-wide-display-p)) |
475f9031 | 512 | ;; this lets us have local versions of ediff-split-window-function |
6628e7f8 | 513 | (split-window-function |
e756eb9f | 514 | (ediff-with-current-buffer control-buf ediff-split-window-function)) |
475f9031 | 515 | (orig-wind (selected-window)) |
18b5607f | 516 | (orig-frame (selected-frame)) |
475f9031 | 517 | (use-same-frame (or force-one-frame |
bbe6126c | 518 | ;; A and C must be in one frame |
475f9031 | 519 | (eq frame-A (or frame-C orig-frame)) |
bbe6126c | 520 | ;; B and C must be in one frame |
475f9031 | 521 | (eq frame-B (or frame-C orig-frame)) |
bbe6126c | 522 | ;; A or B is not visible |
18b5607f KH |
523 | (not (frame-live-p frame-A)) |
524 | (not (frame-live-p frame-B)) | |
bbe6126c MK |
525 | ;; A or B is not suitable for display |
526 | (not (ediff-window-ok-for-display wind-A)) | |
527 | (not (ediff-window-ok-for-display wind-B)) | |
528 | ;; A and B in the same frame, and no good frame | |
529 | ;; for C | |
18b5607f KH |
530 | (and (eq frame-A frame-B) |
531 | (not (frame-live-p frame-C))) | |
475f9031 | 532 | )) |
bbe6126c | 533 | ;; use-same-frame-for-AB implies wind A and B are ok for display |
475f9031 KH |
534 | (use-same-frame-for-AB (and (not use-same-frame) |
535 | (eq frame-A frame-B))) | |
e756eb9f | 536 | (merge-window-share (ediff-with-current-buffer control-buf |
475f9031 KH |
537 | ediff-merge-window-share)) |
538 | merge-window-lines | |
539 | designated-minibuffer-frame | |
540 | done-A done-B done-C) | |
71296446 | 541 | |
475f9031 KH |
542 | ;; buf-A on its own |
543 | (if (and (window-live-p wind-A) | |
bbe6126c | 544 | (null use-same-frame) ; implies wind-A is suitable |
475f9031 | 545 | (null use-same-frame-for-AB)) |
bbe6126c MK |
546 | (progn ; bug A on its own |
547 | ;; buffer buf-A is seen in live wind-A | |
475f9031 KH |
548 | (select-window wind-A) |
549 | (delete-other-windows) | |
475f9031 KH |
550 | (setq wind-A (selected-window)) |
551 | (setq done-A t))) | |
71296446 | 552 | |
475f9031 | 553 | ;; buf-B on its own |
bbe6126c MK |
554 | (if (and (window-live-p wind-B) |
555 | (null use-same-frame) ; implies wind-B is suitable | |
556 | (null use-same-frame-for-AB)) | |
557 | (progn ; buf B on its own | |
558 | ;; buffer buf-B is seen in live wind-B | |
475f9031 KH |
559 | (select-window wind-B) |
560 | (delete-other-windows) | |
475f9031 KH |
561 | (setq wind-B (selected-window)) |
562 | (setq done-B t))) | |
71296446 | 563 | |
475f9031 | 564 | ;; buf-C on its own |
bbe6126c MK |
565 | (if (and (window-live-p wind-C) |
566 | (ediff-window-ok-for-display wind-C) | |
567 | (null use-same-frame)) ; buf C on its own | |
475f9031 | 568 | (progn |
bbe6126c | 569 | ;; buffer buf-C is seen in live wind-C |
475f9031 KH |
570 | (select-window wind-C) |
571 | (delete-other-windows) | |
475f9031 KH |
572 | (setq wind-C (selected-window)) |
573 | (setq done-C t))) | |
71296446 | 574 | |
bbe6126c MK |
575 | (if (and use-same-frame-for-AB ; implies wind A and B are suitable |
576 | (window-live-p wind-A)) | |
6628e7f8 | 577 | (progn |
bbe6126c MK |
578 | ;; wind-A must already be displaying buf-A |
579 | (select-window wind-A) | |
475f9031 KH |
580 | (delete-other-windows) |
581 | (setq wind-A (selected-window)) | |
71296446 | 582 | |
475f9031 | 583 | (funcall split-window-function) |
6628e7f8 | 584 | (if (eq (selected-window) wind-A) |
475f9031 KH |
585 | (other-window 1)) |
586 | (switch-to-buffer buf-B) | |
587 | (setq wind-B (selected-window)) | |
71296446 | 588 | |
475f9031 KH |
589 | (setq done-A t |
590 | done-B t))) | |
71296446 | 591 | |
475f9031 | 592 | (if use-same-frame |
bbe6126c | 593 | (let ((window-min-height 1)) |
ddc90f39 MK |
594 | (if (and (eq frame-A frame-B) |
595 | (eq frame-B frame-C) | |
596 | (frame-live-p frame-A)) | |
597 | (select-frame frame-A) | |
598 | ;; avoid dedicated and non-splittable windows | |
599 | (ediff-skip-unsuitable-frames)) | |
475f9031 KH |
600 | (delete-other-windows) |
601 | (setq merge-window-lines | |
602 | (max 2 (round (* (window-height) merge-window-share)))) | |
603 | (switch-to-buffer buf-A) | |
604 | (setq wind-A (selected-window)) | |
71296446 | 605 | |
475f9031 KH |
606 | (split-window-vertically |
607 | (max 2 (- (window-height) merge-window-lines))) | |
6628e7f8 | 608 | (if (eq (selected-window) wind-A) |
475f9031 KH |
609 | (other-window 1)) |
610 | (setq wind-C (selected-window)) | |
611 | (switch-to-buffer buf-C) | |
71296446 | 612 | |
475f9031 | 613 | (select-window wind-A) |
71296446 | 614 | |
475f9031 | 615 | (funcall split-window-function) |
6628e7f8 | 616 | (if (eq (selected-window) wind-A) |
475f9031 KH |
617 | (other-window 1)) |
618 | (switch-to-buffer buf-B) | |
619 | (setq wind-B (selected-window)) | |
71296446 | 620 | |
475f9031 KH |
621 | (setq done-A t |
622 | done-B t | |
623 | done-C t) | |
624 | )) | |
71296446 | 625 | |
bbe6126c MK |
626 | (or done-A ; Buf A to be set in its own frame, |
627 | ;;; or it was set before because use-same-frame = 1 | |
628 | (progn | |
629 | ;; Buf-A was not set up yet as it wasn't visible, | |
630 | ;; and use-same-frame = nil, use-same-frame-for-AB = nil | |
475f9031 KH |
631 | (select-window orig-wind) |
632 | (delete-other-windows) | |
633 | (switch-to-buffer buf-A) | |
634 | (setq wind-A (selected-window)) | |
635 | )) | |
bbe6126c MK |
636 | (or done-B ; Buf B to be set in its own frame, |
637 | ;;; or it was set before because use-same-frame = 1 | |
638 | (progn | |
639 | ;; Buf-B was not set up yet as it wasn't visible | |
640 | ;; and use-same-frame = nil, use-same-frame-for-AB = nil | |
475f9031 KH |
641 | (select-window orig-wind) |
642 | (delete-other-windows) | |
643 | (switch-to-buffer buf-B) | |
644 | (setq wind-B (selected-window)) | |
645 | )) | |
71296446 | 646 | |
bbe6126c MK |
647 | (or done-C ; Buf C to be set in its own frame, |
648 | ;;; or it was set before because use-same-frame = 1 | |
649 | (progn | |
650 | ;; Buf-C was not set up yet as it wasn't visible | |
651 | ;; and use-same-frame = nil | |
475f9031 KH |
652 | (select-window orig-wind) |
653 | (delete-other-windows) | |
654 | (switch-to-buffer buf-C) | |
655 | (setq wind-C (selected-window)) | |
656 | )) | |
71296446 | 657 | |
e756eb9f | 658 | (ediff-with-current-buffer control-buf |
475f9031 KH |
659 | (setq ediff-window-A wind-A |
660 | ediff-window-B wind-B | |
661 | ediff-window-C wind-C) | |
18b5607f KH |
662 | (setq frame-A (window-frame ediff-window-A) |
663 | designated-minibuffer-frame | |
664 | (window-frame (minibuffer-window frame-A)))) | |
71296446 | 665 | |
18b5607f | 666 | (ediff-setup-control-frame control-buf designated-minibuffer-frame) |
475f9031 KH |
667 | )) |
668 | ||
71296446 | 669 | |
475f9031 KH |
670 | ;; Window setup for all comparison jobs, including 3way comparisons |
671 | (defun ediff-setup-windows-multiframe-compare (buf-A buf-B buf-C control-buf) | |
672 | ;;; Algorithm: | |
6628e7f8 | 673 | ;;; If a buffer is seen in a frame, use that frame for that buffer. |
475f9031 KH |
674 | ;;; If it is not seen, use the current frame. |
675 | ;;; If both buffers are not seen, they share the current frame. If one | |
676 | ;;; of the buffers is not seen, it is placed in the current frame (where | |
3af0304a | 677 | ;;; ediff started). If that frame is displaying the other buffer, it is |
475f9031 KH |
678 | ;;; shared between the two buffers. |
679 | ;;; However, if we decide to put both buffers in one frame | |
680 | ;;; and the selected frame isn't splittable, we create a new frame and | |
681 | ;;; put both buffers there, event if one of this buffers is visible in | |
682 | ;;; another frame. | |
71296446 | 683 | |
475f9031 KH |
684 | ;; Skip dedicated or iconified frames. |
685 | ;; Unsplittable frames are taken care of later. | |
686 | (ediff-skip-unsuitable-frames 'ok-unsplittable) | |
71296446 | 687 | |
4ae69eac | 688 | (let* ((window-min-height 1) |
475f9031 KH |
689 | (wind-A (ediff-get-visible-buffer-window buf-A)) |
690 | (wind-B (ediff-get-visible-buffer-window buf-B)) | |
691 | (wind-C (ediff-get-visible-buffer-window buf-C)) | |
18b5607f KH |
692 | (frame-A (if wind-A (window-frame wind-A))) |
693 | (frame-B (if wind-B (window-frame wind-B))) | |
694 | (frame-C (if wind-C (window-frame wind-C))) | |
e756eb9f | 695 | (ctl-frame-exists-p (ediff-with-current-buffer control-buf |
18b5607f | 696 | (frame-live-p ediff-control-frame))) |
475f9031 | 697 | ;; on wide display, do things in one frame |
6628e7f8 | 698 | (force-one-frame |
e756eb9f | 699 | (ediff-with-current-buffer control-buf ediff-wide-display-p)) |
475f9031 | 700 | ;; this lets us have local versions of ediff-split-window-function |
6628e7f8 | 701 | (split-window-function |
e756eb9f | 702 | (ediff-with-current-buffer control-buf ediff-split-window-function)) |
475f9031 | 703 | (three-way-comparison |
e756eb9f | 704 | (ediff-with-current-buffer control-buf ediff-3way-comparison-job)) |
475f9031 KH |
705 | (orig-wind (selected-window)) |
706 | (use-same-frame (or force-one-frame | |
707 | (eq frame-A frame-B) | |
bbe6126c MK |
708 | (not (ediff-window-ok-for-display wind-A)) |
709 | (not (ediff-window-ok-for-display wind-B)) | |
475f9031 KH |
710 | (if three-way-comparison |
711 | (or (eq frame-A frame-C) | |
712 | (eq frame-B frame-C) | |
bbe6126c | 713 | (not (ediff-window-ok-for-display wind-C)) |
18b5607f KH |
714 | (not (frame-live-p frame-A)) |
715 | (not (frame-live-p frame-B)) | |
716 | (not (frame-live-p frame-C)))) | |
717 | (and (not (frame-live-p frame-B)) | |
475f9031 | 718 | (or ctl-frame-exists-p |
18b5607f KH |
719 | (eq frame-A (selected-frame)))) |
720 | (and (not (frame-live-p frame-A)) | |
475f9031 | 721 | (or ctl-frame-exists-p |
18b5607f | 722 | (eq frame-B (selected-frame)))))) |
6628e7f8 | 723 | wind-A-start wind-B-start |
475f9031 KH |
724 | designated-minibuffer-frame |
725 | done-A done-B done-C) | |
71296446 | 726 | |
e756eb9f | 727 | (ediff-with-current-buffer control-buf |
475f9031 KH |
728 | (setq wind-A-start (ediff-overlay-start |
729 | (ediff-get-value-according-to-buffer-type | |
730 | 'A ediff-narrow-bounds)) | |
731 | wind-B-start (ediff-overlay-start | |
732 | (ediff-get-value-according-to-buffer-type | |
18b5607f | 733 | 'B ediff-narrow-bounds)))) |
71296446 | 734 | |
475f9031 KH |
735 | (if (and (window-live-p wind-A) (null use-same-frame)) ; buf-A on its own |
736 | (progn | |
bbe6126c MK |
737 | ;; buffer buf-A is seen in live wind-A |
738 | (select-window wind-A) ; must be displaying buf-A | |
475f9031 | 739 | (delete-other-windows) |
475f9031 KH |
740 | (setq wind-A (selected-window)) |
741 | (setq done-A t))) | |
71296446 | 742 | |
475f9031 KH |
743 | (if (and (window-live-p wind-B) (null use-same-frame)) ; buf B on its own |
744 | (progn | |
bbe6126c MK |
745 | ;; buffer buf-B is seen in live wind-B |
746 | (select-window wind-B) ; must be displaying buf-B | |
475f9031 | 747 | (delete-other-windows) |
475f9031 KH |
748 | (setq wind-B (selected-window)) |
749 | (setq done-B t))) | |
71296446 | 750 | |
475f9031 KH |
751 | (if (and (window-live-p wind-C) (null use-same-frame)) ; buf C on its own |
752 | (progn | |
bbe6126c MK |
753 | ;; buffer buf-C is seen in live wind-C |
754 | (select-window wind-C) ; must be displaying buf-C | |
475f9031 | 755 | (delete-other-windows) |
475f9031 KH |
756 | (setq wind-C (selected-window)) |
757 | (setq done-C t))) | |
71296446 | 758 | |
475f9031 | 759 | (if use-same-frame |
bbe6126c | 760 | (let (wind-width-or-height) ; this affects 3way setups only |
ddc90f39 MK |
761 | (if (and (eq frame-A frame-B) (frame-live-p frame-A)) |
762 | (select-frame frame-A) | |
763 | ;; avoid dedicated and non-splittable windows | |
764 | (ediff-skip-unsuitable-frames)) | |
475f9031 KH |
765 | (delete-other-windows) |
766 | (switch-to-buffer buf-A) | |
767 | (setq wind-A (selected-window)) | |
71296446 | 768 | |
475f9031 KH |
769 | (if three-way-comparison |
770 | (setq wind-width-or-height | |
771 | (/ | |
772 | (if (eq split-window-function 'split-window-vertically) | |
773 | (window-height wind-A) | |
774 | (window-width wind-A)) | |
775 | 3))) | |
71296446 | 776 | |
475f9031 | 777 | (funcall split-window-function wind-width-or-height) |
6628e7f8 | 778 | (if (eq (selected-window) wind-A) |
475f9031 KH |
779 | (other-window 1)) |
780 | (switch-to-buffer buf-B) | |
781 | (setq wind-B (selected-window)) | |
71296446 | 782 | |
475f9031 KH |
783 | (if three-way-comparison |
784 | (progn | |
785 | (funcall split-window-function) ; equally | |
786 | (if (memq (selected-window) (list wind-A wind-B)) | |
787 | (other-window 1)) | |
788 | (switch-to-buffer buf-C) | |
789 | (setq wind-C (selected-window)))) | |
790 | (setq done-A t | |
791 | done-B t | |
792 | done-C t) | |
793 | )) | |
71296446 | 794 | |
475f9031 | 795 | (or done-A ; Buf A to be set in its own frame |
bbe6126c | 796 | ;;; or it was set before because use-same-frame = 1 |
6628e7f8 | 797 | (progn |
bbe6126c MK |
798 | ;; Buf-A was not set up yet as it wasn't visible, |
799 | ;; and use-same-frame = nil | |
475f9031 KH |
800 | (select-window orig-wind) |
801 | (delete-other-windows) | |
802 | (switch-to-buffer buf-A) | |
803 | (setq wind-A (selected-window)) | |
804 | )) | |
805 | (or done-B ; Buf B to be set in its own frame | |
bbe6126c | 806 | ;;; or it was set before because use-same-frame = 1 |
6628e7f8 | 807 | (progn |
bbe6126c MK |
808 | ;; Buf-B was not set up yet as it wasn't visible, |
809 | ;; and use-same-frame = nil | |
475f9031 KH |
810 | (select-window orig-wind) |
811 | (delete-other-windows) | |
812 | (switch-to-buffer buf-B) | |
813 | (setq wind-B (selected-window)) | |
814 | )) | |
71296446 | 815 | |
475f9031 KH |
816 | (if three-way-comparison |
817 | (or done-C ; Buf C to be set in its own frame | |
bbe6126c | 818 | ;;; or it was set before because use-same-frame = 1 |
6628e7f8 | 819 | (progn |
bbe6126c MK |
820 | ;; Buf-C was not set up yet as it wasn't visible, |
821 | ;; and use-same-frame = nil | |
475f9031 KH |
822 | (select-window orig-wind) |
823 | (delete-other-windows) | |
824 | (switch-to-buffer buf-C) | |
825 | (setq wind-C (selected-window)) | |
826 | ))) | |
71296446 | 827 | |
e756eb9f | 828 | (ediff-with-current-buffer control-buf |
475f9031 KH |
829 | (setq ediff-window-A wind-A |
830 | ediff-window-B wind-B | |
831 | ediff-window-C wind-C) | |
2e955a8b | 832 | |
18b5607f KH |
833 | (setq frame-A (window-frame ediff-window-A) |
834 | designated-minibuffer-frame | |
835 | (window-frame (minibuffer-window frame-A)))) | |
71296446 | 836 | |
bbe6126c | 837 | ;; It is unlikely that we'll implement a version of ediff-windows that |
3af0304a | 838 | ;; would compare 3 windows at once. So, we don't use buffer C here. |
18b5607f | 839 | (if ediff-windows-job |
475f9031 KH |
840 | (progn |
841 | (set-window-start wind-A wind-A-start) | |
842 | (set-window-start wind-B wind-B-start))) | |
71296446 | 843 | |
18b5607f | 844 | (ediff-setup-control-frame control-buf designated-minibuffer-frame) |
475f9031 KH |
845 | )) |
846 | ||
bbe6126c | 847 | ;; skip unsplittable frames and frames that have dedicated windows. |
475f9031 KH |
848 | ;; create a new splittable frame if none is found |
849 | (defun ediff-skip-unsuitable-frames (&optional ok-unsplittable) | |
18b5607f | 850 | (if (ediff-window-display-p) |
2e955a8b MK |
851 | (let ((wind-frame (window-frame (selected-window))) |
852 | seen-windows) | |
657f9cb8 | 853 | (while (and (not (memq (selected-window) seen-windows)) |
475f9031 | 854 | (or |
2e955a8b MK |
855 | (ediff-frame-has-dedicated-windows wind-frame) |
856 | (ediff-frame-iconified-p wind-frame) | |
3af0304a | 857 | ;; skip small windows |
2e955a8b | 858 | (< (frame-height wind-frame) |
3af0304a | 859 | (* 3 window-min-height)) |
475f9031 KH |
860 | (if ok-unsplittable |
861 | nil | |
2e955a8b MK |
862 | (ediff-frame-unsplittable-p wind-frame)))) |
863 | ;; remember history | |
657f9cb8 | 864 | (setq seen-windows (cons (selected-window) seen-windows)) |
475f9031 | 865 | ;; try new window |
2e955a8b MK |
866 | (other-window 1 t) |
867 | (setq wind-frame (window-frame (selected-window))) | |
868 | ) | |
657f9cb8 | 869 | (if (memq (selected-window) seen-windows) |
2e955a8b MK |
870 | ;; fed up, no appropriate frames |
871 | (setq wind-frame (make-frame '((unsplittable))))) | |
872 | ||
873 | (select-frame wind-frame) | |
874 | ))) | |
475f9031 | 875 | |
bbe6126c | 876 | (defun ediff-frame-has-dedicated-windows (frame) |
2e955a8b | 877 | (let (ans) |
71296446 | 878 | (walk-windows |
3af0304a MK |
879 | (lambda (wind) (if (window-dedicated-p wind) |
880 | (setq ans t))) | |
bbe6126c MK |
881 | 'ignore-minibuffer |
882 | frame) | |
bbe6126c MK |
883 | ans)) |
884 | ||
885 | ;; window is ok, if it is only one window on the frame, not counting the | |
886 | ;; minibuffer, or none of the frame's windows is dedicated. | |
887 | ;; The idea is that it is bad to destroy dedicated windows while creating an | |
888 | ;; ediff window setup | |
889 | (defun ediff-window-ok-for-display (wind) | |
890 | (and | |
891 | (window-live-p wind) | |
6628e7f8 | 892 | (or |
bbe6126c MK |
893 | ;; only one window |
894 | (eq wind (next-window wind 'ignore-minibuffer (window-frame wind))) | |
2d84cc27 | 895 | ;; none is dedicated (in multiframe setup) |
bbe6126c MK |
896 | (not (ediff-frame-has-dedicated-windows (window-frame wind))) |
897 | ))) | |
898 | ||
475f9031 | 899 | ;; Prepare or refresh control frame |
18b5607f | 900 | (defun ediff-setup-control-frame (ctl-buffer designated-minibuffer-frame) |
4ae69eac | 901 | (let ((window-min-height 1) |
475f9031 | 902 | ctl-frame-iconified-p dont-iconify-ctl-frame deiconify-ctl-frame |
6628e7f8 | 903 | ctl-frame old-ctl-frame lines |
bbe6126c | 904 | ;; user-grabbed-mouse |
6628e7f8 | 905 | fheight fwidth adjusted-parameters) |
71296446 | 906 | |
e756eb9f | 907 | (ediff-with-current-buffer ctl-buffer |
2d84cc27 MK |
908 | (if (and (featurep 'xemacs) (featurep 'menubar)) |
909 | (set-buffer-menubar nil)) | |
6853a937 MK |
910 | ;;(setq user-grabbed-mouse (ediff-user-grabbed-mouse)) |
911 | (run-hooks 'ediff-before-setup-control-frame-hook)) | |
71296446 | 912 | |
e756eb9f MK |
913 | (setq old-ctl-frame (ediff-with-current-buffer ctl-buffer ediff-control-frame)) |
914 | (ediff-with-current-buffer ctl-buffer | |
4ae69eac MK |
915 | (setq ctl-frame (if (frame-live-p old-ctl-frame) |
916 | old-ctl-frame | |
917 | (make-frame ediff-control-frame-parameters)) | |
bbe14ff4 | 918 | ediff-control-frame ctl-frame) |
fda2ce24 | 919 | ;; protect against undefined face-attribute |
4986c2c6 | 920 | (condition-case nil |
2d84cc27 MK |
921 | (if (and (featurep 'emacs) (face-attribute 'mode-line :box)) |
922 | (set-face-attribute 'mode-line ctl-frame :box nil)) | |
f6d49b2f | 923 | (error))) |
71296446 | 924 | |
475f9031 | 925 | (setq ctl-frame-iconified-p (ediff-frame-iconified-p ctl-frame)) |
18b5607f | 926 | (select-frame ctl-frame) |
475f9031 KH |
927 | (if (window-dedicated-p (selected-window)) |
928 | () | |
929 | (delete-other-windows) | |
930 | (switch-to-buffer ctl-buffer)) | |
71296446 | 931 | |
475f9031 | 932 | ;; must be before ediff-setup-control-buffer |
6853a937 | 933 | ;; just a precaution--we should be in ctl-buffer already |
e756eb9f | 934 | (ediff-with-current-buffer ctl-buffer |
6853a937 MK |
935 | (make-local-variable 'frame-title-format) |
936 | (make-local-variable 'frame-icon-title-format) ; XEmacs | |
937 | (make-local-variable 'icon-title-format)) ; Emacs | |
71296446 | 938 | |
475f9031 KH |
939 | (ediff-setup-control-buffer ctl-buffer) |
940 | (setq dont-iconify-ctl-frame | |
941 | (not (string= ediff-help-message ediff-brief-help-message))) | |
6628e7f8 | 942 | (setq deiconify-ctl-frame |
475f9031 KH |
943 | (and (eq this-command 'ediff-toggle-help) |
944 | dont-iconify-ctl-frame)) | |
71296446 | 945 | |
475f9031 | 946 | ;; 1 more line for the modeline |
4ae69eac | 947 | (setq lines (1+ (count-lines (point-min) (point-max))) |
475f9031 | 948 | fheight lines |
bf5d92c5 MK |
949 | fwidth (max (+ (ediff-help-message-line-length) 2) |
950 | (ediff-compute-toolbar-width)) | |
ddc90f39 MK |
951 | adjusted-parameters |
952 | (list | |
953 | ;; possibly change surrogate minibuffer | |
954 | (cons 'minibuffer | |
955 | (minibuffer-window | |
956 | designated-minibuffer-frame)) | |
957 | (cons 'width fwidth) | |
59f1b058 MK |
958 | (cons 'height fheight) |
959 | (cons 'user-position t) | |
960 | )) | |
2e955a8b MK |
961 | |
962 | ;; adjust autoraise | |
963 | (setq adjusted-parameters | |
964 | (cons (if ediff-use-long-help-message | |
965 | '(auto-raise . nil) | |
966 | '(auto-raise . t)) | |
967 | adjusted-parameters)) | |
71296446 | 968 | |
475f9031 | 969 | ;; In XEmacs, buffer menubar needs to be killed before frame parameters |
6628e7f8 | 970 | ;; are changed. |
2eb4bdca | 971 | (if (ediff-has-toolbar-support-p) |
f6d49b2f GM |
972 | (when (featurep 'xemacs) |
973 | (if (ediff-has-gutter-support-p) | |
974 | (set-specifier top-gutter (list ctl-frame nil))) | |
975 | (sit-for 0) | |
976 | (set-specifier top-toolbar-height (list ctl-frame 0)) | |
977 | ;;(set-specifier bottom-toolbar-height (list ctl-frame 0)) | |
978 | (set-specifier left-toolbar-width (list ctl-frame 0)) | |
979 | (set-specifier right-toolbar-width (list ctl-frame 0)))) | |
71296446 | 980 | |
4ae69eac | 981 | ;; Under OS/2 (emx) we have to call modify frame parameters twice, in order |
3af0304a | 982 | ;; to make sure that at least once we do it for non-iconified frame. If |
4ae69eac | 983 | ;; appears that in the OS/2 port of Emacs, one can't modify frame |
3af0304a | 984 | ;; parameters of iconified frames. As a precaution, we do likewise for |
4ae69eac MK |
985 | ;; windows-nt. |
986 | (if (memq system-type '(emx windows-nt windows-95)) | |
18b5607f | 987 | (modify-frame-parameters ctl-frame adjusted-parameters)) |
71296446 | 988 | |
ddc90f39 MK |
989 | ;; make or zap toolbar (if not requested) |
990 | (ediff-make-bottom-toolbar ctl-frame) | |
71296446 | 991 | |
ddc90f39 MK |
992 | (goto-char (point-min)) |
993 | ||
6853a937 | 994 | (modify-frame-parameters ctl-frame adjusted-parameters) |
bbe6126c | 995 | (make-frame-visible ctl-frame) |
71296446 | 996 | |
3af0304a | 997 | ;; This works around a bug in 19.25 and earlier. There, if frame gets |
475f9031 KH |
998 | ;; iconified, the current buffer changes to that of the frame that |
999 | ;; becomes exposed as a result of this iconification. | |
1000 | ;; So, we make sure the current buffer doesn't change. | |
18b5607f | 1001 | (select-frame ctl-frame) |
475f9031 | 1002 | (ediff-refresh-control-frame) |
71296446 | 1003 | |
6853a937 MK |
1004 | (cond ((and ediff-prefer-iconified-control-frame |
1005 | (not ctl-frame-iconified-p) (not dont-iconify-ctl-frame)) | |
1006 | (iconify-frame ctl-frame)) | |
1007 | ((or deiconify-ctl-frame (not ctl-frame-iconified-p)) | |
1008 | (raise-frame ctl-frame))) | |
71296446 | 1009 | |
bbe6126c | 1010 | (set-window-dedicated-p (selected-window) t) |
ddc90f39 | 1011 | |
3af0304a | 1012 | ;; Now move the frame. We must do it separately due to an obscure bug in |
ddc90f39 MK |
1013 | ;; XEmacs |
1014 | (modify-frame-parameters | |
1015 | ctl-frame | |
1016 | (funcall ediff-control-frame-position-function ctl-buffer fwidth fheight)) | |
71296446 | 1017 | |
bbe6126c | 1018 | ;; synchronize so the cursor will move to control frame |
6853a937 | 1019 | ;; per RMS suggestion |
4ae69eac MK |
1020 | (if (ediff-window-display-p) |
1021 | (let ((count 7)) | |
1022 | (sit-for .1) | |
1023 | (while (and (not (frame-visible-p ctl-frame)) (> count 0)) | |
1024 | (setq count (1- count)) | |
1025 | (sit-for .3)))) | |
6853a937 | 1026 | |
475f9031 | 1027 | (or (ediff-frame-iconified-p ctl-frame) |
6853a937 | 1028 | ;; don't warp the mouse, unless ediff-grab-mouse = t |
4ae69eac MK |
1029 | (ediff-reset-mouse ctl-frame |
1030 | (or (eq this-command 'ediff-quit) | |
1031 | (not (eq ediff-grab-mouse t))))) | |
71296446 | 1032 | |
f6d49b2f GM |
1033 | (when (featurep 'xemacs) |
1034 | (ediff-with-current-buffer ctl-buffer | |
1035 | (make-local-hook 'select-frame-hook) | |
1036 | (add-hook 'select-frame-hook | |
1037 | 'ediff-xemacs-select-frame-hook nil 'local))) | |
71296446 | 1038 | |
e756eb9f | 1039 | (ediff-with-current-buffer ctl-buffer |
f6d49b2f | 1040 | (run-hooks 'ediff-after-setup-control-frame-hook)))) |
ddc90f39 | 1041 | |
71296446 | 1042 | |
18b5607f | 1043 | (defun ediff-destroy-control-frame (ctl-buffer) |
e756eb9f | 1044 | (ediff-with-current-buffer ctl-buffer |
18b5607f KH |
1045 | (if (and (ediff-window-display-p) (frame-live-p ediff-control-frame)) |
1046 | (let ((ctl-frame ediff-control-frame)) | |
2d84cc27 MK |
1047 | (if (and (featurep 'xemacs) (featurep 'menubar)) |
1048 | (set-buffer-menubar default-menubar)) | |
18b5607f | 1049 | (setq ediff-control-frame nil) |
f6d49b2f | 1050 | (delete-frame ctl-frame)))) |
2d84cc27 MK |
1051 | (if ediff-multiframe |
1052 | (ediff-skip-unsuitable-frames)) | |
6853a937 MK |
1053 | ;;(ediff-reset-mouse nil) |
1054 | ) | |
71296446 | 1055 | |
475f9031 KH |
1056 | |
1057 | ;; finds a good place to clip control frame | |
1058 | (defun ediff-make-frame-position (ctl-buffer ctl-frame-width ctl-frame-height) | |
e756eb9f | 1059 | (ediff-with-current-buffer ctl-buffer |
18b5607f KH |
1060 | (let* ((frame-A (window-frame ediff-window-A)) |
1061 | (frame-A-parameters (frame-parameters frame-A)) | |
6853a937 MK |
1062 | (frame-A-top (eval (cdr (assoc 'top frame-A-parameters)))) |
1063 | (frame-A-left (eval (cdr (assoc 'left frame-A-parameters)))) | |
18b5607f | 1064 | (frame-A-width (frame-width frame-A)) |
475f9031 KH |
1065 | (ctl-frame ediff-control-frame) |
1066 | horizontal-adjustment upward-adjustment | |
6628e7f8 | 1067 | ctl-frame-top ctl-frame-left) |
71296446 | 1068 | |
475f9031 | 1069 | ;; Multiple control frames are clipped based on the value of |
3af0304a | 1070 | ;; ediff-control-buffer-number. This is done in order not to obscure |
475f9031 KH |
1071 | ;; other active control panels. |
1072 | (setq horizontal-adjustment (* 2 ediff-control-buffer-number) | |
1073 | upward-adjustment (* -14 ediff-control-buffer-number)) | |
1074 | ||
6853a937 MK |
1075 | (setq ctl-frame-top |
1076 | (- frame-A-top upward-adjustment ediff-control-frame-upward-shift) | |
1077 | ctl-frame-left | |
1078 | (+ frame-A-left | |
4ae69eac | 1079 | (if ediff-use-long-help-message |
6853a937 MK |
1080 | (* (ediff-frame-char-width ctl-frame) |
1081 | (+ ediff-wide-control-frame-rightward-shift | |
1082 | horizontal-adjustment)) | |
1083 | (- (* frame-A-width (ediff-frame-char-width frame-A)) | |
1084 | (* (ediff-frame-char-width ctl-frame) | |
1085 | (+ ctl-frame-width | |
1086 | ediff-narrow-control-frame-leftward-shift | |
1087 | horizontal-adjustment)))))) | |
6853a937 MK |
1088 | (setq ctl-frame-top |
1089 | (min ctl-frame-top | |
1090 | (- (ediff-display-pixel-height) | |
1091 | (* 2 ctl-frame-height | |
1092 | (ediff-frame-char-height ctl-frame)))) | |
1093 | ctl-frame-left | |
1094 | (min ctl-frame-left | |
1095 | (- (ediff-display-pixel-width) | |
1096 | (* ctl-frame-width (ediff-frame-char-width ctl-frame))))) | |
4ae69eac MK |
1097 | ;; keep ctl frame within the visible bounds |
1098 | (setq ctl-frame-top (max ctl-frame-top 1) | |
1099 | ctl-frame-left (max ctl-frame-left 1)) | |
71296446 | 1100 | |
6853a937 MK |
1101 | (list (cons 'top ctl-frame-top) |
1102 | (cons 'left ctl-frame-left)) | |
1103 | ))) | |
71296446 | 1104 | |
18b5607f | 1105 | (defun ediff-xemacs-select-frame-hook () |
6853a937 | 1106 | (if (and (equal (selected-frame) ediff-control-frame) |
4ae69eac | 1107 | (not ediff-use-long-help-message)) |
18b5607f | 1108 | (raise-frame ediff-control-frame))) |
71296446 | 1109 | |
475f9031 KH |
1110 | (defun ediff-make-wide-display () |
1111 | "Construct an alist of parameters for the wide display. | |
1112 | Saves the old frame parameters in `ediff-wide-display-orig-parameters'. | |
1113 | The frame to be resized is kept in `ediff-wide-display-frame'. | |
1114 | This function modifies only the left margin and the width of the display. | |
1115 | It assumes that it is called from within the control buffer." | |
18b5607f | 1116 | (if (not (fboundp 'ediff-display-pixel-width)) |
6628e7f8 | 1117 | (error "Can't determine display width")) |
18b5607f KH |
1118 | (let* ((frame-A (window-frame ediff-window-A)) |
1119 | (frame-A-params (frame-parameters frame-A)) | |
475f9031 | 1120 | (cw (ediff-frame-char-width frame-A)) |
18b5607f | 1121 | (wd (- (/ (ediff-display-pixel-width) cw) 5))) |
6628e7f8 | 1122 | (setq ediff-wide-display-orig-parameters |
6853a937 | 1123 | (list (cons 'left (max 0 (eval (cdr (assoc 'left frame-A-params))))) |
475f9031 KH |
1124 | (cons 'width (cdr (assoc 'width frame-A-params)))) |
1125 | ediff-wide-display-frame frame-A) | |
59f1b058 | 1126 | (modify-frame-parameters |
23e41d15 | 1127 | frame-A `((left . ,cw) (width . ,wd) (user-position . t))))) |
71296446 | 1128 | |
475f9031 KH |
1129 | |
1130 | ;; Revise the mode line to display which difference we have selected | |
1131 | ;; Also resets modelines of buffers A/B, since they may be clobbered by | |
1132 | ;; anothe invocations of Ediff. | |
1133 | (defun ediff-refresh-mode-lines () | |
1134 | (let (buf-A-state-diff buf-B-state-diff buf-C-state-diff buf-C-state-merge) | |
71296446 | 1135 | |
475f9031 KH |
1136 | (if (ediff-valid-difference-p) |
1137 | (setq | |
1138 | buf-C-state-diff (ediff-get-state-of-diff ediff-current-difference 'C) | |
1139 | buf-C-state-merge (ediff-get-state-of-merge ediff-current-difference) | |
1140 | buf-A-state-diff (ediff-get-state-of-diff ediff-current-difference 'A) | |
1141 | buf-B-state-diff (ediff-get-state-of-diff ediff-current-difference 'B) | |
1142 | buf-A-state-diff (if buf-A-state-diff | |
1143 | (format "[%s] " buf-A-state-diff) | |
1144 | "") | |
1145 | buf-B-state-diff (if buf-B-state-diff | |
1146 | (format "[%s] " buf-B-state-diff) | |
1147 | "") | |
1148 | buf-C-state-diff (if (and (ediff-buffer-live-p ediff-buffer-C) | |
1149 | (or buf-C-state-diff buf-C-state-merge)) | |
6853a937 | 1150 | (format "[%s%s%s] " |
475f9031 KH |
1151 | (or buf-C-state-diff "") |
1152 | (if buf-C-state-merge | |
1153 | (concat " " buf-C-state-merge) | |
6853a937 | 1154 | "") |
6628e7f8 | 1155 | (if (ediff-get-state-of-ancestor |
6853a937 MK |
1156 | ediff-current-difference) |
1157 | " AncestorEmpty" | |
1158 | "") | |
1159 | ) | |
475f9031 KH |
1160 | "")) |
1161 | (setq buf-A-state-diff "" | |
1162 | buf-B-state-diff "" | |
1163 | buf-C-state-diff "")) | |
71296446 | 1164 | |
475f9031 KH |
1165 | ;; control buffer format |
1166 | (setq mode-line-format | |
ddc90f39 MK |
1167 | (if (ediff-narrow-control-frame-p) |
1168 | (list " " mode-line-buffer-identification) | |
1169 | (list "-- " mode-line-buffer-identification " Quick Help"))) | |
475f9031 | 1170 | ;; control buffer id |
6628e7f8 | 1171 | (setq mode-line-buffer-identification |
475f9031 KH |
1172 | (if (ediff-narrow-control-frame-p) |
1173 | (ediff-make-narrow-control-buffer-id 'skip-name) | |
1174 | (ediff-make-wide-control-buffer-id))) | |
1175 | ;; Force mode-line redisplay | |
1176 | (force-mode-line-update) | |
71296446 | 1177 | |
18b5607f | 1178 | (if (and (ediff-window-display-p) (frame-live-p ediff-control-frame)) |
475f9031 | 1179 | (ediff-refresh-control-frame)) |
71296446 | 1180 | |
e756eb9f | 1181 | (ediff-with-current-buffer ediff-buffer-A |
475f9031 KH |
1182 | (setq ediff-diff-status buf-A-state-diff) |
1183 | (ediff-strip-mode-line-format) | |
1184 | (setq mode-line-format | |
1185 | (list " A: " 'ediff-diff-status mode-line-format)) | |
1186 | (force-mode-line-update)) | |
e756eb9f | 1187 | (ediff-with-current-buffer ediff-buffer-B |
475f9031 KH |
1188 | (setq ediff-diff-status buf-B-state-diff) |
1189 | (ediff-strip-mode-line-format) | |
1190 | (setq mode-line-format | |
1191 | (list " B: " 'ediff-diff-status mode-line-format)) | |
1192 | (force-mode-line-update)) | |
1193 | (if ediff-3way-job | |
e756eb9f | 1194 | (ediff-with-current-buffer ediff-buffer-C |
475f9031 KH |
1195 | (setq ediff-diff-status buf-C-state-diff) |
1196 | (ediff-strip-mode-line-format) | |
1197 | (setq mode-line-format | |
1198 | (list " C: " 'ediff-diff-status mode-line-format)) | |
1199 | (force-mode-line-update))) | |
6853a937 | 1200 | (if (ediff-buffer-live-p ediff-ancestor-buffer) |
e756eb9f | 1201 | (ediff-with-current-buffer ediff-ancestor-buffer |
6853a937 MK |
1202 | (ediff-strip-mode-line-format) |
1203 | ;; we keep the second dummy string in the mode line format of the | |
1204 | ;; ancestor, since for other buffers Ediff prepends 2 strings and | |
1205 | ;; ediff-strip-mode-line-format expects that. | |
1206 | (setq mode-line-format | |
1207 | (list " Ancestor: " | |
1208 | (cond ((not (stringp buf-C-state-merge)) | |
1209 | "") | |
1210 | ((string-match "prefer-A" buf-C-state-merge) | |
1211 | "[=diff(B)] ") | |
1212 | ((string-match "prefer-B" buf-C-state-merge) | |
1213 | "[=diff(A)] ") | |
1214 | (t "")) | |
1215 | mode-line-format)))) | |
475f9031 | 1216 | )) |
71296446 JB |
1217 | |
1218 | ||
475f9031 | 1219 | (defun ediff-refresh-control-frame () |
e83d1fe8 | 1220 | (if (featurep 'emacs) |
bbe6126c | 1221 | ;; set frame/icon titles for Emacs |
6853a937 MK |
1222 | (modify-frame-parameters |
1223 | ediff-control-frame | |
bbe6126c MK |
1224 | (list (cons 'title (ediff-make-base-title)) |
1225 | (cons 'icon-name (ediff-make-narrow-control-buffer-id)) | |
1226 | )) | |
1227 | ;; set frame/icon titles for XEmacs | |
1228 | (setq frame-title-format (ediff-make-base-title) | |
1229 | frame-icon-title-format (ediff-make-narrow-control-buffer-id)) | |
6853a937 MK |
1230 | ;; force an update of the frame title |
1231 | (modify-frame-parameters ediff-control-frame '(())))) | |
71296446 JB |
1232 | |
1233 | ||
475f9031 KH |
1234 | (defun ediff-make-narrow-control-buffer-id (&optional skip-name) |
1235 | (concat | |
1236 | (if skip-name | |
1237 | " " | |
bbe6126c | 1238 | (ediff-make-base-title)) |
6628e7f8 | 1239 | (cond ((< ediff-current-difference 0) |
475f9031 KH |
1240 | (format " _/%d" ediff-number-of-differences)) |
1241 | ((>= ediff-current-difference ediff-number-of-differences) | |
1242 | (format " $/%d" ediff-number-of-differences)) | |
1243 | (t | |
1244 | (format " %d/%d" | |
1245 | (1+ ediff-current-difference) | |
1246 | ediff-number-of-differences))))) | |
bbe6126c MK |
1247 | |
1248 | (defun ediff-make-base-title () | |
1249 | (concat | |
1250 | (cdr (assoc 'name ediff-control-frame-parameters)) | |
1251 | ediff-control-buffer-suffix)) | |
71296446 | 1252 | |
475f9031 KH |
1253 | (defun ediff-make-wide-control-buffer-id () |
1254 | (cond ((< ediff-current-difference 0) | |
1255 | (list (format "%%b At start of %d diffs" | |
1256 | ediff-number-of-differences))) | |
1257 | ((>= ediff-current-difference ediff-number-of-differences) | |
1258 | (list (format "%%b At end of %d diffs" | |
1259 | ediff-number-of-differences))) | |
1260 | (t | |
1261 | (list (format "%%b diff %d of %d" | |
1262 | (1+ ediff-current-difference) | |
1263 | ediff-number-of-differences))))) | |
1264 | ||
1265 | ||
1266 | ||
1267 | ;; If buff is not live, return nil | |
1268 | (defun ediff-get-visible-buffer-window (buff) | |
1269 | (if (ediff-buffer-live-p buff) | |
e83d1fe8 | 1270 | (if (featurep 'xemacs) |
475f9031 KH |
1271 | (get-buffer-window buff t) |
1272 | (get-buffer-window buff 'visible)))) | |
71296446 | 1273 | |
475f9031 | 1274 | |
bbe6126c | 1275 | ;;; Functions to decide when to redraw windows |
71296446 | 1276 | |
475f9031 KH |
1277 | (defun ediff-keep-window-config (control-buf) |
1278 | (and (eq control-buf (current-buffer)) | |
1279 | (/= (buffer-size) 0) | |
e756eb9f | 1280 | (ediff-with-current-buffer control-buf |
475f9031 KH |
1281 | (let ((ctl-wind ediff-control-window) |
1282 | (A-wind ediff-window-A) | |
1283 | (B-wind ediff-window-B) | |
1284 | (C-wind ediff-window-C)) | |
71296446 | 1285 | |
475f9031 KH |
1286 | (and |
1287 | (ediff-window-visible-p A-wind) | |
1288 | (ediff-window-visible-p B-wind) | |
1289 | ;; if buffer C is defined then take it into account | |
1290 | (or (not ediff-3way-job) | |
1291 | (ediff-window-visible-p C-wind)) | |
1292 | (eq (window-buffer A-wind) ediff-buffer-A) | |
1293 | (eq (window-buffer B-wind) ediff-buffer-B) | |
1294 | (or (not ediff-3way-job) | |
1295 | (eq (window-buffer C-wind) ediff-buffer-C)) | |
1296 | (string= ediff-window-config-saved | |
18b5607f | 1297 | (format "%S%S%S%S%S%S%S" |
475f9031 | 1298 | ctl-wind A-wind B-wind C-wind |
18b5607f KH |
1299 | ediff-split-window-function |
1300 | (ediff-multiframe-setup-p) | |
1301 | ediff-wide-display-p))))))) | |
475f9031 KH |
1302 | |
1303 | ||
b6178721 MK |
1304 | (provide 'ediff-wind) |
1305 | ||
1306 | ||
fa043571 SM |
1307 | ;; Local Variables: |
1308 | ;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun) | |
1309 | ;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1) | |
1310 | ;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body)) | |
1311 | ;; End: | |
bbe6126c | 1312 | |
cbee283d | 1313 | ;; arch-tag: 73d9a5d7-eed7-4d9c-8b4b-21d5d78eb597 |
475f9031 | 1314 | ;;; ediff-wind.el ends here |