Mercurial > emacs
annotate lisp/ediff-init.el @ 12318:960d7332adc5
Update version number.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Mon, 19 Jun 1995 18:44:44 +0000 |
parents | 5ab666b86a02 |
children | b0ec8d932b35 |
rev | line source |
---|---|
11042 | 1 ;;; ediff-init.el --- Macros, variables and defsubsts used by Ediff |
11234 | 2 ;;; Copyright (C) 1994, 1995 Free Software Foundation, Inc. |
11042 | 3 |
4 ;; Author: Michael Kifer <kifer@cs.sunysb.edu> | |
5 | |
6 ;; This file is part of GNU Emacs. | |
7 | |
8 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
9 ;; it under the terms of the GNU General Public License as published by | |
10 ;; the Free Software Foundation; either version 2, or (at your option) | |
11 ;; any later version. | |
12 | |
13 ;; GNU Emacs is distributed in the hope that it will be useful, | |
14 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 ;; GNU General Public License for more details. | |
17 | |
18 ;; You should have received a copy of the GNU General Public License | |
19 ;; along with GNU Emacs; see the file COPYING. If not, write to | |
20 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
21 | |
22 | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
23 ;; Is it XEmacs? |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
24 (defconst ediff-xemacs-p (string-match "\\(Lucid\\|Xemacs\\)" emacs-version)) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
25 ;; Is it Emacs? |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
26 (defconst ediff-emacs-p (not ediff-xemacs-p)) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
27 ;; Are we running as a window application or on a TTY? |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
28 (defsubst ediff-device-type () |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
29 (if ediff-emacs-p |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
30 window-system |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
31 (device-type (selected-device)))) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
32 ;; in XEmacs: device-type is tty on tty and stream in batch. |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
33 (defsubst ediff-window-display-p () |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
34 (and (ediff-device-type) (not (memq (ediff-device-type) '(tty stream))))) |
11042 | 35 |
36 ;;; Macros | |
37 (defmacro ediff-odd-p (arg) | |
38 (` (eq (logand (, arg) 1) 1))) | |
39 | |
40 (defmacro ediff-buffer-live-p (buf) | |
41 (` (and (, buf) (get-buffer (, buf)) (buffer-name (get-buffer (, buf)))))) | |
42 | |
43 (defmacro ediff-get-buffer (arg) | |
44 (` (cond ((eq (, arg) 'A) ediff-buffer-A) | |
45 ((eq (, arg) 'B) ediff-buffer-B) | |
46 ((eq (, arg) 'C) ediff-buffer-C) | |
47 ) | |
48 )) | |
49 | |
50 (defmacro ediff-get-value-according-to-buffer-type (buf-type list) | |
51 (` (cond ((eq (, buf-type) 'A) (nth 0 (, list))) | |
52 ((eq (, buf-type) 'B) (nth 1 (, list))) | |
53 ((eq (, buf-type) 'C) (nth 2 (, list)))))) | |
54 | |
55 (defmacro ediff-char-to-buftype (arg) | |
56 (` (cond ((memq (, arg) '(?a ?A)) 'A) | |
57 ((memq (, arg) '(?b ?B)) 'B) | |
58 ((memq (, arg) '(?c ?C)) 'C) | |
59 ) | |
60 )) | |
61 | |
62 (defmacro ediff-get-difference (n buf-type) | |
63 (` (aref | |
64 (symbol-value | |
65 (intern (format "ediff-difference-vector-%S" (, buf-type)))) (, n)))) | |
66 | |
67 ;; tell if it has been previously determined that the region has | |
68 ;; no diffs other than the white space and newlines | |
69 ;; The argument, N, is the diff region number used by Ediff to index the | |
70 ;; diff vector. It is 1 less than the number seen by the user. | |
71 ;; | |
72 ;; A difference vector has the form: | |
73 ;; [diff diff diff ...] | |
74 ;; where each diff has the form: | |
75 ;; [overlay fine-diff-vector no-fine-diffs-flag] | |
76 ;; fine-diff-vector is a vector [fine-diff fine-diff fine-diff ...] | |
77 (defmacro ediff-no-fine-diffs-p (n) | |
78 (` (aref (ediff-get-difference (, n) 'A) 2))) | |
79 | |
80 (defmacro ediff-get-diff-overlay-from-diff-record (diff-rec) | |
81 (` (aref (, diff-rec) 0))) | |
82 | |
83 (defmacro ediff-get-diff-overlay (n buf-type) | |
84 (` (ediff-get-diff-overlay-from-diff-record | |
85 (ediff-get-difference (, n) (, buf-type))))) | |
86 | |
87 (defmacro ediff-get-fine-diff-vector-from-diff-record (diff-rec) | |
88 (` (aref (, diff-rec) 1))) | |
89 | |
90 (defmacro ediff-set-fine-diff-vector (n buf-type fine-vec) | |
91 (` (aset (ediff-get-difference (, n) (, buf-type)) 1 (, fine-vec)))) | |
92 | |
93 (defmacro ediff-get-state-of-diff (n buf-type) | |
94 (` (if (ediff-buffer-live-p ediff-buffer-C) | |
95 (aref (ediff-get-difference (, n) (, buf-type)) 3)))) | |
96 (defmacro ediff-set-state-of-diff (n buf-type val) | |
97 (` (aset (ediff-get-difference (, n) (, buf-type)) 3 (, val)))) | |
98 (defmacro ediff-get-state-of-merge (n) | |
99 (` (if (ediff-buffer-live-p ediff-buffer-C) | |
100 (aref (ediff-get-difference (, n) 'C) 4)))) | |
101 (defmacro ediff-set-state-of-merge (n val) | |
102 (` (aset (ediff-get-difference (, n) 'C) 4 (, val)))) | |
103 | |
104 ;; if flag is t, puts a mark on diff region saying that | |
105 ;; the differences are in white space only. If flag is nil, | |
106 ;; the region is marked as essential (i.e., differences are | |
107 ;; not just in the white space and newlines.) | |
108 (defmacro ediff-mark-diff-as-space-only (n flag) | |
109 (` (aset (ediff-get-difference (, n) 'A) 2 (, flag)))) | |
110 | |
111 (defmacro ediff-get-fine-diff-vector (n buf-type) | |
112 (` (ediff-get-fine-diff-vector-from-diff-record | |
113 (ediff-get-difference (, n) (, buf-type))))) | |
114 | |
115 | |
116 ;; Defines SYMBOL as an advertised local variable. | |
117 ;; Performs a defvar, then executes `make-variable-buffer-local' on | |
118 ;; the variable. Also sets the `permanent-local' property, | |
119 ;; so that `kill-all-local-variables' (called by major-mode setting | |
120 ;; commands) won't destroy Ediff control variables. | |
121 ;; | |
122 ;; Plagiarised from `emerge-defvar-local' for XEmacs. | |
123 (defmacro ediff-defvar-local (var value doc) | |
124 (` (progn | |
125 (defvar (, var) (, value) (, doc)) | |
126 (make-variable-buffer-local '(, var)) | |
127 (put '(, var) 'permanent-local t)))) | |
128 | |
129 ;; Macro to switch to BUFFER, evaluate FORMS, returns to original buffer. | |
130 ;; Differs from `save-excursion' in that it doesn't save the point and mark. | |
131 ;; This is essentially `emerge-eval-in-buffer' with the test for live buffers." | |
132 (defmacro ediff-eval-in-buffer (buffer &rest forms) | |
133 (` (let ((StartBuffer (current-buffer))) | |
134 (if (ediff-buffer-live-p (, buffer)) | |
135 (unwind-protect | |
136 (progn | |
137 (set-buffer (, buffer)) | |
138 (,@ forms)) | |
139 (set-buffer StartBuffer)) | |
140 (or (eq this-command 'ediff-quit) | |
141 (error | |
142 "You've killed an essential Ediff buffer---Please quit Ediff")) | |
143 )))) | |
144 | |
145 | |
146 (defmacro ediff-multiframe-setup-p () | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
147 (` (and (ediff-window-display-p) ediff-multiframe))) |
11042 | 148 |
149 (defmacro ediff-narrow-control-frame-p () | |
150 (` (and (ediff-multiframe-setup-p) | |
151 (equal ediff-help-message ediff-brief-message-string)))) | |
152 | |
153 (defmacro ediff-3way-comparison-job () | |
154 (` (memq | |
155 ediff-job-name | |
156 '(ediff-files3 ediff-buffers3)))) | |
157 (ediff-defvar-local ediff-3way-comparison-job nil "") | |
158 | |
159 (defmacro ediff-merge-job () | |
160 (` (memq | |
161 ediff-job-name | |
162 '(ediff-merge-files | |
163 ediff-merge-buffers | |
164 ediff-merge-files-with-ancestor | |
165 ediff-merge-buffers-with-ancestor | |
166 ediff-merge-revisions | |
167 ediff-merge-revisions-with-ancestor)))) | |
168 (ediff-defvar-local ediff-merge-job nil "") | |
169 | |
170 (defmacro ediff-merge-with-ancestor-job () | |
171 (` (memq | |
172 ediff-job-name | |
173 '(ediff-merge-files-with-ancestor | |
174 ediff-merge-buffers-with-ancestor | |
175 ediff-merge-revisions-with-ancestor)))) | |
176 (ediff-defvar-local ediff-merge-with-ancestor-job nil "") | |
177 | |
178 (defmacro ediff-3way-job () | |
179 (` (or ediff-3way-comparison-job ediff-merge-job))) | |
180 (ediff-defvar-local ediff-3way-job nil "") | |
181 | |
182 ;; A diff3 job is like a 3way job, but ediff-merge doesn't require the use | |
183 ;; of diff3. | |
184 (defmacro ediff-diff3-job () | |
185 (` (or ediff-3way-comparison-job | |
186 ediff-merge-with-ancestor-job))) | |
187 (ediff-defvar-local ediff-diff3-job nil "") | |
188 | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
189 (defmacro ediff-windows-job () |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
190 (` (memq ediff-job-name '(ediff-windows-wordwise ediff-windows-linewise)))) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
191 (ediff-defvar-local ediff-windows-job nil "") |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
192 |
11042 | 193 (defmacro ediff-word-mode-job () |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
194 (` (memq ediff-job-name '(ediff-windows-wordwise ediff-regions-wordwise)))) |
11042 | 195 (ediff-defvar-local ediff-word-mode-job nil "") |
196 | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
197 (defmacro ediff-narrow-job () |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
198 (` (memq ediff-job-name '(ediff-windows-wordwise |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
199 ediff-regions-wordwise |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
200 ediff-windows-linewise |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
201 ediff-regions-linewise)))) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
202 (ediff-defvar-local ediff-narrow-job nil "") |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
203 |
11042 | 204 |
205 ;; Hook variables | |
206 | |
207 (defvar ediff-before-setup-windows-hooks nil | |
208 "*Hooks to run before Ediff sets its own window config. | |
209 This can be used to save the previous window config, which can be restored | |
210 on ediff-quit or ediff-suspend.") | |
211 (defvar ediff-after-setup-windows-hooks nil | |
212 "*Hooks to run after Ediff sets its own window config. | |
213 This can be used to set up control window or icon in a desired place.") | |
214 (defvar ediff-before-setup-control-frame-hooks nil | |
215 "*Hooks run before setting up the frame to display Ediff Control Panel. | |
216 Can be used to change control frame parameters to position it where it | |
217 is desirable.") | |
218 (defvar ediff-after-setup-control-frame-hooks nil | |
219 "*Hooks run after setting up the frame to display Ediff Control Panel. | |
220 Can be used to move the frame where it is desired.") | |
221 (defvar ediff-startup-hooks nil | |
222 "*Hooks to run in the control buffer after Ediff has been set up.") | |
223 (defvar ediff-select-hooks nil | |
224 "*Hooks to run after a difference has been selected.") | |
225 (defvar ediff-unselect-hooks nil | |
226 "*Hooks to run after a difference has been unselected.") | |
227 (defvar ediff-prepare-buffer-hooks nil | |
228 "*Hooks called after buffers A, B, and C are set up.") | |
229 (defvar ediff-load-hooks nil | |
230 "*Hook run after Ediff is loaded. Can be used to change defaults.") | |
231 | |
232 (defvar ediff-mode-hooks nil | |
233 "*Hook run just after ediff-mode is set up in the control buffer. | |
234 This is done before any windows or frames are created. One can use it to | |
235 set local variables that determine how the display looks like.") | |
236 (defvar ediff-keymap-setup-hooks nil | |
237 "*Hook run just after the default bindings in Ediff keymap are set up.") | |
238 | |
239 (defvar ediff-display-help-hooks nil | |
240 "*Hooks run after preparing the help message.") | |
241 | |
242 (defvar ediff-suspend-hooks (list 'ediff-default-suspend-hook) | |
243 "*Hooks to run in the Ediff control buffer when Ediff is suspended.") | |
244 (defvar ediff-quit-hooks (list 'ediff-cleanup-mess) | |
245 "*Hooks to run in the Ediff control buffer after finishing Ediff.") | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
246 (defvar ediff-cleanup-hooks nil |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
247 "*Hooks to run on exiting Ediff but before killing the control buffer. |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
248 This is a place to do various cleanups, such as deleting the variant buffers. |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
249 Ediff provides a function, `ediff-janitor', as one such possible hook.") |
11042 | 250 |
251 | |
252 ;; Help messages | |
253 | |
254 (defconst ediff-long-help-message-head | |
255 " Moving around | Toggling features | Manipulations | |
256 =====================|===========================|=============================" | |
257 "The head of the full help message.") | |
258 (defconst ediff-long-help-message-tail | |
259 "=====================|===========================|============================= | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
260 | D -on-line manual | |
11042 | 261 i -status info | ? -help off | G -send bug report |
262 ------------------------------------------------------------------------------- | |
263 X,Y (x,y) on the left are meta-symbols for the keys A,B,C (a,b,c). | |
264 X,Y on the right are meta-symbols for buffers A,B,C. | |
265 A,B,C on the right denote the working buffers A,B,C, respectively." | |
266 "The tail of the full-help message.") | |
267 | |
268 (defconst ediff-long-help-message-compare3 | |
269 " | |
270 p,DEL -previous diff | | -vert/horiz split | xy -copy buf X's region to Y | |
271 n,SPC -next diff | h -hiliting | rx -restore buf X's old diff | |
272 j -jump to diff | @ -auto-refinement | * -refine current region | |
273 gx -goto X's point| | ! -update diff regions | |
274 C-l -recenter | ## -ignore whitespace | | |
275 v/V -scroll up/dn | #f/#h -focus/hide regions | wx -save buf X | |
276 </> -scroll lt/rt | X -read-only in buf X | wd -save diff output | |
277 z/q -suspend/quit | m -wide display | ~ -rotate buffers | |
278 " | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
279 "Help message usually used for 3-way comparison. |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
280 Normally, not a user option. See `ediff-help-message' for details.") |
11042 | 281 |
282 (defconst ediff-long-help-message-compare2 | |
283 " | |
284 p,DEL -previous diff | | -vert/horiz split |a/b -copy A/B's region to B/A | |
285 n,SPC -next diff | h -hiliting | rx -restore buf X's old diff | |
286 j -jump to diff | @ -auto-refinement | * -refine current region | |
287 gx -goto X's point| | ! -update diff regions | |
288 C-l -recenter | ## -ignore whitespace | | |
289 v/V -scroll up/dn | #f/#h -focus/hide regions | wx -save buf X | |
290 </> -scroll lt/rt | X -read-only in buf X | wd -save diff output | |
291 z/q -suspend/quit | m -wide display | ~ -swap buffers | |
292 " | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
293 "Help message usually used for 2-way comparison. |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
294 Normally, not a user option. See `ediff-help-message' for details.") |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
295 |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
296 (defconst ediff-long-help-message-narrow2 |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
297 " |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
298 p,DEL -previous diff | | -vert/horiz split |a/b -copy A/B's region to B/A |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
299 n,SPC -next diff | h -hiliting | rx -restore buf X's old diff |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
300 j -jump to diff | @ -auto-refinement | * -refine current region |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
301 gx -goto X's point| % -narrow/widen buffs | ! -update diff regions |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
302 C-l -recenter | ## -ignore whitespace | |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
303 v/V -scroll up/dn | #f/#h -focus/hide regions | wx -save buf X |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
304 </> -scroll lt/rt | X -read-only in buf X | wd -save diff output |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
305 z/q -suspend/quit | m -wide display | ~ -swap buffers |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
306 " |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
307 "Help message when comparing windows or regions line-by-line. |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
308 Normally, not a user option. See `ediff-help-message' for details.") |
11042 | 309 |
310 (defconst ediff-long-help-message-word-mode | |
311 " | |
312 p,DEL -previous diff | | -vert/horiz split | xy -copy buf X's region to Y | |
313 n,SPC -next diff | h -hiliting | rx -restore buf X's old diff | |
314 j -jump to diff | | | |
315 gx -goto X's point| % -narrow/widen buffs | ! -recompute diffs | |
316 C-l -recenter | | | |
317 v/V -scroll up/dn | #f/#h -focus/hide regions | wx -save buf X | |
318 </> -scroll lt/rt | X -read-only in buf X | wd -save diff output | |
319 z/q -suspend/quit | m -wide display | ~ -swap buffers | |
320 " | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
321 "Help message when comparing windows or regions word-by-word. |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
322 Normally, not a user option. See `ediff-help-message' for details.") |
11042 | 323 |
324 (defconst ediff-long-help-message-merge | |
325 " | |
326 p,DEL -previous diff | | -vert/horiz split | x -copy buf X's region to C | |
327 n,SPC -next diff | h -hiliting | r -restore buf C's old diff | |
328 j -jump to diff | @ -auto-refinement | * -refine current region | |
329 gx -goto X's point| ## -ignore whitespace | ! -update diff regions | |
330 C-l -recenter | #f/#h -focus/hide regions | + -combine diff regions | |
331 v/V -scroll up/dn | X -read-only in buf X | wx -save buf X | |
332 </> -scroll lt/rt | m -wide display | wd -save diff output | |
333 z/q -suspend/quit | s -shrink window C | ~ -swap buffers | |
334 | $ -show clashes only | & -merge w/new default | |
335 " | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
336 "Help message during merging. |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
337 Normally, not a user option. See `ediff-help-message' for details.") |
11042 | 338 |
339 ;; The actual long help message. | |
340 (ediff-defvar-local ediff-long-help-message "" | |
341 "Normally, not a user option. See `ediff-help-message' for details.") | |
342 | |
343 (defconst ediff-brief-message-string | |
344 " ? - help " | |
345 "Contents of the brief help message.") | |
346 ;; The actual brief help message | |
347 (ediff-defvar-local ediff-brief-help-message "" | |
348 "Normally, not a user option. See `ediff-help-message' for details.") | |
349 | |
350 (ediff-defvar-local ediff-brief-help-message-custom nil | |
351 "The brief help message that the user can customize. | |
352 If the user sets this to a parameter-less function, Ediff will use it to | |
353 produce the brief help message. This function must return a string.") | |
354 (ediff-defvar-local ediff-long-help-message-custom nil | |
355 "The long help message that the user can customize. | |
356 See `ediff-brief-help-message-custom' for more.") | |
357 | |
358 (defvar ediff-prefer-long-help-message nil | |
359 "*If t, Ediff starts with a long help message. Short help msg otherwise.") | |
360 | |
361 ;; The actual help message. | |
362 (ediff-defvar-local ediff-help-message "" | |
363 "The actual help message. | |
364 Normally, the user shouldn't touch this. However, if you want Ediff to | |
365 start up with different help messages for different jobs, you can change | |
366 the value of this variable and the variables `ediff-help-message-*' in | |
367 `ediff-startup-hooks'.") | |
368 | |
369 ;; Selective browsing | |
370 | |
371 (ediff-defvar-local ediff-skip-diff-region-function 'ediff-show-all-diffs | |
372 "Function that determines the next/previous diff region to show. | |
373 Should return t for regions to be ignored and nil otherwise. | |
374 This function gets a region number as an argument. The region number | |
375 is the one used internally by Ediff. It is 1 less than the number seen | |
376 by the user.") | |
377 | |
378 ;; Regexp that determines buf A regions to focus on when skipping to diff | |
379 (ediff-defvar-local ediff-regexp-focus-A "" "") | |
380 ;; Regexp that determines buf B regions to focus on when skipping to diff | |
381 (ediff-defvar-local ediff-regexp-focus-B "" "") | |
382 ;; Regexp that determines buf C regions to focus on when skipping to diff | |
383 (ediff-defvar-local ediff-regexp-focus-C "" "") | |
384 ;; connective that determines whether to focus regions that match both or | |
385 ;; one of the regexps | |
386 (ediff-defvar-local ediff-focus-regexp-connective 'and "") | |
387 | |
388 ;; Regexp that determines buf A regions to ignore when skipping to diff | |
389 (ediff-defvar-local ediff-regexp-hide-A "" "") | |
390 ;; Regexp that determines buf B regions to ignore when skipping to diff | |
391 (ediff-defvar-local ediff-regexp-hide-B "" "") | |
392 ;; Regexp that determines buf C regions to ignore when skipping to diff | |
393 (ediff-defvar-local ediff-regexp-hide-C "" "") | |
394 ;; connective that determines whether to hide regions that match both or | |
395 ;; one of the regexps | |
396 (ediff-defvar-local ediff-hide-regexp-connective 'and "") | |
397 | |
398 | |
399 (defvar ediff-ange-ftp-ftp-name (if ediff-xemacs-p | |
400 'ange-ftp-ftp-path | |
401 'ange-ftp-ftp-name) | |
402 "Function ange-ftp uses to find out if file is remote.") | |
403 | |
404 | |
405 ;; Copying difference regions between buffers. | |
406 (ediff-defvar-local ediff-killed-diffs-alist nil | |
407 "A list of killed diffs. | |
408 A diff is saved here if it is replaced by a diff | |
409 from another buffer. This alist has the form: | |
410 \((num (buff-object . diff) (buff-object . diff) (buff-object . diff)) ...), | |
411 where some buffer-objects may be missing.") | |
412 | |
413 | |
414 ;; Highlighting | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
415 ;;(defvar ediff-before-flag-bol (if ediff-emacs-p "->>\n" (make-glyph "->>\n")) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
416 (defvar ediff-before-flag-bol (if ediff-xemacs-p (make-glyph "->>") "->>") |
11042 | 417 "*Flag placed above the highlighted block of differences. |
418 Must end with newline.") | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
419 ;;(defvar ediff-after-flag-eol (if ediff-emacs-p "<<-\n" (make-glyph "<<-")) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
420 (defvar ediff-after-flag-eol (if ediff-xemacs-p (make-glyph "<<-") "<<-") |
11042 | 421 "*Flag placed below the highlighted block of differences. |
422 Must end with newline.") | |
423 | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
424 (defvar ediff-before-flag-mol (if ediff-xemacs-p (make-glyph "->>") "->>") |
11042 | 425 "*Like ediff-before-flag, used when a difference starts in mid-line.") |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
426 (defvar ediff-after-flag-mol (if ediff-xemacs-p (make-glyph "<<-") "<<-") |
11042 | 427 "*Like ediff-after-flag, used when a difference starts in mid-line.") |
428 | |
429 | |
430 (ediff-defvar-local ediff-use-faces t | |
431 "If t, differences are highlighted using faces on a window system. | |
432 If nil, they are highlighted using ASCII flags, ediff-before-flag | |
433 and ediff-after-flag. On a non-window system, differences are always | |
434 highlighted using ASCII flags. | |
435 This variable can be set either in .emacs or toggled interactively. | |
436 Use `setq-default' if setting it in .emacs") | |
437 | |
438 | |
439 ;; this indicates that diff regions are word-size, so fine diffs are | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
440 ;; permanently nixed; used in ediff-windows-wordwise and ediff-regions-wordwise |
11042 | 441 (ediff-defvar-local ediff-word-mode nil "") |
442 ;; Name of the job (ediff-files, ediff-windows, etc. | |
443 (ediff-defvar-local ediff-job-name nil "") | |
444 | |
445 ;; Narrowing and ediff-region/windows support | |
446 ;; This is a list (overlay-A overlay-B overlay-C) | |
447 ;; If set, Ediff compares only those parts of buffers A/B/C that lie within | |
448 ;; the bounds of these overlays. | |
449 (ediff-defvar-local ediff-narrow-bounds nil "") | |
450 | |
451 ;; List (overlay-A overlay-B overlay-C), where each overlay spans the | |
452 ;; entire corresponding buffer. | |
453 (ediff-defvar-local ediff-wide-bounds nil "") | |
454 | |
455 ;; Current visibility boundaries in buffers A, B, and C. | |
456 ;; This is also a list of overlays. When the user toggles narrow/widen, | |
457 ;; this list changes from ediff-wide-bounds to ediff-narrow-bounds. | |
458 ;; and back. | |
459 (ediff-defvar-local ediff-visible-bounds nil "") | |
460 | |
461 (ediff-defvar-local ediff-start-narrowed t | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
462 "Non-nil means start narrowed, if doing ediff-windows-* or ediff-regions-*") |
11042 | 463 (ediff-defvar-local ediff-quit-widened t |
464 "*Non-nil means: when finished, Ediff widens buffers A/B. | |
465 Actually, Ediff restores the scope of visibility that existed at startup.") | |
466 | |
467 (ediff-defvar-local ediff-highlight-all-diffs t | |
468 "If nil, only the selected differences are highlighted. | |
469 This variable can be set either in .emacs or toggled interactively, using | |
470 ediff-toggle-hilit. Use `setq-default' to set it.") | |
471 | |
472 ;; A var local to each control panel buffer. Indicates highlighting style | |
473 ;; in effect for this buffer: `face', `ascii', nil -- temporarily | |
474 ;; unhighlighted, `off' -- turned off \(on a dumb terminal only\). | |
475 (ediff-defvar-local ediff-highlighting-style nil "") | |
476 | |
477 | |
478 ;; Variables that control each Ediff session. They are local to the | |
479 ;; control buffer. | |
480 | |
481 ;; Mode variables | |
482 ;; The buffer in which the A variant is stored. | |
483 (ediff-defvar-local ediff-buffer-A nil "") | |
484 ;; The buffer in which the B variant is stored. | |
485 (ediff-defvar-local ediff-buffer-B nil "") | |
486 ;; The buffer in which the C variant is stored. | |
487 (ediff-defvar-local ediff-buffer-C nil "") | |
488 ;; Ancestor buffer | |
489 (ediff-defvar-local ediff-ancestor-buffer nil "") | |
490 ;; The control buffer of ediff. | |
491 (ediff-defvar-local ediff-control-buffer nil "") | |
492 | |
493 | |
494 ;; The suffix of the control buffer name. | |
495 (ediff-defvar-local ediff-control-buffer-suffix nil "") | |
496 ;; Same as ediff-control-buffer-suffix, but without <,>. | |
497 ;; It's a number rather than string. | |
498 (ediff-defvar-local ediff-control-buffer-number nil "") | |
499 | |
500 | |
501 ;; The original values of ediff-protected-variables for buffer A | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
502 (ediff-defvar-local ediff-buffer-values-orig-A nil "") |
11042 | 503 ;; The original values of ediff-protected-variables for buffer B |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
504 (ediff-defvar-local ediff-buffer-values-orig-B nil "") |
11042 | 505 ;; The original values of ediff-protected-variables for buffer C |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
506 (ediff-defvar-local ediff-buffer-values-orig-C nil "") |
11042 | 507 ;; Buffer-local variables to be saved then restored during Ediff sessions |
508 (defconst ediff-protected-variables '(buffer-read-only | |
509 mode-line-format)) | |
510 | |
511 ;; Vector of differences between the variants. Each difference is | |
512 ;; represented by a vector of two overlays plus a vector of fine diffs, | |
513 ;; plus a no-fine-diffs flag. The first overlay spans the | |
514 ;; difference region in the A buffer and the second overlays the diff in | |
515 ;; the B buffer. If a difference section is empty, the corresponding | |
516 ;; overlay's endpoints coincide. | |
517 ;; | |
518 ;; The precise form of a difference vector for one buffer is: | |
519 ;; [diff diff diff ...] | |
520 ;; where each diff has the form: | |
521 ;; [diff-overlay fine-diff-vector no-fine-diffs-flag state-of-difference | |
522 ;; state-of-merge] | |
523 ;; fine-diff-vector is a vector [fine-diff-overlay fine-diff-overlay ...] | |
524 ;; no-fine-diffs-flag says if there are fine differences. | |
525 ;; state-of-difference is A, B, C, or nil, indicating which buffer is | |
526 ;; different from the other two (used only in 3-way jobs. | |
527 ;; state-of-merge is default-A, default-B, prefer-A, or prefer-B. It | |
528 ;; indicates the way a diff region was created in buffer C. | |
529 (ediff-defvar-local ediff-difference-vector-A nil "") | |
530 (ediff-defvar-local ediff-difference-vector-B nil "") | |
531 (ediff-defvar-local ediff-difference-vector-C nil "") | |
532 | |
533 ;; The difference that is currently selected. | |
534 (ediff-defvar-local ediff-current-difference -1 "") | |
535 ;; Number of differences found. | |
536 (ediff-defvar-local ediff-number-of-differences nil "") | |
537 | |
538 ;; Buffer containing the output of diff, which is used by Ediff to step | |
539 ;; through files. | |
540 (ediff-defvar-local ediff-diff-buffer nil "") | |
541 ;; Like ediff-diff-buffer, but contains context diff. It is not used by | |
542 ;; Ediff, but it is saved in a file, if user requests so. | |
543 (ediff-defvar-local ediff-custom-diff-buffer nil "") | |
544 ;; Buffer used for diff-style fine differences between regions. | |
545 (ediff-defvar-local ediff-fine-diff-buffer nil "") | |
546 ;; Temporary buffer used for computing fine differences. | |
547 (defconst ediff-tmp-buffer " *ediff-tmp*" "") | |
548 ;; Buffer used for messages | |
549 (defconst ediff-msg-buffer " *ediff-message*" "") | |
550 ;; Buffer containing the output of diff when diff returns errors. | |
551 (ediff-defvar-local ediff-error-buffer nil "") | |
552 ;; Buffer to display debug info | |
553 (ediff-defvar-local ediff-debug-buffer "*ediff-debug*" "") | |
554 | |
555 ;; List of ediff control panels associated with each buffer A/B. | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
556 ;; Not used any more, but may be needed in the future |
11042 | 557 (ediff-defvar-local ediff-this-buffer-control-sessions nil "") |
558 | |
559 ;; to be deleted in due time | |
560 ;; List of difference overlays disturbed by working with the current diff. | |
561 (defvar ediff-disturbed-overlays nil "") | |
562 | |
563 ;; Priority of non-selected overlays. | |
564 (defvar ediff-shadow-overlay-priority 100 "") | |
565 | |
566 | |
567 (if ediff-xemacs-p | |
568 (progn | |
569 (fset 'ediff-read-event (symbol-function 'next-command-event)) | |
570 (fset 'ediff-overlayp (symbol-function 'extentp)) | |
571 (fset 'ediff-make-overlay (symbol-function 'make-extent)) | |
572 (fset 'ediff-delete-overlay (symbol-function 'delete-extent)) | |
573 (fset 'ediff-overlay-buffer (symbol-function 'extent-buffer)) | |
574 (fset 'ediff-overlay-get (symbol-function 'extent-property))) | |
575 (fset 'ediff-read-event (symbol-function 'read-event)) | |
576 (fset 'ediff-overlayp (symbol-function 'overlayp)) | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
577 (fset 'ediff-overlayp (symbol-function 'overlayp)) |
11042 | 578 (fset 'ediff-make-overlay (symbol-function 'make-overlay)) |
579 (fset 'ediff-delete-overlay (symbol-function 'delete-overlay)) | |
580 (fset 'ediff-overlay-buffer (symbol-function 'overlay-buffer)) | |
581 (fset 'ediff-overlay-get (symbol-function 'overlay-get))) | |
582 | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
583 ;; Check the current version against the major and minor version numbers |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
584 ;; using op: cur-vers op major.minor If emacs-major-version or |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
585 ;; emacs-minor-version are not defined, we assume that the current version |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
586 ;; is hopelessly outdated. We assume that emacs-major-version and |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
587 ;; emacs-minor-version are defined. Otherwise, for Emacs/XEmacs 19, if the |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
588 ;; current minor version is < 10 (xemacs) or < 23 (emacs) the return value |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
589 ;; will be nil (when op is =, >, or >=) and t (when op is <, <=), which may be |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
590 ;; incorrect. However, this gives correct result in our cases, since we are |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
591 ;; testing for sufficiently high Emacs versions. |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
592 (defun ediff-check-version (op major minor &optional type-of-emacs) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
593 (if (and (boundp 'emacs-major-version) (boundp 'emacs-minor-version)) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
594 (and (cond ((eq type-of-emacs 'xemacs) ediff-xemacs-p) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
595 ((eq type-of-emacs 'emacs) ediff-emacs-p) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
596 (t t)) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
597 (cond ((eq op '=) (and (= emacs-minor-version minor) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
598 (= emacs-major-version major))) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
599 ((memq op '(> >= < <=)) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
600 (and (or (funcall op emacs-major-version major) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
601 (= emacs-major-version major)) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
602 (if (= emacs-major-version major) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
603 (funcall op emacs-minor-version minor) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
604 t))) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
605 (t |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
606 (error "%S: Invalid op in ediff-check-version" op)))) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
607 (cond ((memq op '(= > >=)) nil) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
608 ((memq op '(< <=)) t)))) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
609 |
11042 | 610 ;; A fix for NeXT Step |
611 ;; Should probably be eliminated in later versions. | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
612 (if (and (ediff-window-display-p) (eq (ediff-device-type) 'ns)) |
11042 | 613 (progn |
614 (fset 'x-display-color-p (symbol-function 'ns-display-color-p)) | |
615 (fset 'x-color-defined-p (symbol-function 'ns-color-defined-p)) | |
616 (fset 'x-display-pixel-height (symbol-function 'ns-display-pixel-height)) | |
617 (fset 'x-display-pixel-width (symbol-function 'ns-display-pixel-width)) | |
618 )) | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
619 |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
620 (defsubst ediff-color-display-p () |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
621 (if ediff-emacs-p |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
622 (x-display-color-p) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
623 (eq (device-class (selected-device)) 'color))) |
11042 | 624 |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
625 (if (ediff-window-display-p) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
626 (if ediff-xemacs-p |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
627 (progn |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
628 (fset 'ediff-display-pixel-width |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
629 (symbol-function 'device-pixel-width)) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
630 (fset 'ediff-display-pixel-height |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
631 (symbol-function 'device-pixel-height)) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
632 (fset 'ediff-valid-color-p (symbol-function 'valid-color-name-p)) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
633 (fset 'ediff-get-face (symbol-function 'get-face))) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
634 ;; Temporary fix for OS/2 port of Emacs |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
635 ;; pm-win.el in PM-Emacs should be fixed. |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
636 (fset 'ediff-display-pixel-width |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
637 (symbol-function 'x-display-pixel-width)) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
638 (fset 'ediff-display-pixel-height |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
639 (symbol-function 'x-display-pixel-height)) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
640 (if (eq (ediff-device-type) 'pm) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
641 (fset 'ediff-valid-color-p |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
642 (function (lambda (color) (assoc color pm-color-alist)))) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
643 (fset 'ediff-valid-color-p (symbol-function 'x-color-defined-p))) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
644 (fset 'ediff-get-face (symbol-function 'internal-get-face)))) |
11042 | 645 |
646 | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
647 (if (not (ediff-window-display-p)) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
648 (fset 'ediff-make-current-diff-overlay (function (lambda (type) nil))) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
649 ;; window system |
11042 | 650 (defun ediff-set-face (ground face color) |
651 "Sets face foreground/background." | |
652 (if (ediff-valid-color-p color) | |
653 (if (eq ground 'foreground) | |
654 (set-face-foreground face color) | |
655 (set-face-background face color)) | |
656 (cond ((memq face | |
657 '(ediff-current-diff-face-A | |
658 ediff-current-diff-face-B | |
659 ediff-current-diff-face-C)) | |
660 (copy-face 'highlight face)) | |
661 ((memq face | |
662 '(ediff-fine-diff-face-A | |
663 ediff-fine-diff-face-B | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
664 ediff-fine-diff-face-C)) |
11042 | 665 (copy-face 'secondary-selection face) |
666 (set-face-underline-p face t)) | |
667 ((memq face | |
668 '(ediff-even-diff-face-A ediff-odd-diff-face-A | |
669 ediff-even-diff-face-B ediff-odd-diff-face-B | |
670 ediff-even-diff-face-C ediff-odd-diff-face-C)) | |
671 (copy-face 'secondary-selection face))))) | |
672 | |
673 (defvar ediff-current-diff-face-A | |
674 (progn | |
675 (make-face 'ediff-current-diff-face-A) | |
676 (or (face-differs-from-default-p 'ediff-current-diff-face-A) | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
677 (cond ((ediff-color-display-p) |
11042 | 678 (ediff-set-face |
679 'foreground 'ediff-current-diff-face-A "firebrick") | |
680 (ediff-set-face | |
681 'background 'ediff-current-diff-face-A "pale green")) | |
682 (t | |
683 (if ediff-xemacs-p | |
684 (copy-face 'modeline 'ediff-current-diff-face-A) | |
685 (copy-face 'highlight 'ediff-current-diff-face-A)) | |
686 ))) | |
687 'ediff-current-diff-face-A) | |
688 "Face for highlighting the selected difference in buffer A.") | |
689 | |
690 (defvar ediff-current-diff-face-B | |
691 (progn | |
692 (make-face 'ediff-current-diff-face-B) | |
693 (or (face-differs-from-default-p 'ediff-current-diff-face-B) | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
694 (cond ((ediff-color-display-p) |
11042 | 695 (ediff-set-face |
696 'foreground 'ediff-current-diff-face-B "DarkOrchid") | |
697 (ediff-set-face | |
698 'background 'ediff-current-diff-face-B "Yellow")) | |
699 (t | |
700 (if ediff-xemacs-p | |
701 (copy-face 'modeline 'ediff-current-diff-face-B) | |
702 (copy-face 'highlight 'ediff-current-diff-face-B)) | |
703 ))) | |
704 'ediff-current-diff-face-B) | |
705 "Face for highlighting the selected difference in buffer B.") | |
706 | |
707 | |
708 (defvar ediff-current-diff-face-C | |
709 (progn | |
710 (make-face 'ediff-current-diff-face-C) | |
711 (or (face-differs-from-default-p 'ediff-current-diff-face-C) | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
712 (cond ((ediff-color-display-p) |
11042 | 713 (ediff-set-face |
714 'foreground 'ediff-current-diff-face-C "Navy") | |
715 (ediff-set-face | |
716 'background 'ediff-current-diff-face-C "Pink")) | |
717 (t | |
718 (if ediff-xemacs-p | |
719 (copy-face 'modeline 'ediff-current-diff-face-C) | |
720 (copy-face 'highlight 'ediff-current-diff-face-C)) | |
721 ))) | |
722 'ediff-current-diff-face-C) | |
723 "Face for highlighting the selected difference in buffer C.") | |
724 | |
725 (defvar ediff-fine-diff-face-A | |
726 (progn | |
727 (make-face 'ediff-fine-diff-face-A) | |
728 (or (face-differs-from-default-p 'ediff-fine-diff-face-A) | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
729 (cond ((ediff-color-display-p) |
11042 | 730 (ediff-set-face 'foreground 'ediff-fine-diff-face-A |
731 "Navy") | |
732 (ediff-set-face 'background 'ediff-fine-diff-face-A | |
733 "sky blue")) | |
734 (t (set-face-underline-p 'ediff-fine-diff-face-A t)))) | |
735 'ediff-fine-diff-face-A) | |
736 "Face for highlighting the refinement of the selected diff in buffer A.") | |
737 | |
738 (defvar ediff-fine-diff-face-B | |
739 (progn | |
740 (make-face 'ediff-fine-diff-face-B) | |
741 (or (face-differs-from-default-p 'ediff-fine-diff-face-B) | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
742 (cond ((ediff-color-display-p) |
11042 | 743 (ediff-set-face 'foreground 'ediff-fine-diff-face-B "Black") |
744 (ediff-set-face 'background 'ediff-fine-diff-face-B "cyan")) | |
745 (t (set-face-underline-p 'ediff-fine-diff-face-B t)))) | |
746 'ediff-fine-diff-face-B) | |
747 "Face for highlighting the refinement of the selected diff in buffer B.") | |
748 | |
749 (defvar ediff-fine-diff-face-C | |
750 (progn | |
751 (make-face 'ediff-fine-diff-face-C) | |
752 (or (face-differs-from-default-p 'ediff-fine-diff-face-C) | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
753 (cond ((ediff-color-display-p) |
11042 | 754 (ediff-set-face 'foreground 'ediff-fine-diff-face-C "black") |
755 (ediff-set-face | |
756 'background 'ediff-fine-diff-face-C "Turquoise")) | |
757 (t (set-face-underline-p 'ediff-fine-diff-face-C t)))) | |
758 'ediff-fine-diff-face-C) | |
759 "Face for highlighting the refinement of the selected diff in buffer C.") | |
760 | |
761 (defvar ediff-even-diff-face-A | |
762 (progn | |
763 (make-face 'ediff-even-diff-face-A) | |
764 (or (face-differs-from-default-p 'ediff-even-diff-face-A) | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
765 (cond ((ediff-color-display-p) |
11042 | 766 (ediff-set-face |
767 'foreground 'ediff-even-diff-face-A "black") | |
768 (ediff-set-face | |
769 'background 'ediff-even-diff-face-A "light grey")) | |
770 (t | |
771 (copy-face 'italic 'ediff-even-diff-face-A)))) | |
772 'ediff-even-diff-face-A) | |
773 "Face used to highlight even-numbered differences in buffer A.") | |
774 | |
775 (defvar ediff-even-diff-face-B | |
776 (progn | |
777 (make-face 'ediff-even-diff-face-B) | |
778 (or (face-differs-from-default-p 'ediff-even-diff-face-B) | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
779 (cond ((ediff-color-display-p) |
11042 | 780 (ediff-set-face |
781 'foreground 'ediff-even-diff-face-B "White") | |
782 (ediff-set-face | |
783 'background 'ediff-even-diff-face-B "Gray")) | |
784 (t | |
785 (copy-face 'italic 'ediff-even-diff-face-B)))) | |
786 'ediff-even-diff-face-B) | |
787 "Face used to highlight even-numbered differences in buffer B.") | |
788 | |
789 (defvar ediff-even-diff-face-C | |
790 (progn | |
791 (make-face 'ediff-even-diff-face-C) | |
792 (copy-face 'ediff-even-diff-face-A 'ediff-even-diff-face-C) | |
793 'ediff-even-diff-face-C) | |
794 "Face used to highlight even-numbered differences in buffer C.") | |
795 | |
796 (defvar ediff-odd-diff-face-A | |
797 (progn | |
798 (make-face 'ediff-odd-diff-face-A) | |
799 (or (face-differs-from-default-p 'ediff-odd-diff-face-A) | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
800 (cond ((ediff-color-display-p) |
11042 | 801 (ediff-set-face |
802 'foreground 'ediff-odd-diff-face-A "White") | |
803 (ediff-set-face | |
804 'background 'ediff-odd-diff-face-A "Gray")) | |
805 (t | |
806 (copy-face 'italic 'ediff-odd-diff-face-A)))) | |
807 'ediff-odd-diff-face-A) | |
808 "Face used to highlight odd-numbered differences in buffer A.") | |
809 | |
810 (defvar ediff-odd-diff-face-B | |
811 (progn | |
812 (make-face 'ediff-odd-diff-face-B) | |
813 (or (face-differs-from-default-p 'ediff-odd-diff-face-B) | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
814 (cond ((ediff-color-display-p) |
11042 | 815 (ediff-set-face |
816 'foreground 'ediff-odd-diff-face-B "Black") | |
817 (ediff-set-face | |
818 'background 'ediff-odd-diff-face-B "light grey")) | |
819 (t | |
820 (copy-face 'italic 'ediff-odd-diff-face-B)))) | |
821 'ediff-odd-diff-face-B) | |
822 "Face used to highlight odd-numbered differences in buffer B.") | |
823 | |
824 (defvar ediff-odd-diff-face-C | |
825 (progn | |
826 (make-face 'ediff-odd-diff-face-C) | |
827 (copy-face 'ediff-odd-diff-face-A 'ediff-odd-diff-face-C) | |
828 'ediff-odd-diff-face-C) | |
829 "Face used to highlight odd-numbered differences in buffer C.") | |
830 | |
831 ;; Create *-var faces. These are the actual faces used to highlight | |
832 ;; odd-numbered difference regions. | |
833 ;; They are used as follows: when highlighting is turned on, | |
834 ;; ediff-odd/even-diff-face-A/B/C are copied | |
835 ;; into ediff-odd/even-diff-face-A/B/C-var, and all odd/even overlays become | |
836 ;; highlighted. When highlighting is turned off, then the face 'default is | |
837 ;; copied into ediff-odd/even-diff-face-A/B/C-var, thereby unhighlighting all | |
838 ;; difference regions. | |
839 (make-face 'ediff-even-diff-face-A-var) | |
840 (make-face 'ediff-even-diff-face-B-var) | |
841 (make-face 'ediff-even-diff-face-C-var) | |
842 (make-face 'ediff-odd-diff-face-A-var) | |
843 (make-face 'ediff-odd-diff-face-B-var) | |
844 (make-face 'ediff-odd-diff-face-C-var) | |
845 | |
846 ;; initialize *-var faces | |
847 (defun ediff-init-var-faces () | |
848 (copy-face (if (and ediff-use-faces ediff-highlight-all-diffs) | |
849 ediff-even-diff-face-A 'default) | |
850 'ediff-even-diff-face-A-var) | |
851 (copy-face (if (and ediff-use-faces ediff-highlight-all-diffs) | |
852 ediff-even-diff-face-B 'default) | |
853 'ediff-even-diff-face-B-var) | |
854 (copy-face (if (and ediff-use-faces ediff-highlight-all-diffs) | |
855 ediff-even-diff-face-C 'default) | |
856 'ediff-even-diff-face-C-var) | |
857 (copy-face (if (and ediff-use-faces ediff-highlight-all-diffs) | |
858 ediff-odd-diff-face-A 'default) | |
859 'ediff-odd-diff-face-A-var) | |
860 (copy-face (if (and ediff-use-faces ediff-highlight-all-diffs) | |
861 ediff-odd-diff-face-B 'default) | |
862 'ediff-odd-diff-face-B-var) | |
863 (copy-face (if (and ediff-use-faces ediff-highlight-all-diffs) | |
864 ediff-odd-diff-face-C 'default) | |
865 'ediff-odd-diff-face-C-var) | |
866 ) | |
867 | |
868 | |
869 ;;; Overlays | |
870 | |
871 (ediff-defvar-local ediff-current-diff-overlay-A nil | |
872 "Overlay for the current difference region in buffer A.") | |
873 (ediff-defvar-local ediff-current-diff-overlay-B nil | |
874 "Overlay for the current difference region in buffer B.") | |
875 (ediff-defvar-local ediff-current-diff-overlay-C nil | |
876 "Overlay for the current difference region in buffer C.") | |
877 | |
878 (defun ediff-make-current-diff-overlay (type) | |
879 (let ((overlay (intern (format "ediff-current-diff-overlay-%S" type))) | |
880 (buffer (ediff-get-buffer type)) | |
881 (face (face-name | |
882 (symbol-value | |
883 (intern (format "ediff-current-diff-face-%S" type)))))) | |
884 (set overlay | |
885 (ediff-make-bullet-proof-overlay (point-max) (point-max) buffer)) | |
886 (ediff-overlay-put (symbol-value overlay) 'face face) | |
887 (ediff-overlay-put (symbol-value overlay) 'ediff ediff-control-buffer) | |
888 )) | |
889 | |
890 ;; Compute priority of ediff overlay. | |
891 (defun ediff-highest-priority (start end buffer) | |
892 (let ((pos (max 1 (1- start))) | |
893 ovr-list) | |
894 (if ediff-xemacs-p | |
895 (1+ ediff-shadow-overlay-priority) | |
896 (ediff-eval-in-buffer buffer | |
897 (while (< pos (min (point-max) (1+ end))) | |
898 (setq ovr-list (append (overlays-at pos) ovr-list)) | |
899 (setq pos (next-overlay-change pos))) | |
900 (1+ (apply '+ | |
901 (mapcar (function | |
902 (lambda (ovr) | |
903 (if ovr | |
904 (or (ediff-overlay-get ovr 'priority) 0) | |
905 0))) | |
906 ovr-list) | |
907 )) | |
908 )))) | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
909 ) |
11042 | 910 |
911 | |
912 (defvar ediff-toggle-read-only-function nil | |
913 "*Specifies the function to be used to toggle read-only. | |
914 If nil, Ediff tries to deduce the function from the binding of C-x C-q. | |
915 Normally, this is the `toggle-read-only' function, but, if version | |
916 control is used, it could be `vc-toggle-read-only' or `rcs-toggle-read-only'.") | |
917 | |
918 | |
919 ;;; Misc | |
920 | |
921 ;; if nil, this silences some messages | |
922 (defconst ediff-verbose-p t) | |
923 | |
924 (defvar ediff-no-emacs-help-in-control-buffer nil | |
925 "*Non-nil means C-h should not invoke Emacs help in control buffer. | |
926 Instead, C-h jumps to previous difference.") | |
927 | |
928 (defvar ediff-temp-file-prefix | |
929 (let ((env (or (getenv "TMPDIR") | |
930 (getenv "TMP") | |
931 (getenv "TEMP"))) | |
932 d) | |
933 (setq d (if (and env (> (length env) 0)) | |
934 env | |
935 (if (memq system-type '(vax-vms axp-vms)) | |
936 "SYS$SCRATCH:" | |
937 "/tmp"))) | |
938 ;; The following is to make sure we get something to which we can | |
939 ;; add directory levels on VMS. | |
940 (setq d (file-name-as-directory (directory-file-name d))) | |
941 ) | |
942 "*Prefix to put on Ediff temporary file names. | |
943 Do not start with `~/' or `~user-name/'.") | |
944 | |
945 (defvar ediff-temp-file-mode 384 ; u=rw only | |
946 "*Mode for Ediff temporary files.") | |
947 | |
948 ;; Metacharacters that have to be protected from the shell when executing | |
949 ;; a diff/diff3 command. | |
950 (defvar ediff-metachars "[ \t\n!\"#$&'()*;<=>?[\\^`{|~]" | |
951 "Characters that must be quoted with \\ when used in a shell command line. | |
952 More precisely, a regexp to match any one such character.") | |
953 | |
954 | |
955 (ediff-defvar-local ediff-temp-file-A nil | |
956 "Temporary file used for refining difference regions in buffer A.") | |
957 (ediff-defvar-local ediff-temp-file-B nil | |
958 "Temporary file used for refining difference regions in buffer B.") | |
959 (ediff-defvar-local ediff-temp-file-C nil | |
960 "Temporary file used for refining difference regions in buffer C.") | |
961 | |
962 ;;; In-line functions | |
963 | |
964 (defsubst ediff-file-remote-p (file-name) | |
965 (if (fboundp ediff-ange-ftp-ftp-name) | |
966 (funcall ediff-ange-ftp-ftp-name file-name))) | |
967 | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
968 ;;(defun ediff-frame-has-menubar () |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
969 ;; (and (ediff-window-display-p) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
970 ;; (if ediff-xemacs-p |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
971 ;; current-menubar |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
972 ;; (let ((lines (cdr (assq 'menu-bar-lines |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
973 ;; (frame-parameters (selected-frame)))))) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
974 ;; (or (eq lines t) (and (numberp lines) (< 0 lines)))) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
975 ;; ))) |
11042 | 976 |
977 (defsubst ediff-frame-unsplittable-p (frame) | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
978 (cdr (assq 'unsplittable (frame-parameters frame)))) |
11042 | 979 |
980 (defsubst ediff-get-next-window (wind prev-wind) | |
981 (or (window-live-p wind) | |
982 (setq wind (if prev-wind | |
983 (next-window wind) | |
984 (selected-window))))) | |
985 | |
986 (defsubst ediff-convert-diffs-to-overlays (diff-list) | |
987 (ediff-set-diff-overlays-in-one-buffer 'A diff-list) | |
988 (ediff-set-diff-overlays-in-one-buffer 'B diff-list) | |
989 (if ediff-3way-job | |
990 (ediff-set-diff-overlays-in-one-buffer 'C diff-list)) | |
991 (message "Processing difference regions ... done")) | |
992 | |
993 | |
994 (defsubst ediff-kill-buffer-carefully (buf) | |
995 "Kill buffer BUF if it exists." | |
996 (if (ediff-buffer-live-p buf) | |
997 (kill-buffer (get-buffer buf)))) | |
998 | |
999 | |
1000 (defsubst ediff-highlight-diff (n) | |
1001 "Put face on diff N. Invoked for X displays only." | |
1002 (ediff-highlight-diff-in-one-buffer n 'A) | |
1003 (ediff-highlight-diff-in-one-buffer n 'B) | |
1004 (ediff-highlight-diff-in-one-buffer n 'C)) | |
1005 | |
1006 | |
1007 (defsubst ediff-unhighlight-diff () | |
1008 "Remove overlays from buffers A, B, and C." | |
1009 (ediff-unhighlight-diff-in-one-buffer 'A) | |
1010 (ediff-unhighlight-diff-in-one-buffer 'B) | |
1011 (ediff-unhighlight-diff-in-one-buffer 'C)) | |
1012 | |
1013 ;; delete highlighting overlays, restore faces to their original form | |
1014 (defsubst ediff-unhighlight-diffs-totally () | |
1015 (ediff-unhighlight-diffs-totally-in-one-buffer 'A) | |
1016 (ediff-unhighlight-diffs-totally-in-one-buffer 'B) | |
1017 (ediff-unhighlight-diffs-totally-in-one-buffer 'C)) | |
1018 | |
1019 | |
1020 ;; arg is a record for a given diff in a difference vector | |
1021 ;; this record is itself a vector | |
1022 (defsubst ediff-clear-fine-diff-vector (diff-record) | |
1023 (if diff-record | |
1024 (mapcar 'ediff-delete-overlay | |
1025 (ediff-get-fine-diff-vector-from-diff-record diff-record)))) | |
1026 | |
1027 (defsubst ediff-clear-fine-differences-in-one-buffer (n buf-type) | |
1028 (ediff-clear-fine-diff-vector (ediff-get-difference n buf-type)) | |
1029 (ediff-set-fine-diff-vector n buf-type nil)) | |
1030 | |
1031 (defsubst ediff-clear-fine-differences (n) | |
1032 (ediff-clear-fine-differences-in-one-buffer n 'A) | |
1033 (ediff-clear-fine-differences-in-one-buffer n 'B) | |
1034 (if ediff-3way-job | |
1035 (ediff-clear-fine-differences-in-one-buffer n 'C))) | |
1036 | |
1037 | |
1038 (defsubst ediff-convert-fine-diffs-to-overlays (diff-list region-num) | |
1039 (ediff-set-fine-overlays-in-one-buffer 'A diff-list region-num) | |
1040 (ediff-set-fine-overlays-in-one-buffer 'B diff-list region-num) | |
1041 (if ediff-3way-job | |
1042 (ediff-set-fine-overlays-in-one-buffer 'C diff-list region-num) | |
1043 )) | |
1044 | |
1045 (defsubst ediff-mouse-event-p (event) | |
1046 (if ediff-xemacs-p | |
1047 (button-event-p event) | |
1048 (string-match "mouse" (format "%S" (event-basic-type event))) | |
1049 )) | |
1050 | |
1051 (defsubst ediff-frame-iconified-p (frame) | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1052 (if (and (ediff-window-display-p) (frame-live-p frame)) |
11042 | 1053 (if ediff-xemacs-p |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1054 (frame-iconified-p frame) |
11042 | 1055 (eq (frame-visible-p frame) 'icon)))) |
1056 | |
1057 (defsubst ediff-window-visible-p (wind) | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1058 ;; under TTY, window-live-p also means window is visible |
11042 | 1059 (and (window-live-p wind) |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1060 (or (not (ediff-window-display-p)) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1061 (frame-visible-p (window-frame wind))))) |
11042 | 1062 |
1063 | |
1064 (defsubst ediff-frame-char-width (frame) | |
1065 (if ediff-xemacs-p | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1066 (/ (frame-pixel-width frame) (frame-width frame)) |
11042 | 1067 (frame-char-width frame))) |
1068 | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1069 (defsubst ediff-reset-mouse (&optional frame) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1070 (setq frame |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1071 (if ediff-xemacs-p |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1072 (frame-selected-window (or frame (selected-frame))) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1073 (or frame (selected-frame)))) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1074 (if (ediff-window-display-p) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1075 (set-mouse-position frame 1 0))) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1076 |
11042 | 1077 (defsubst ediff-frame-char-height (frame) |
1078 (if ediff-xemacs-p | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1079 (/ (frame-pixel-height frame) (frame-height frame)) |
11042 | 1080 (frame-char-height frame))) |
1081 | |
1082 | |
1083 (defsubst ediff-empty-overlay-p (overl) | |
1084 (= (ediff-overlay-start overl) (ediff-overlay-end overl))) | |
1085 | |
1086 ;; t if diff region is empty. | |
1087 ;; In case of buffer C, t also if it is not a 3way | |
1088 ;; comparison job (merging jobs return t as well). | |
1089 (defun ediff-empty-diff-region-p (n buf-type) | |
1090 (if (eq buf-type 'C) | |
1091 (or (not ediff-3way-comparison-job) | |
1092 (= (ediff-get-diff-posn 'C 'beg n) | |
1093 (ediff-get-diff-posn 'C 'end n))) | |
1094 (= (ediff-get-diff-posn buf-type 'beg n) | |
1095 (ediff-get-diff-posn buf-type 'end n)))) | |
1096 | |
1097 ;; Test if diff region is white space only. | |
1098 ;; If 2-way job and buf-type = C, then returns t. | |
1099 (defun ediff-whitespace-diff-region-p (n buf-type) | |
1100 (or (and (eq buf-type 'C) (not ediff-3way-job)) | |
1101 (let ((beg (ediff-get-diff-posn buf-type 'beg n)) | |
1102 (end (ediff-get-diff-posn buf-type 'end n))) | |
1103 (ediff-eval-in-buffer (ediff-get-buffer buf-type) | |
1104 (save-excursion | |
1105 (goto-char beg) | |
1106 (skip-chars-forward ediff-whitespace) | |
1107 (>= (point) end)))))) | |
1108 | |
1109 ;; temporarily uses DIR to abbreviate file name | |
1110 ;; if DIR is nil, use default-directory | |
1111 (defsubst ediff-abbreviate-filename (file dir) | |
1112 (let* ((dir (or dir default-directory)) | |
1113 (directory-abbrev-alist (list (cons dir "")))) | |
1114 (abbreviate-file-name file))) | |
1115 | |
1116 (defsubst ediff-get-region-contents (n buf-type ctrl-buf &optional start end) | |
1117 (ediff-eval-in-buffer | |
1118 (ediff-eval-in-buffer ctrl-buf (ediff-get-buffer buf-type)) | |
1119 (buffer-substring | |
1120 (or start (ediff-get-diff-posn buf-type 'beg n ctrl-buf)) | |
1121 (or end (ediff-get-diff-posn buf-type 'end n ctrl-buf))))) | |
1122 | |
1123 ;; If ediff modified mode line, strip the modification | |
1124 (defsubst ediff-strip-mode-line-format () | |
1125 (if (member (car mode-line-format) '(" A: " " B: " " C: ")) | |
1126 (setq mode-line-format (nth 2 mode-line-format)))) | |
1127 | |
1128 ;; Verify that we have a difference selected. | |
1129 (defsubst ediff-valid-difference-p (&optional n) | |
1130 (or n (setq n ediff-current-difference)) | |
1131 (and (>= n 0) (< n ediff-number-of-differences))) | |
1132 | |
1133 (defsubst ediff-show-all-diffs (n) | |
1134 "Don't skip difference regions." | |
1135 nil) | |
1136 | |
1137 (provide 'ediff-init) | |
1138 | |
1139 | |
1140 ;;; ediff-init.el ends here |