annotate lisp/ediff-wind.el @ 13097:59916c4b0b79

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