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