Mercurial > emacs
annotate lisp/ediff-init.el @ 12176:3e14d94320f2
(system_key_syms): Deleted; now part of struct kboard.
(make_lispy_event): Use the struct member.
(init_kboard): Initialize it.
(syms_of_keyboard): Delete initialization and staticpro.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Fri, 09 Jun 1995 20:37:54 +0000 |
parents | 589a32fa67a9 |
children | 5ab666b86a02 |
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 |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
610 |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
611 ;; warn if it is a wrong emacs |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
612 (if (or (ediff-check-version '< 19 29 'emacs) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
613 (ediff-check-version '< 19 12 'xemacs)) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
614 (progn |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
615 (with-output-to-temp-buffer ediff-msg-buffer |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
616 (switch-to-buffer ediff-msg-buffer) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
617 (insert |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
618 (format " |
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 This version of Ediff requires |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
621 |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
622 \t Emacs 19.29 and higher |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
623 \t OR |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
624 \t XEmacs 19.12 and higher |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
625 |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
626 It is unlikely to work under Emacs version %s |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
627 that you are using... |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
628 |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
629 Type any key to continue..." emacs-version)) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
630 (beep 1) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
631 (beep 1) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
632 (ediff-read-event)) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
633 (kill-buffer ediff-msg-buffer))) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
634 |
11042 | 635 ;; A fix for NeXT Step |
636 ;; Should probably be eliminated in later versions. | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
637 (if (and (ediff-window-display-p) (eq (ediff-device-type) 'ns)) |
11042 | 638 (progn |
639 (fset 'x-display-color-p (symbol-function 'ns-display-color-p)) | |
640 (fset 'x-color-defined-p (symbol-function 'ns-color-defined-p)) | |
641 (fset 'x-display-pixel-height (symbol-function 'ns-display-pixel-height)) | |
642 (fset 'x-display-pixel-width (symbol-function 'ns-display-pixel-width)) | |
643 )) | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
644 |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
645 (defsubst ediff-color-display-p () |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
646 (if ediff-emacs-p |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
647 (x-display-color-p) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
648 (eq (device-class (selected-device)) 'color))) |
11042 | 649 |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
650 (if (ediff-window-display-p) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
651 (if ediff-xemacs-p |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
652 (progn |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
653 (fset 'ediff-display-pixel-width |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
654 (symbol-function 'device-pixel-width)) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
655 (fset 'ediff-display-pixel-height |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
656 (symbol-function 'device-pixel-height)) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
657 (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
|
658 (fset 'ediff-get-face (symbol-function 'get-face))) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
659 ;; Temporary fix for OS/2 port of Emacs |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
660 ;; 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
|
661 (fset 'ediff-display-pixel-width |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
662 (symbol-function 'x-display-pixel-width)) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
663 (fset 'ediff-display-pixel-height |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
664 (symbol-function 'x-display-pixel-height)) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
665 (if (eq (ediff-device-type) 'pm) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
666 (fset 'ediff-valid-color-p |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
667 (function (lambda (color) (assoc color pm-color-alist)))) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
668 (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
|
669 (fset 'ediff-get-face (symbol-function 'internal-get-face)))) |
11042 | 670 |
671 | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
672 (if (not (ediff-window-display-p)) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
673 (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
|
674 ;; window system |
11042 | 675 (defun ediff-set-face (ground face color) |
676 "Sets face foreground/background." | |
677 (if (ediff-valid-color-p color) | |
678 (if (eq ground 'foreground) | |
679 (set-face-foreground face color) | |
680 (set-face-background face color)) | |
681 (cond ((memq face | |
682 '(ediff-current-diff-face-A | |
683 ediff-current-diff-face-B | |
684 ediff-current-diff-face-C)) | |
685 (copy-face 'highlight face)) | |
686 ((memq face | |
687 '(ediff-fine-diff-face-A | |
688 ediff-fine-diff-face-B | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
689 ediff-fine-diff-face-C)) |
11042 | 690 (copy-face 'secondary-selection face) |
691 (set-face-underline-p face t)) | |
692 ((memq face | |
693 '(ediff-even-diff-face-A ediff-odd-diff-face-A | |
694 ediff-even-diff-face-B ediff-odd-diff-face-B | |
695 ediff-even-diff-face-C ediff-odd-diff-face-C)) | |
696 (copy-face 'secondary-selection face))))) | |
697 | |
698 (defvar ediff-current-diff-face-A | |
699 (progn | |
700 (make-face 'ediff-current-diff-face-A) | |
701 (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
|
702 (cond ((ediff-color-display-p) |
11042 | 703 (ediff-set-face |
704 'foreground 'ediff-current-diff-face-A "firebrick") | |
705 (ediff-set-face | |
706 'background 'ediff-current-diff-face-A "pale green")) | |
707 (t | |
708 (if ediff-xemacs-p | |
709 (copy-face 'modeline 'ediff-current-diff-face-A) | |
710 (copy-face 'highlight 'ediff-current-diff-face-A)) | |
711 ))) | |
712 'ediff-current-diff-face-A) | |
713 "Face for highlighting the selected difference in buffer A.") | |
714 | |
715 (defvar ediff-current-diff-face-B | |
716 (progn | |
717 (make-face 'ediff-current-diff-face-B) | |
718 (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
|
719 (cond ((ediff-color-display-p) |
11042 | 720 (ediff-set-face |
721 'foreground 'ediff-current-diff-face-B "DarkOrchid") | |
722 (ediff-set-face | |
723 'background 'ediff-current-diff-face-B "Yellow")) | |
724 (t | |
725 (if ediff-xemacs-p | |
726 (copy-face 'modeline 'ediff-current-diff-face-B) | |
727 (copy-face 'highlight 'ediff-current-diff-face-B)) | |
728 ))) | |
729 'ediff-current-diff-face-B) | |
730 "Face for highlighting the selected difference in buffer B.") | |
731 | |
732 | |
733 (defvar ediff-current-diff-face-C | |
734 (progn | |
735 (make-face 'ediff-current-diff-face-C) | |
736 (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
|
737 (cond ((ediff-color-display-p) |
11042 | 738 (ediff-set-face |
739 'foreground 'ediff-current-diff-face-C "Navy") | |
740 (ediff-set-face | |
741 'background 'ediff-current-diff-face-C "Pink")) | |
742 (t | |
743 (if ediff-xemacs-p | |
744 (copy-face 'modeline 'ediff-current-diff-face-C) | |
745 (copy-face 'highlight 'ediff-current-diff-face-C)) | |
746 ))) | |
747 'ediff-current-diff-face-C) | |
748 "Face for highlighting the selected difference in buffer C.") | |
749 | |
750 (defvar ediff-fine-diff-face-A | |
751 (progn | |
752 (make-face 'ediff-fine-diff-face-A) | |
753 (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
|
754 (cond ((ediff-color-display-p) |
11042 | 755 (ediff-set-face 'foreground 'ediff-fine-diff-face-A |
756 "Navy") | |
757 (ediff-set-face 'background 'ediff-fine-diff-face-A | |
758 "sky blue")) | |
759 (t (set-face-underline-p 'ediff-fine-diff-face-A t)))) | |
760 'ediff-fine-diff-face-A) | |
761 "Face for highlighting the refinement of the selected diff in buffer A.") | |
762 | |
763 (defvar ediff-fine-diff-face-B | |
764 (progn | |
765 (make-face 'ediff-fine-diff-face-B) | |
766 (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
|
767 (cond ((ediff-color-display-p) |
11042 | 768 (ediff-set-face 'foreground 'ediff-fine-diff-face-B "Black") |
769 (ediff-set-face 'background 'ediff-fine-diff-face-B "cyan")) | |
770 (t (set-face-underline-p 'ediff-fine-diff-face-B t)))) | |
771 'ediff-fine-diff-face-B) | |
772 "Face for highlighting the refinement of the selected diff in buffer B.") | |
773 | |
774 (defvar ediff-fine-diff-face-C | |
775 (progn | |
776 (make-face 'ediff-fine-diff-face-C) | |
777 (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
|
778 (cond ((ediff-color-display-p) |
11042 | 779 (ediff-set-face 'foreground 'ediff-fine-diff-face-C "black") |
780 (ediff-set-face | |
781 'background 'ediff-fine-diff-face-C "Turquoise")) | |
782 (t (set-face-underline-p 'ediff-fine-diff-face-C t)))) | |
783 'ediff-fine-diff-face-C) | |
784 "Face for highlighting the refinement of the selected diff in buffer C.") | |
785 | |
786 (defvar ediff-even-diff-face-A | |
787 (progn | |
788 (make-face 'ediff-even-diff-face-A) | |
789 (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
|
790 (cond ((ediff-color-display-p) |
11042 | 791 (ediff-set-face |
792 'foreground 'ediff-even-diff-face-A "black") | |
793 (ediff-set-face | |
794 'background 'ediff-even-diff-face-A "light grey")) | |
795 (t | |
796 (copy-face 'italic 'ediff-even-diff-face-A)))) | |
797 'ediff-even-diff-face-A) | |
798 "Face used to highlight even-numbered differences in buffer A.") | |
799 | |
800 (defvar ediff-even-diff-face-B | |
801 (progn | |
802 (make-face 'ediff-even-diff-face-B) | |
803 (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
|
804 (cond ((ediff-color-display-p) |
11042 | 805 (ediff-set-face |
806 'foreground 'ediff-even-diff-face-B "White") | |
807 (ediff-set-face | |
808 'background 'ediff-even-diff-face-B "Gray")) | |
809 (t | |
810 (copy-face 'italic 'ediff-even-diff-face-B)))) | |
811 'ediff-even-diff-face-B) | |
812 "Face used to highlight even-numbered differences in buffer B.") | |
813 | |
814 (defvar ediff-even-diff-face-C | |
815 (progn | |
816 (make-face 'ediff-even-diff-face-C) | |
817 (copy-face 'ediff-even-diff-face-A 'ediff-even-diff-face-C) | |
818 'ediff-even-diff-face-C) | |
819 "Face used to highlight even-numbered differences in buffer C.") | |
820 | |
821 (defvar ediff-odd-diff-face-A | |
822 (progn | |
823 (make-face 'ediff-odd-diff-face-A) | |
824 (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
|
825 (cond ((ediff-color-display-p) |
11042 | 826 (ediff-set-face |
827 'foreground 'ediff-odd-diff-face-A "White") | |
828 (ediff-set-face | |
829 'background 'ediff-odd-diff-face-A "Gray")) | |
830 (t | |
831 (copy-face 'italic 'ediff-odd-diff-face-A)))) | |
832 'ediff-odd-diff-face-A) | |
833 "Face used to highlight odd-numbered differences in buffer A.") | |
834 | |
835 (defvar ediff-odd-diff-face-B | |
836 (progn | |
837 (make-face 'ediff-odd-diff-face-B) | |
838 (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
|
839 (cond ((ediff-color-display-p) |
11042 | 840 (ediff-set-face |
841 'foreground 'ediff-odd-diff-face-B "Black") | |
842 (ediff-set-face | |
843 'background 'ediff-odd-diff-face-B "light grey")) | |
844 (t | |
845 (copy-face 'italic 'ediff-odd-diff-face-B)))) | |
846 'ediff-odd-diff-face-B) | |
847 "Face used to highlight odd-numbered differences in buffer B.") | |
848 | |
849 (defvar ediff-odd-diff-face-C | |
850 (progn | |
851 (make-face 'ediff-odd-diff-face-C) | |
852 (copy-face 'ediff-odd-diff-face-A 'ediff-odd-diff-face-C) | |
853 'ediff-odd-diff-face-C) | |
854 "Face used to highlight odd-numbered differences in buffer C.") | |
855 | |
856 ;; Create *-var faces. These are the actual faces used to highlight | |
857 ;; odd-numbered difference regions. | |
858 ;; They are used as follows: when highlighting is turned on, | |
859 ;; ediff-odd/even-diff-face-A/B/C are copied | |
860 ;; into ediff-odd/even-diff-face-A/B/C-var, and all odd/even overlays become | |
861 ;; highlighted. When highlighting is turned off, then the face 'default is | |
862 ;; copied into ediff-odd/even-diff-face-A/B/C-var, thereby unhighlighting all | |
863 ;; difference regions. | |
864 (make-face 'ediff-even-diff-face-A-var) | |
865 (make-face 'ediff-even-diff-face-B-var) | |
866 (make-face 'ediff-even-diff-face-C-var) | |
867 (make-face 'ediff-odd-diff-face-A-var) | |
868 (make-face 'ediff-odd-diff-face-B-var) | |
869 (make-face 'ediff-odd-diff-face-C-var) | |
870 | |
871 ;; initialize *-var faces | |
872 (defun ediff-init-var-faces () | |
873 (copy-face (if (and ediff-use-faces ediff-highlight-all-diffs) | |
874 ediff-even-diff-face-A 'default) | |
875 'ediff-even-diff-face-A-var) | |
876 (copy-face (if (and ediff-use-faces ediff-highlight-all-diffs) | |
877 ediff-even-diff-face-B 'default) | |
878 'ediff-even-diff-face-B-var) | |
879 (copy-face (if (and ediff-use-faces ediff-highlight-all-diffs) | |
880 ediff-even-diff-face-C 'default) | |
881 'ediff-even-diff-face-C-var) | |
882 (copy-face (if (and ediff-use-faces ediff-highlight-all-diffs) | |
883 ediff-odd-diff-face-A 'default) | |
884 'ediff-odd-diff-face-A-var) | |
885 (copy-face (if (and ediff-use-faces ediff-highlight-all-diffs) | |
886 ediff-odd-diff-face-B 'default) | |
887 'ediff-odd-diff-face-B-var) | |
888 (copy-face (if (and ediff-use-faces ediff-highlight-all-diffs) | |
889 ediff-odd-diff-face-C 'default) | |
890 'ediff-odd-diff-face-C-var) | |
891 ) | |
892 | |
893 | |
894 ;;; Overlays | |
895 | |
896 (ediff-defvar-local ediff-current-diff-overlay-A nil | |
897 "Overlay for the current difference region in buffer A.") | |
898 (ediff-defvar-local ediff-current-diff-overlay-B nil | |
899 "Overlay for the current difference region in buffer B.") | |
900 (ediff-defvar-local ediff-current-diff-overlay-C nil | |
901 "Overlay for the current difference region in buffer C.") | |
902 | |
903 (defun ediff-make-current-diff-overlay (type) | |
904 (let ((overlay (intern (format "ediff-current-diff-overlay-%S" type))) | |
905 (buffer (ediff-get-buffer type)) | |
906 (face (face-name | |
907 (symbol-value | |
908 (intern (format "ediff-current-diff-face-%S" type)))))) | |
909 (set overlay | |
910 (ediff-make-bullet-proof-overlay (point-max) (point-max) buffer)) | |
911 (ediff-overlay-put (symbol-value overlay) 'face face) | |
912 (ediff-overlay-put (symbol-value overlay) 'ediff ediff-control-buffer) | |
913 )) | |
914 | |
915 ;; Compute priority of ediff overlay. | |
916 (defun ediff-highest-priority (start end buffer) | |
917 (let ((pos (max 1 (1- start))) | |
918 ovr-list) | |
919 (if ediff-xemacs-p | |
920 (1+ ediff-shadow-overlay-priority) | |
921 (ediff-eval-in-buffer buffer | |
922 (while (< pos (min (point-max) (1+ end))) | |
923 (setq ovr-list (append (overlays-at pos) ovr-list)) | |
924 (setq pos (next-overlay-change pos))) | |
925 (1+ (apply '+ | |
926 (mapcar (function | |
927 (lambda (ovr) | |
928 (if ovr | |
929 (or (ediff-overlay-get ovr 'priority) 0) | |
930 0))) | |
931 ovr-list) | |
932 )) | |
933 )))) | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
934 ) |
11042 | 935 |
936 | |
937 (defvar ediff-toggle-read-only-function nil | |
938 "*Specifies the function to be used to toggle read-only. | |
939 If nil, Ediff tries to deduce the function from the binding of C-x C-q. | |
940 Normally, this is the `toggle-read-only' function, but, if version | |
941 control is used, it could be `vc-toggle-read-only' or `rcs-toggle-read-only'.") | |
942 | |
943 | |
944 ;;; Misc | |
945 | |
946 ;; if nil, this silences some messages | |
947 (defconst ediff-verbose-p t) | |
948 | |
949 (defvar ediff-no-emacs-help-in-control-buffer nil | |
950 "*Non-nil means C-h should not invoke Emacs help in control buffer. | |
951 Instead, C-h jumps to previous difference.") | |
952 | |
953 (defvar ediff-temp-file-prefix | |
954 (let ((env (or (getenv "TMPDIR") | |
955 (getenv "TMP") | |
956 (getenv "TEMP"))) | |
957 d) | |
958 (setq d (if (and env (> (length env) 0)) | |
959 env | |
960 (if (memq system-type '(vax-vms axp-vms)) | |
961 "SYS$SCRATCH:" | |
962 "/tmp"))) | |
963 ;; The following is to make sure we get something to which we can | |
964 ;; add directory levels on VMS. | |
965 (setq d (file-name-as-directory (directory-file-name d))) | |
966 ) | |
967 "*Prefix to put on Ediff temporary file names. | |
968 Do not start with `~/' or `~user-name/'.") | |
969 | |
970 (defvar ediff-temp-file-mode 384 ; u=rw only | |
971 "*Mode for Ediff temporary files.") | |
972 | |
973 ;; Metacharacters that have to be protected from the shell when executing | |
974 ;; a diff/diff3 command. | |
975 (defvar ediff-metachars "[ \t\n!\"#$&'()*;<=>?[\\^`{|~]" | |
976 "Characters that must be quoted with \\ when used in a shell command line. | |
977 More precisely, a regexp to match any one such character.") | |
978 | |
979 | |
980 (ediff-defvar-local ediff-temp-file-A nil | |
981 "Temporary file used for refining difference regions in buffer A.") | |
982 (ediff-defvar-local ediff-temp-file-B nil | |
983 "Temporary file used for refining difference regions in buffer B.") | |
984 (ediff-defvar-local ediff-temp-file-C nil | |
985 "Temporary file used for refining difference regions in buffer C.") | |
986 | |
987 ;;; In-line functions | |
988 | |
989 (defsubst ediff-file-remote-p (file-name) | |
990 (if (fboundp ediff-ange-ftp-ftp-name) | |
991 (funcall ediff-ange-ftp-ftp-name file-name))) | |
992 | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
993 ;;(defun ediff-frame-has-menubar () |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
994 ;; (and (ediff-window-display-p) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
995 ;; (if ediff-xemacs-p |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
996 ;; current-menubar |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
997 ;; (let ((lines (cdr (assq 'menu-bar-lines |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
998 ;; (frame-parameters (selected-frame)))))) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
999 ;; (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
|
1000 ;; ))) |
11042 | 1001 |
1002 (defsubst ediff-frame-unsplittable-p (frame) | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1003 (cdr (assq 'unsplittable (frame-parameters frame)))) |
11042 | 1004 |
1005 (defsubst ediff-get-next-window (wind prev-wind) | |
1006 (or (window-live-p wind) | |
1007 (setq wind (if prev-wind | |
1008 (next-window wind) | |
1009 (selected-window))))) | |
1010 | |
1011 (defsubst ediff-convert-diffs-to-overlays (diff-list) | |
1012 (ediff-set-diff-overlays-in-one-buffer 'A diff-list) | |
1013 (ediff-set-diff-overlays-in-one-buffer 'B diff-list) | |
1014 (if ediff-3way-job | |
1015 (ediff-set-diff-overlays-in-one-buffer 'C diff-list)) | |
1016 (message "Processing difference regions ... done")) | |
1017 | |
1018 | |
1019 (defsubst ediff-kill-buffer-carefully (buf) | |
1020 "Kill buffer BUF if it exists." | |
1021 (if (ediff-buffer-live-p buf) | |
1022 (kill-buffer (get-buffer buf)))) | |
1023 | |
1024 | |
1025 (defsubst ediff-highlight-diff (n) | |
1026 "Put face on diff N. Invoked for X displays only." | |
1027 (ediff-highlight-diff-in-one-buffer n 'A) | |
1028 (ediff-highlight-diff-in-one-buffer n 'B) | |
1029 (ediff-highlight-diff-in-one-buffer n 'C)) | |
1030 | |
1031 | |
1032 (defsubst ediff-unhighlight-diff () | |
1033 "Remove overlays from buffers A, B, and C." | |
1034 (ediff-unhighlight-diff-in-one-buffer 'A) | |
1035 (ediff-unhighlight-diff-in-one-buffer 'B) | |
1036 (ediff-unhighlight-diff-in-one-buffer 'C)) | |
1037 | |
1038 ;; delete highlighting overlays, restore faces to their original form | |
1039 (defsubst ediff-unhighlight-diffs-totally () | |
1040 (ediff-unhighlight-diffs-totally-in-one-buffer 'A) | |
1041 (ediff-unhighlight-diffs-totally-in-one-buffer 'B) | |
1042 (ediff-unhighlight-diffs-totally-in-one-buffer 'C)) | |
1043 | |
1044 | |
1045 ;; arg is a record for a given diff in a difference vector | |
1046 ;; this record is itself a vector | |
1047 (defsubst ediff-clear-fine-diff-vector (diff-record) | |
1048 (if diff-record | |
1049 (mapcar 'ediff-delete-overlay | |
1050 (ediff-get-fine-diff-vector-from-diff-record diff-record)))) | |
1051 | |
1052 (defsubst ediff-clear-fine-differences-in-one-buffer (n buf-type) | |
1053 (ediff-clear-fine-diff-vector (ediff-get-difference n buf-type)) | |
1054 (ediff-set-fine-diff-vector n buf-type nil)) | |
1055 | |
1056 (defsubst ediff-clear-fine-differences (n) | |
1057 (ediff-clear-fine-differences-in-one-buffer n 'A) | |
1058 (ediff-clear-fine-differences-in-one-buffer n 'B) | |
1059 (if ediff-3way-job | |
1060 (ediff-clear-fine-differences-in-one-buffer n 'C))) | |
1061 | |
1062 | |
1063 (defsubst ediff-convert-fine-diffs-to-overlays (diff-list region-num) | |
1064 (ediff-set-fine-overlays-in-one-buffer 'A diff-list region-num) | |
1065 (ediff-set-fine-overlays-in-one-buffer 'B diff-list region-num) | |
1066 (if ediff-3way-job | |
1067 (ediff-set-fine-overlays-in-one-buffer 'C diff-list region-num) | |
1068 )) | |
1069 | |
1070 (defsubst ediff-mouse-event-p (event) | |
1071 (if ediff-xemacs-p | |
1072 (button-event-p event) | |
1073 (string-match "mouse" (format "%S" (event-basic-type event))) | |
1074 )) | |
1075 | |
1076 (defsubst ediff-frame-iconified-p (frame) | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1077 (if (and (ediff-window-display-p) (frame-live-p frame)) |
11042 | 1078 (if ediff-xemacs-p |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1079 (frame-iconified-p frame) |
11042 | 1080 (eq (frame-visible-p frame) 'icon)))) |
1081 | |
1082 (defsubst ediff-window-visible-p (wind) | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1083 ;; under TTY, window-live-p also means window is visible |
11042 | 1084 (and (window-live-p wind) |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1085 (or (not (ediff-window-display-p)) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1086 (frame-visible-p (window-frame wind))))) |
11042 | 1087 |
1088 | |
1089 (defsubst ediff-frame-char-width (frame) | |
1090 (if ediff-xemacs-p | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1091 (/ (frame-pixel-width frame) (frame-width frame)) |
11042 | 1092 (frame-char-width frame))) |
1093 | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1094 (defsubst ediff-reset-mouse (&optional frame) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1095 (setq frame |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1096 (if ediff-xemacs-p |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1097 (frame-selected-window (or frame (selected-frame))) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1098 (or frame (selected-frame)))) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1099 (if (ediff-window-display-p) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1100 (set-mouse-position frame 1 0))) |
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1101 |
11042 | 1102 (defsubst ediff-frame-char-height (frame) |
1103 (if ediff-xemacs-p | |
12085
589a32fa67a9
Converted xemacs *screen* nomenclature to *frame*.
Karl Heuer <kwzh@gnu.org>
parents:
11234
diff
changeset
|
1104 (/ (frame-pixel-height frame) (frame-height frame)) |
11042 | 1105 (frame-char-height frame))) |
1106 | |
1107 | |
1108 (defsubst ediff-empty-overlay-p (overl) | |
1109 (= (ediff-overlay-start overl) (ediff-overlay-end overl))) | |
1110 | |
1111 ;; t if diff region is empty. | |
1112 ;; In case of buffer C, t also if it is not a 3way | |
1113 ;; comparison job (merging jobs return t as well). | |
1114 (defun ediff-empty-diff-region-p (n buf-type) | |
1115 (if (eq buf-type 'C) | |
1116 (or (not ediff-3way-comparison-job) | |
1117 (= (ediff-get-diff-posn 'C 'beg n) | |
1118 (ediff-get-diff-posn 'C 'end n))) | |
1119 (= (ediff-get-diff-posn buf-type 'beg n) | |
1120 (ediff-get-diff-posn buf-type 'end n)))) | |
1121 | |
1122 ;; Test if diff region is white space only. | |
1123 ;; If 2-way job and buf-type = C, then returns t. | |
1124 (defun ediff-whitespace-diff-region-p (n buf-type) | |
1125 (or (and (eq buf-type 'C) (not ediff-3way-job)) | |
1126 (let ((beg (ediff-get-diff-posn buf-type 'beg n)) | |
1127 (end (ediff-get-diff-posn buf-type 'end n))) | |
1128 (ediff-eval-in-buffer (ediff-get-buffer buf-type) | |
1129 (save-excursion | |
1130 (goto-char beg) | |
1131 (skip-chars-forward ediff-whitespace) | |
1132 (>= (point) end)))))) | |
1133 | |
1134 ;; temporarily uses DIR to abbreviate file name | |
1135 ;; if DIR is nil, use default-directory | |
1136 (defsubst ediff-abbreviate-filename (file dir) | |
1137 (let* ((dir (or dir default-directory)) | |
1138 (directory-abbrev-alist (list (cons dir "")))) | |
1139 (abbreviate-file-name file))) | |
1140 | |
1141 (defsubst ediff-get-region-contents (n buf-type ctrl-buf &optional start end) | |
1142 (ediff-eval-in-buffer | |
1143 (ediff-eval-in-buffer ctrl-buf (ediff-get-buffer buf-type)) | |
1144 (buffer-substring | |
1145 (or start (ediff-get-diff-posn buf-type 'beg n ctrl-buf)) | |
1146 (or end (ediff-get-diff-posn buf-type 'end n ctrl-buf))))) | |
1147 | |
1148 ;; If ediff modified mode line, strip the modification | |
1149 (defsubst ediff-strip-mode-line-format () | |
1150 (if (member (car mode-line-format) '(" A: " " B: " " C: ")) | |
1151 (setq mode-line-format (nth 2 mode-line-format)))) | |
1152 | |
1153 ;; Verify that we have a difference selected. | |
1154 (defsubst ediff-valid-difference-p (&optional n) | |
1155 (or n (setq n ediff-current-difference)) | |
1156 (and (>= n 0) (< n ediff-number-of-differences))) | |
1157 | |
1158 (defsubst ediff-show-all-diffs (n) | |
1159 "Don't skip difference regions." | |
1160 nil) | |
1161 | |
1162 (provide 'ediff-init) | |
1163 | |
1164 | |
1165 ;;; ediff-init.el ends here |