]> code.delx.au - gnu-emacs/blob - lisp/ediff-init.el
(time-stamp-old-format-warn): Fix a tag string.
[gnu-emacs] / lisp / ediff-init.el
1 ;;; ediff-init.el --- Macros, variables, and defsubsts used by Ediff
2
3 ;; Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
4
5 ;; Author: Michael Kifer <kifer@cs.sunysb.edu>
6
7 ;; This file is part of GNU Emacs.
8
9 ;; GNU Emacs is free software; you can redistribute it and/or modify
10 ;; it under the terms of the GNU General Public License as published by
11 ;; the Free Software Foundation; either version 2, or (at your option)
12 ;; any later version.
13
14 ;; GNU Emacs is distributed in the hope that it will be useful,
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;; GNU General Public License for more details.
18
19 ;; You should have received a copy of the GNU General Public License
20 ;; along with GNU Emacs; see the file COPYING. If not, write to the
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 ;; Boston, MA 02111-1307, USA.
23
24 ;;; Code:
25
26 ;; Start compiler pacifier
27 (defvar ediff-metajob-name)
28 (defvar ediff-meta-buffer)
29 (defvar pm-color-alist)
30 (defvar ediff-grab-mouse)
31 (defvar ediff-mouse-pixel-position)
32 (defvar ediff-mouse-pixel-threshold)
33 (defvar ediff-whitespace)
34 (defvar ediff-multiframe)
35 ;; end pacifier
36
37 ;; Is it XEmacs?
38 (defconst ediff-xemacs-p (string-match "XEmacs" emacs-version))
39 ;; Is it Emacs?
40 (defconst ediff-emacs-p (not ediff-xemacs-p))
41
42 (defvar ediff-force-faces nil
43 "If t, Ediff will think that it is running on a display that supports faces.
44 This is provided as a temporary relief for users of face-capable displays
45 that Ediff doesn't know about.")
46
47 ;; Are we running as a window application or on a TTY?
48 (defsubst ediff-device-type ()
49 (if ediff-emacs-p
50 window-system
51 (device-type (selected-device))))
52
53 ;; in XEmacs: device-type is tty on tty and stream in batch.
54 (defun ediff-window-display-p ()
55 (and (ediff-device-type) (not (memq (ediff-device-type) '(tty pc stream)))))
56
57 ;; test if supports faces
58 ;; ediff-force-faces is for those devices that support faces, but we don't know
59 ;; this yet
60 (defun ediff-has-face-support-p ()
61 (cond ((ediff-window-display-p))
62 (ediff-force-faces)
63 (ediff-emacs-p (memq (ediff-device-type) '(pc)))
64 (ediff-xemacs-p (memq (ediff-device-type) '(tty pc)))))
65
66
67 ;; Defines SYMBOL as an advertised local variable.
68 ;; Performs a defvar, then executes `make-variable-buffer-local' on
69 ;; the variable. Also sets the `permanent-local' property,
70 ;; so that `kill-all-local-variables' (called by major-mode setting
71 ;; commands) won't destroy Ediff control variables.
72 ;;
73 ;; Plagiarised from `emerge-defvar-local' for XEmacs.
74 (defmacro ediff-defvar-local (var value doc)
75 (` (progn
76 (defvar (, var) (, value) (, doc))
77 (make-variable-buffer-local '(, var))
78 (put '(, var) 'permanent-local t))))
79
80
81
82 ;; Variables that control each Ediff session---local to the control buffer.
83
84 ;; Mode variables
85 ;; The buffer in which the A variant is stored.
86 (ediff-defvar-local ediff-buffer-A nil "")
87 ;; The buffer in which the B variant is stored.
88 (ediff-defvar-local ediff-buffer-B nil "")
89 ;; The buffer in which the C variant is stored.
90 (ediff-defvar-local ediff-buffer-C nil "")
91 ;; Ancestor buffer
92 (ediff-defvar-local ediff-ancestor-buffer nil "")
93 ;; The control buffer of ediff.
94 (ediff-defvar-local ediff-control-buffer nil "")
95
96 ;;; Macros
97 (defmacro ediff-odd-p (arg)
98 (` (eq (logand (, arg) 1) 1)))
99
100 (defmacro ediff-buffer-live-p (buf)
101 (` (and (, buf) (get-buffer (, buf)) (buffer-name (get-buffer (, buf))))))
102
103 (defmacro ediff-get-buffer (arg)
104 (` (cond ((eq (, arg) 'A) ediff-buffer-A)
105 ((eq (, arg) 'B) ediff-buffer-B)
106 ((eq (, arg) 'C) ediff-buffer-C)
107 ((eq (, arg) 'Ancestor) ediff-ancestor-buffer)
108 )
109 ))
110
111 (defmacro ediff-get-value-according-to-buffer-type (buf-type list)
112 (` (cond ((eq (, buf-type) 'A) (nth 0 (, list)))
113 ((eq (, buf-type) 'B) (nth 1 (, list)))
114 ((eq (, buf-type) 'C) (nth 2 (, list))))))
115
116 (defmacro ediff-char-to-buftype (arg)
117 (` (cond ((memq (, arg) '(?a ?A)) 'A)
118 ((memq (, arg) '(?b ?B)) 'B)
119 ((memq (, arg) '(?c ?C)) 'C)
120 )
121 ))
122
123 (defmacro ediff-get-difference (n buf-type)
124 (` (aref
125 (symbol-value
126 (intern (format "ediff-difference-vector-%S" (, buf-type)))) (, n))))
127
128 ;; tell if it has been previously determined that the region has
129 ;; no diffs other than the white space and newlines
130 ;; The argument, N, is the diff region number used by Ediff to index the
131 ;; diff vector. It is 1 less than the number seen by the user.
132 ;;
133 ;; A difference vector has the form:
134 ;; [diff diff diff ...]
135 ;; where each diff has the form:
136 ;; [overlay fine-diff-vector no-fine-diffs-flag]
137 ;; fine-diff-vector is a vector [fine-diff fine-diff fine-diff ...]
138 (defmacro ediff-no-fine-diffs-p (n)
139 (` (aref (ediff-get-difference (, n) 'A) 2)))
140
141 (defmacro ediff-get-diff-overlay-from-diff-record (diff-rec)
142 (` (aref (, diff-rec) 0)))
143
144 (defmacro ediff-get-diff-overlay (n buf-type)
145 (` (ediff-get-diff-overlay-from-diff-record
146 (ediff-get-difference (, n) (, buf-type)))))
147
148 (defmacro ediff-get-fine-diff-vector-from-diff-record (diff-rec)
149 (` (aref (, diff-rec) 1)))
150
151 (defmacro ediff-set-fine-diff-vector (n buf-type fine-vec)
152 (` (aset (ediff-get-difference (, n) (, buf-type)) 1 (, fine-vec))))
153
154 (defmacro ediff-get-state-of-diff (n buf-type)
155 (` (if (ediff-buffer-live-p ediff-buffer-C)
156 (aref (ediff-get-difference (, n) (, buf-type)) 3))))
157 (defmacro ediff-set-state-of-diff (n buf-type val)
158 (` (aset (ediff-get-difference (, n) (, buf-type)) 3 (, val))))
159 (defmacro ediff-get-state-of-merge (n)
160 (` (if ediff-state-of-merge
161 (aref (aref ediff-state-of-merge (, n)) 0))))
162 (defmacro ediff-get-state-of-ancestor (n)
163 (` (if ediff-state-of-merge
164 (aref (aref ediff-state-of-merge (, n)) 1))))
165 (defmacro ediff-set-state-of-merge (n val)
166 (` (if ediff-state-of-merge
167 (aset (aref ediff-state-of-merge (, n)) 0 (, val)))))
168
169 ;; if flag is t, puts a mark on diff region saying that
170 ;; the differences are in white space only. If flag is nil,
171 ;; the region is marked as essential (i.e., differences are
172 ;; not just in the white space and newlines.)
173 (defmacro ediff-mark-diff-as-space-only (n flag)
174 (` (aset (ediff-get-difference (, n) 'A) 2 (, flag))))
175
176 (defmacro ediff-get-fine-diff-vector (n buf-type)
177 (` (ediff-get-fine-diff-vector-from-diff-record
178 (ediff-get-difference (, n) (, buf-type)))))
179
180 ;; Macro to switch to BUFFER, evaluate FORMS, returns to original buffer.
181 ;; Differs from `save-excursion' in that it doesn't save the point and mark.
182 ;; This is essentially `emerge-eval-in-buffer' with the test for live buffers."
183 (defmacro ediff-eval-in-buffer (buffer &rest forms)
184 (` (let ((StartBuffer (current-buffer)))
185 (if (ediff-buffer-live-p (, buffer))
186 (unwind-protect
187 (progn
188 (set-buffer (, buffer))
189 (,@ forms))
190 (set-buffer StartBuffer))
191 (or (eq this-command 'ediff-quit)
192 (error ediff-KILLED-VITAL-BUFFER))
193 ))))
194
195
196 (defsubst ediff-multiframe-setup-p ()
197 (and (ediff-window-display-p) ediff-multiframe))
198
199 (defmacro ediff-narrow-control-frame-p ()
200 (` (and (ediff-multiframe-setup-p)
201 (equal ediff-help-message ediff-brief-message-string))))
202
203 (defmacro ediff-3way-comparison-job ()
204 (` (memq
205 ediff-job-name
206 '(ediff-files3 ediff-buffers3))))
207 (ediff-defvar-local ediff-3way-comparison-job nil "")
208
209 (defmacro ediff-merge-job ()
210 (` (memq
211 ediff-job-name
212 '(ediff-merge-files
213 ediff-merge-buffers
214 ediff-merge-files-with-ancestor
215 ediff-merge-buffers-with-ancestor
216 ediff-merge-revisions
217 ediff-merge-revisions-with-ancestor))))
218 (ediff-defvar-local ediff-merge-job nil "")
219
220 (defmacro ediff-merge-with-ancestor-job ()
221 (` (memq
222 ediff-job-name
223 '(ediff-merge-files-with-ancestor
224 ediff-merge-buffers-with-ancestor
225 ediff-merge-revisions-with-ancestor))))
226 (ediff-defvar-local ediff-merge-with-ancestor-job nil "")
227
228 (defmacro ediff-3way-job ()
229 (` (or ediff-3way-comparison-job ediff-merge-job)))
230 (ediff-defvar-local ediff-3way-job nil "")
231
232 ;; A diff3 job is like a 3way job, but ediff-merge doesn't require the use
233 ;; of diff3.
234 (defmacro ediff-diff3-job ()
235 (` (or ediff-3way-comparison-job
236 ediff-merge-with-ancestor-job)))
237 (ediff-defvar-local ediff-diff3-job nil "")
238
239 (defmacro ediff-windows-job ()
240 (` (memq ediff-job-name '(ediff-windows-wordwise ediff-windows-linewise))))
241 (ediff-defvar-local ediff-windows-job nil "")
242
243 (defmacro ediff-word-mode-job ()
244 (` (memq ediff-job-name '(ediff-windows-wordwise ediff-regions-wordwise))))
245 (ediff-defvar-local ediff-word-mode-job nil "")
246
247 (defmacro ediff-narrow-job ()
248 (` (memq ediff-job-name '(ediff-windows-wordwise
249 ediff-regions-wordwise
250 ediff-windows-linewise
251 ediff-regions-linewise))))
252 (ediff-defvar-local ediff-narrow-job nil "")
253
254 ;; Note: ediff-merge-directory-revisions-with-ancestor is not treated as an
255 ;; ancestor metajob, since it behaves differently.
256 (defsubst ediff-ancestor-metajob (&optional metajob)
257 (memq (or metajob ediff-metajob-name)
258 '(ediff-merge-directories-with-ancestor
259 ediff-merge-filegroups-with-ancestor)))
260 (defsubst ediff-revision-metajob (&optional metajob)
261 (memq (or metajob ediff-metajob-name)
262 '(ediff-directory-revisions
263 ediff-merge-directory-revisions
264 ediff-merge-directory-revisions-with-ancestor)))
265 (defsubst ediff-patch-metajob (&optional metajob)
266 (memq (or metajob ediff-metajob-name)
267 '(ediff-multifile-patch)))
268 ;; metajob involving only one group of files, such as multipatch or directory
269 ;; revision
270 (defsubst ediff-one-filegroup-metajob (&optional metajob)
271 (or (ediff-revision-metajob metajob)
272 (ediff-patch-metajob metajob)
273 ;; add more here
274 ))
275 (defsubst ediff-collect-diffs-metajob (&optional metajob)
276 (memq (or metajob ediff-metajob-name)
277 '(ediff-directories
278 ediff-directory-revisions
279 ediff-merge-directories
280 ediff-merge-directories-with-ancestor
281 ediff-merge-directory-revisions
282 ediff-merge-directory-revisions-with-ancestor
283 ;; add more here
284 )))
285 (defsubst ediff-merge-metajob (&optional metajob)
286 (memq (or metajob ediff-metajob-name)
287 '(ediff-merge-directories
288 ediff-merge-directories-with-ancestor
289 ediff-merge-directory-revisions
290 ediff-merge-directory-revisions-with-ancestor
291 ediff-merge-filegroups-with-ancestor
292 ;; add more here
293 )))
294
295 (defsubst ediff-metajob3 (&optional metajob)
296 (memq (or metajob ediff-metajob-name)
297 '(ediff-merge-directories-with-ancestor
298 ediff-merge-filegroups-with-ancestor
299 ediff-directories3
300 ediff-filegroups3)))
301 (defsubst ediff-comparison-metajob3 (&optional metajob)
302 (memq (or metajob ediff-metajob-name)
303 '(ediff-directories3 ediff-filegroups3)))
304
305 ;; with no argument, checks if we are in ediff-control-buffer
306 ;; with argument, checks if we are in ediff-meta-buffer
307 (defun ediff-in-control-buffer-p (&optional meta-buf-p)
308 (and (boundp 'ediff-control-buffer)
309 (eq (if meta-buf-p ediff-meta-buffer ediff-control-buffer)
310 (current-buffer))))
311
312 (defsubst ediff-barf-if-not-control-buffer (&optional meta-buf-p)
313 (or (ediff-in-control-buffer-p meta-buf-p)
314 (error "%S: This command runs in Ediff Control Buffer only!"
315 this-command)))
316
317 ;; Hook variables
318
319 (defvar ediff-before-setup-windows-hook nil
320 "*Hooks to run before Ediff sets its window configuration.
321 This can be used to save the previous window config, which can be restored
322 on ediff-quit or ediff-suspend.")
323 (defvar ediff-after-setup-windows-hook nil
324 "*Hooks to run after Ediff sets its window configuration.
325 This can be used to set up control window or icon in a desired place.")
326 (defvar ediff-before-setup-control-frame-hook nil
327 "*Hooks run before setting up the frame to display Ediff Control Panel.
328 Can be used to change control frame parameters to position it where it
329 is desirable.")
330 (defvar ediff-after-setup-control-frame-hook nil
331 "*Hooks run after setting up the frame to display Ediff Control Panel.
332 Can be used to move the frame where it is desired.")
333 (defvar ediff-startup-hook nil
334 "*Hooks to run in the control buffer after Ediff has been set up.")
335 (defvar ediff-select-hook nil
336 "*Hooks to run after a difference has been selected.")
337 (defvar ediff-unselect-hook nil
338 "*Hooks to run after a difference has been unselected.")
339 (defvar ediff-prepare-buffer-hook nil
340 "*Hooks called after buffers A, B, and C are set up.")
341 (defvar ediff-load-hook nil
342 "*Hook run after Ediff is loaded. Can be used to change defaults.")
343
344 (defvar ediff-mode-hook nil
345 "*Hook run just after ediff-mode is set up in the control buffer.
346 This is done before any windows or frames are created. One can use it to
347 set local variables that determine how the display looks like.")
348 (defvar ediff-keymap-setup-hook nil
349 "*Hook run just after the default bindings in Ediff keymap are set up.")
350
351 (defvar ediff-display-help-hook nil
352 "*Hooks run after preparing the help message.")
353
354 (defvar ediff-suspend-hook (list 'ediff-default-suspend-function)
355 "*Hooks to run in the Ediff control buffer when Ediff is suspended.")
356 (defvar ediff-quit-hook (list 'ediff-cleanup-mess)
357 "*Hooks to run in the Ediff control buffer after finishing Ediff.")
358 (defvar ediff-cleanup-hook nil
359 "*Hooks to run on exiting Ediff but before killing the control buffer.
360 This is a place to do various cleanups, such as deleting the variant buffers.
361 Ediff provides a function, `ediff-janitor', as one such possible hook.")
362 (defvar ediff-quit-merge-hook 'ediff-maybe-save-and-delete-merge
363 "*Hooks to run before quitting a merge job.
364 The most common use is to save and delete the merge buffer.")
365
366
367 ;; Error messages
368 (defconst ediff-KILLED-VITAL-BUFFER
369 "You have killed a vital Ediff buffer---you must leave Ediff now!")
370 (defconst ediff-NO-DIFFERENCES
371 "Sorry, comparison of identical variants is not what I am made for...")
372 (defconst ediff-BAD-DIFF-NUMBER
373 ;; %S stands for this-command, %d - diff number, %d - max diff
374 "%S: Bad diff region number, %d. Valid numbers are 1 to %d")
375 (defconst ediff-BAD-INFO (format "
376 *** The Info file for Ediff, a part of the standard distribution
377 *** of %sEmacs, does not seem to be properly installed.
378 ***
379 *** Please contact your system administrator. "
380 (if ediff-xemacs-p "X" "")))
381
382 ;; Selective browsing
383
384 (ediff-defvar-local ediff-skip-diff-region-function 'ediff-show-all-diffs
385 "Function that determines the next/previous diff region to show.
386 Should return t for regions to be ignored and nil otherwise.
387 This function gets a region number as an argument. The region number
388 is the one used internally by Ediff. It is 1 less than the number seen
389 by the user.")
390
391 (ediff-defvar-local ediff-hide-regexp-matches-function
392 'ediff-hide-regexp-matches
393 "Function to use in determining which regions to hide.
394 See the documentation string of `ediff-hide-regexp-matches' for details.")
395 (ediff-defvar-local ediff-focus-on-regexp-matches-function
396 'ediff-focus-on-regexp-matches
397 "Function to use in determining which regions to focus on.
398 See the documentation string of `ediff-focus-on-regexp-matches' for details.")
399
400 ;; Regexp that determines buf A regions to focus on when skipping to diff
401 (ediff-defvar-local ediff-regexp-focus-A "" "")
402 ;; Regexp that determines buf B regions to focus on when skipping to diff
403 (ediff-defvar-local ediff-regexp-focus-B "" "")
404 ;; Regexp that determines buf C regions to focus on when skipping to diff
405 (ediff-defvar-local ediff-regexp-focus-C "" "")
406 ;; connective that determines whether to focus regions that match both or
407 ;; one of the regexps
408 (ediff-defvar-local ediff-focus-regexp-connective 'and "")
409
410 ;; Regexp that determines buf A regions to ignore when skipping to diff
411 (ediff-defvar-local ediff-regexp-hide-A "" "")
412 ;; Regexp that determines buf B regions to ignore when skipping to diff
413 (ediff-defvar-local ediff-regexp-hide-B "" "")
414 ;; Regexp that determines buf C regions to ignore when skipping to diff
415 (ediff-defvar-local ediff-regexp-hide-C "" "")
416 ;; connective that determines whether to hide regions that match both or
417 ;; one of the regexps
418 (ediff-defvar-local ediff-hide-regexp-connective 'and "")
419
420
421 ;; Copying difference regions between buffers.
422 (ediff-defvar-local ediff-killed-diffs-alist nil
423 "A list of killed diffs.
424 A diff is saved here if it is replaced by a diff
425 from another buffer. This alist has the form:
426 \((num (buff-object . diff) (buff-object . diff) (buff-object . diff)) ...),
427 where some buffer-objects may be missing.")
428
429
430 ;; Highlighting
431 ;;(defvar ediff-before-flag-bol (if ediff-emacs-p "->>\n" (make-glyph "->>\n"))
432 (defvar ediff-before-flag-bol (if ediff-xemacs-p (make-glyph "->>") "->>")
433 "*Flag placed above the highlighted block of differences.
434 Must end with newline.")
435 ;;(defvar ediff-after-flag-eol (if ediff-emacs-p "<<-\n" (make-glyph "<<-"))
436 (defvar ediff-after-flag-eol (if ediff-xemacs-p (make-glyph "<<-") "<<-")
437 "*Flag placed below the highlighted block of differences.
438 Must end with newline.")
439
440 (defvar ediff-before-flag-mol (if ediff-xemacs-p (make-glyph "->>") "->>")
441 "*Like ediff-before-flag, used when a difference starts in mid-line.")
442 (defvar ediff-after-flag-mol (if ediff-xemacs-p (make-glyph "<<-") "<<-")
443 "*Like ediff-after-flag, used when a difference starts in mid-line.")
444
445
446 (ediff-defvar-local ediff-use-faces t
447 "If t, differences are highlighted using faces, if device supports faces.
448 If nil, differences are highlighted using ASCII flags, ediff-before-flag
449 and ediff-after-flag. On a non-window system, differences are always
450 highlighted using ASCII flags.
451 This variable can be set either in .emacs or toggled interactively.
452 Use `setq-default' if setting it in .emacs")
453
454 ;; this indicates that diff regions are word-size, so fine diffs are
455 ;; permanently nixed; used in ediff-windows-wordwise and ediff-regions-wordwise
456 (ediff-defvar-local ediff-word-mode nil "")
457 ;; Name of the job (ediff-files, ediff-windows, etc.)
458 (ediff-defvar-local ediff-job-name nil "")
459
460 ;; Narrowing and ediff-region/windows support
461 ;; This is a list (overlay-A overlay-B overlay-C)
462 ;; If set, Ediff compares only those parts of buffers A/B/C that lie within
463 ;; the bounds of these overlays.
464 (ediff-defvar-local ediff-narrow-bounds nil "")
465
466 ;; List (overlay-A overlay-B overlay-C), where each overlay spans the
467 ;; entire corresponding buffer.
468 (ediff-defvar-local ediff-wide-bounds nil "")
469
470 ;; Current visibility boundaries in buffers A, B, and C.
471 ;; This is also a list of overlays. When the user toggles narrow/widen,
472 ;; this list changes from ediff-wide-bounds to ediff-narrow-bounds.
473 ;; and back.
474 (ediff-defvar-local ediff-visible-bounds nil "")
475
476 (ediff-defvar-local ediff-start-narrowed t
477 "Non-nil means start narrowed, if doing ediff-windows-* or ediff-regions-*")
478 (ediff-defvar-local ediff-quit-widened t
479 "*Non-nil means: when finished, Ediff widens buffers A/B.
480 Actually, Ediff restores the scope of visibility that existed at startup.")
481 (defvar ediff-keep-variants t
482 "*Nil means that non-modified variant buffers should be removed after some
483 interrogation.
484 Supplying a prefix argument to the quit command `q' temporarily reverses the
485 meaning of this variable.")
486
487 (ediff-defvar-local ediff-highlight-all-diffs t
488 "If nil, only the selected differences are highlighted.
489 This variable can be set either in .emacs or toggled interactively, using
490 ediff-toggle-hilit. Use `setq-default' to set it.")
491
492 ;; A var local to each control panel buffer. Indicates highlighting style
493 ;; in effect for this buffer: `face', `ascii', nil -- temporarily
494 ;; unhighlighted, `off' -- turned off \(on a dumb terminal only\).
495 (ediff-defvar-local ediff-highlighting-style nil "")
496
497
498 ;; The suffix of the control buffer name.
499 (ediff-defvar-local ediff-control-buffer-suffix nil "")
500 ;; Same as ediff-control-buffer-suffix, but without <,>.
501 ;; It's a number rather than string.
502 (ediff-defvar-local ediff-control-buffer-number nil "")
503
504
505 ;; The original values of ediff-protected-variables for buffer A
506 (ediff-defvar-local ediff-buffer-values-orig-A nil "")
507 ;; The original values of ediff-protected-variables for buffer B
508 (ediff-defvar-local ediff-buffer-values-orig-B nil "")
509 ;; The original values of ediff-protected-variables for buffer C
510 (ediff-defvar-local ediff-buffer-values-orig-C nil "")
511 ;; The original values of ediff-protected-variables for buffer Ancestor
512 (ediff-defvar-local ediff-buffer-values-orig-Ancestor nil "")
513 ;; Buffer-local variables to be saved then restored during Ediff sessions
514 ;; Buffer-local variables to be saved then restored during Ediff sessions
515 (defconst ediff-protected-variables '(
516 ;;buffer-read-only
517 mode-line-format))
518
519 ;; Vector of differences between the variants. Each difference is
520 ;; represented by a vector of two overlays plus a vector of fine diffs,
521 ;; plus a no-fine-diffs flag. The first overlay spans the
522 ;; difference region in the A buffer and the second overlays the diff in
523 ;; the B buffer. If a difference section is empty, the corresponding
524 ;; overlay's endpoints coincide.
525 ;;
526 ;; The precise form of a difference vector for one buffer is:
527 ;; [diff diff diff ...]
528 ;; where each diff has the form:
529 ;; [diff-overlay fine-diff-vector no-fine-diffs-flag state-of-difference]
530 ;; fine-diff-vector is a vector [fine-diff-overlay fine-diff-overlay ...]
531 ;; no-fine-diffs-flag says if there are fine differences.
532 ;; state-of-difference is A, B, C, or nil, indicating which buffer is
533 ;; different from the other two (used only in 3-way jobs.
534 (ediff-defvar-local ediff-difference-vector-A nil "")
535 (ediff-defvar-local ediff-difference-vector-B nil "")
536 (ediff-defvar-local ediff-difference-vector-C nil "")
537 (ediff-defvar-local ediff-difference-vector-Ancestor nil "")
538
539 ;; [ status status status ...]
540 ;; Each status: [state-of-merge state-of-ancestor]
541 ;; state-of-merge is default-A, default-B, prefer-A, or prefer-B. It
542 ;; indicates the way a diff region was created in buffer C.
543 ;; state-of-ancestor says if the corresponding region in ancestor buffer is
544 ;; empty.
545 (ediff-defvar-local ediff-state-of-merge nil "")
546
547 ;; The difference that is currently selected.
548 (ediff-defvar-local ediff-current-difference -1 "")
549 ;; Number of differences found.
550 (ediff-defvar-local ediff-number-of-differences nil "")
551
552 ;; Buffer containing the output of diff, which is used by Ediff to step
553 ;; through files.
554 (ediff-defvar-local ediff-diff-buffer nil "")
555 ;; Like ediff-diff-buffer, but contains context diff. It is not used by
556 ;; Ediff, but it is saved in a file, if user requests so.
557 (ediff-defvar-local ediff-custom-diff-buffer nil "")
558 ;; Buffer used for diff-style fine differences between regions.
559 (ediff-defvar-local ediff-fine-diff-buffer nil "")
560 ;; Temporary buffer used for computing fine differences.
561 (defconst ediff-tmp-buffer " *ediff-tmp*" "")
562 ;; Buffer used for messages
563 (defconst ediff-msg-buffer " *ediff-message*" "")
564 ;; Buffer containing the output of diff when diff returns errors.
565 (ediff-defvar-local ediff-error-buffer nil "")
566 ;; Buffer to display debug info
567 (ediff-defvar-local ediff-debug-buffer "*ediff-debug*" "")
568
569 ;; List of ediff control panels associated with each buffer A/B/C/Ancestor.
570 ;; Not used any more, but may be needed in the future.
571 (ediff-defvar-local ediff-this-buffer-ediff-sessions nil "")
572
573 ;; to be deleted in due time
574 ;; List of difference overlays disturbed by working with the current diff.
575 (defvar ediff-disturbed-overlays nil "")
576
577 ;; Priority of non-selected overlays.
578 (defvar ediff-shadow-overlay-priority 100 "")
579
580 (defvar ediff-version-control-package 'vc
581 "Version control package used.
582 Currently, Ediff supports vc.el, rcs.el, pcl-cvs.el, and generic-sc.el. The
583 standard Emacs interface to RCS, CVS, SCCS, etc., is vc.el. However, some
584 people find the other two packages more convenient. Set this variable to the
585 appropriate symbol: `rcs', `pcl-cvs', or `generic-sc' if you so desire.")
586
587
588 (if ediff-xemacs-p
589 (progn
590 (fset 'ediff-read-event (symbol-function 'next-command-event))
591 (fset 'ediff-overlayp (symbol-function 'extentp))
592 (fset 'ediff-make-overlay (symbol-function 'make-extent))
593 (fset 'ediff-delete-overlay (symbol-function 'delete-extent)))
594 (fset 'ediff-read-event (symbol-function 'read-event))
595 (fset 'ediff-overlayp (symbol-function 'overlayp))
596 (fset 'ediff-make-overlay (symbol-function 'make-overlay))
597 (fset 'ediff-delete-overlay (symbol-function 'delete-overlay)))
598
599 ;; Check the current version against the major and minor version numbers
600 ;; using op: cur-vers op major.minor If emacs-major-version or
601 ;; emacs-minor-version are not defined, we assume that the current version
602 ;; is hopelessly outdated. We assume that emacs-major-version and
603 ;; emacs-minor-version are defined. Otherwise, for Emacs/XEmacs 19, if the
604 ;; current minor version is < 10 (xemacs) or < 23 (emacs) the return value
605 ;; will be nil (when op is =, >, or >=) and t (when op is <, <=), which may be
606 ;; incorrect. However, this gives correct result in our cases, since we are
607 ;; testing for sufficiently high Emacs versions.
608 (defun ediff-check-version (op major minor &optional type-of-emacs)
609 (if (and (boundp 'emacs-major-version) (boundp 'emacs-minor-version))
610 (and (cond ((eq type-of-emacs 'xemacs) ediff-xemacs-p)
611 ((eq type-of-emacs 'emacs) ediff-emacs-p)
612 (t t))
613 (cond ((eq op '=) (and (= emacs-minor-version minor)
614 (= emacs-major-version major)))
615 ((memq op '(> >= < <=))
616 (and (or (funcall op emacs-major-version major)
617 (= emacs-major-version major))
618 (if (= emacs-major-version major)
619 (funcall op emacs-minor-version minor)
620 t)))
621 (t
622 (error "%S: Invalid op in ediff-check-version" op))))
623 (cond ((memq op '(= > >=)) nil)
624 ((memq op '(< <=)) t))))
625
626
627 ;;;; warn if it is a wrong version of emacs
628 ;;(if (or (ediff-check-version '< 19 29 'emacs)
629 ;; (ediff-check-version '< 19 12 'xemacs))
630 ;; (progn
631 ;; (with-output-to-temp-buffer ediff-msg-buffer
632 ;; (switch-to-buffer ediff-msg-buffer)
633 ;; (insert
634 ;; (format "
635 ;;
636 ;;This version of Ediff requires
637 ;;
638 ;;\t Emacs 19.29 and higher
639 ;;\t OR
640 ;;\t XEmacs 19.12 and higher
641 ;;
642 ;;It is unlikely to work under Emacs version %s
643 ;;that you are using... " emacs-version))
644 ;; (if noninteractive
645 ;; ()
646 ;; (beep 1)
647 ;; (beep 1)
648 ;; (insert "\n\nType any key to continue...")
649 ;; (ediff-read-event)))
650 ;; (kill-buffer ediff-msg-buffer)))
651
652 ;; A fix for NeXT Step
653 ;; Should probably be eliminated in later versions.
654 (if (and (ediff-window-display-p) (eq (ediff-device-type) 'ns))
655 (progn
656 (fset 'x-display-color-p (symbol-function 'ns-display-color-p))
657 (fset 'x-color-defined-p (symbol-function 'ns-color-defined-p))
658 (fset 'x-display-pixel-height (symbol-function 'ns-display-pixel-height))
659 (fset 'x-display-pixel-width (symbol-function 'ns-display-pixel-width))
660 ))
661
662
663 (defsubst ediff-color-display-p ()
664 (if ediff-emacs-p
665 (x-display-color-p)
666 (eq (device-class (selected-device)) 'color)))
667
668
669 (if (ediff-has-face-support-p)
670 (if ediff-xemacs-p
671 (progn
672 (fset 'ediff-valid-color-p (symbol-function 'valid-color-name-p))
673 (fset 'ediff-get-face (symbol-function 'get-face)))
674 ;; Temporary fix for OS/2 port of Emacs
675 ;; pm-win.el in PM-Emacs should be fixed.
676 (if (eq (ediff-device-type) 'pm)
677 (fset 'ediff-valid-color-p
678 (function (lambda (color) (assoc color pm-color-alist))))
679 (fset 'ediff-valid-color-p (symbol-function 'x-color-defined-p)))
680 (fset 'ediff-get-face (symbol-function 'internal-get-face))))
681
682 (if (ediff-window-display-p)
683 (if ediff-xemacs-p
684 (progn
685 (fset 'ediff-display-pixel-width
686 (symbol-function 'device-pixel-width))
687 (fset 'ediff-display-pixel-height
688 (symbol-function 'device-pixel-height)))
689 (fset 'ediff-display-pixel-width
690 (symbol-function 'x-display-pixel-width))
691 (fset 'ediff-display-pixel-height
692 (symbol-function 'x-display-pixel-height))))
693
694
695 (defun ediff-make-current-diff-overlay (type)
696 (if (ediff-has-face-support-p)
697 (let ((overlay (intern (format "ediff-current-diff-overlay-%S" type)))
698 (buffer (ediff-get-buffer type))
699 (face (face-name
700 (symbol-value
701 (intern (format "ediff-current-diff-face-%S" type))))))
702 (set overlay
703 (ediff-make-bullet-proof-overlay (point-max) (point-max) buffer))
704 (ediff-set-overlay-face (symbol-value overlay) face)
705 (ediff-overlay-put (symbol-value overlay) 'ediff ediff-control-buffer))
706 ))
707
708 (defun ediff-set-overlay-face (extent face)
709 (ediff-overlay-put extent 'face face)
710 (ediff-overlay-put extent 'help-echo 'ediff-region-help-echo))
711
712 ;; This does nothing in Emacs, since overlays there have no help-echo property
713 (defun ediff-region-help-echo (extent)
714 (let ((is-current (ediff-overlay-get extent 'ediff))
715 (face (ediff-overlay-get extent 'face))
716 (diff-num (ediff-overlay-get extent 'ediff-diff-num))
717 face-help)
718
719 ;; This happens only for refinement overlays
720 (setq face-help (and face (get face 'ediff-help-echo)))
721
722 (cond ((and is-current diff-num) ; current diff region
723 (format "Difference region %S -- current" (1+ diff-num)))
724 (face-help) ; refinement of current diff region
725 (diff-num ; non-current
726 (format "Difference region %S -- non-current" (1+ diff-num)))
727 (t "")) ; none
728 ))
729
730 (defun ediff-set-face (ground face color)
731 "Set face foreground/background."
732 (if (ediff-has-face-support-p)
733 (if (ediff-valid-color-p color)
734 (if (eq ground 'foreground)
735 (set-face-foreground face color)
736 (set-face-background face color))
737 (cond ((memq face
738 '(ediff-current-diff-face-A
739 ediff-current-diff-face-B
740 ediff-current-diff-face-C
741 ediff-current-diff-face-Ancestor))
742 (copy-face 'highlight face))
743 ((memq face
744 '(ediff-fine-diff-face-A
745 ediff-fine-diff-face-B
746 ediff-fine-diff-face-C
747 ediff-fine-diff-face-Ancestor))
748 (copy-face 'secondary-selection face)
749 (set-face-underline-p face t))
750 ((memq face
751 '(ediff-even-diff-face-A
752 ediff-odd-diff-face-A
753 ediff-even-diff-face-B ediff-odd-diff-face-B
754 ediff-even-diff-face-C ediff-odd-diff-face-C
755 ediff-even-diff-face-Ancestor
756 ediff-odd-diff-face-Ancestor))
757 (copy-face 'secondary-selection face))))
758 ))
759
760 (defun ediff-set-face-pixmap (face pixmap)
761 "Set face pixmap on a monochrome display."
762 (if (and (ediff-window-display-p) (not (ediff-color-display-p)))
763 (condition-case nil
764 (set-face-background-pixmap face pixmap)
765 (error
766 (message "Pixmap not found for %S: %s" (face-name face) pixmap)
767 (sit-for 1)))))
768
769 (defun ediff-hide-face (face)
770 (if (and (ediff-has-face-support-p) ediff-emacs-p)
771 (add-to-list 'facemenu-unlisted-faces face)))
772
773 (defvar ediff-current-diff-face-A
774 (if (ediff-has-face-support-p)
775 (progn
776 (make-face 'ediff-current-diff-face-A)
777 (ediff-hide-face 'ediff-current-diff-face-A)
778 (or (face-differs-from-default-p 'ediff-current-diff-face-A)
779 (cond ((ediff-color-display-p)
780 (ediff-set-face
781 'foreground 'ediff-current-diff-face-A "firebrick")
782 (ediff-set-face
783 'background 'ediff-current-diff-face-A "pale green"))
784 (t
785 (if ediff-xemacs-p
786 (copy-face 'modeline 'ediff-current-diff-face-A)
787 (copy-face 'highlight 'ediff-current-diff-face-A))
788 )))
789 'ediff-current-diff-face-A))
790 "Face for highlighting the selected difference in buffer A.")
791
792 (defvar ediff-current-diff-face-B
793 (if (ediff-has-face-support-p)
794 (progn
795 (make-face 'ediff-current-diff-face-B)
796 (ediff-hide-face 'ediff-current-diff-face-B)
797 (or (face-differs-from-default-p 'ediff-current-diff-face-B)
798 (cond ((ediff-color-display-p)
799 (ediff-set-face
800 'foreground 'ediff-current-diff-face-B "DarkOrchid")
801 (ediff-set-face
802 'background 'ediff-current-diff-face-B "Yellow"))
803 (t
804 (if ediff-xemacs-p
805 (copy-face 'modeline 'ediff-current-diff-face-B)
806 (copy-face 'highlight 'ediff-current-diff-face-B))
807 )))
808 'ediff-current-diff-face-B))
809 "Face for highlighting the selected difference in buffer B.")
810
811
812 (defvar ediff-current-diff-face-C
813 (if (ediff-has-face-support-p)
814 (progn
815 (make-face 'ediff-current-diff-face-C)
816 (ediff-hide-face 'ediff-current-diff-face-C)
817 (or (face-differs-from-default-p 'ediff-current-diff-face-C)
818 (cond ((ediff-color-display-p)
819 (ediff-set-face
820 'foreground 'ediff-current-diff-face-C "Navy")
821 (ediff-set-face
822 'background 'ediff-current-diff-face-C "Pink"))
823 (t
824 (if ediff-xemacs-p
825 (copy-face 'modeline 'ediff-current-diff-face-C)
826 (copy-face 'highlight 'ediff-current-diff-face-C))
827 )))
828 'ediff-current-diff-face-C))
829 "Face for highlighting the selected difference in buffer C.")
830
831 (defvar ediff-current-diff-face-Ancestor
832 (if (ediff-has-face-support-p)
833 (progn
834 (make-face 'ediff-current-diff-face-Ancestor)
835 (ediff-hide-face 'ediff-current-diff-face-Ancestor)
836 (or (face-differs-from-default-p 'ediff-current-diff-face-Ancestor)
837 (copy-face
838 'ediff-current-diff-face-C 'ediff-current-diff-face-Ancestor))
839 'ediff-current-diff-face-Ancestor))
840 "Face for highlighting the selected difference in the ancestor buffer.")
841
842 (defvar ediff-fine-diff-pixmap "gray3"
843 "Pixmap to use for highlighting fine differences.")
844 (defvar ediff-odd-diff-pixmap "gray1"
845 "Pixmap to use for highlighting odd differences.")
846 (defvar ediff-even-diff-pixmap "Stipple"
847 "Pixmap to use for highlighting even differences.")
848
849 (defvar ediff-fine-diff-face-A
850 (if (ediff-has-face-support-p)
851 (progn
852 (make-face 'ediff-fine-diff-face-A)
853 (ediff-hide-face 'ediff-fine-diff-face-A)
854 (or (face-differs-from-default-p 'ediff-fine-diff-face-A)
855 (cond ((ediff-color-display-p)
856 (ediff-set-face 'foreground 'ediff-fine-diff-face-A
857 "Navy")
858 (ediff-set-face 'background 'ediff-fine-diff-face-A
859 "sky blue"))
860 (t
861 (set-face-underline-p 'ediff-fine-diff-face-A t)
862 (ediff-set-face-pixmap 'ediff-fine-diff-face-A
863 ediff-fine-diff-pixmap)
864 )))
865 'ediff-fine-diff-face-A))
866 "Face for highlighting the refinement of the selected diff in buffer A.")
867
868 (defvar ediff-fine-diff-face-B
869 (if (ediff-has-face-support-p)
870 (progn
871 (make-face 'ediff-fine-diff-face-B)
872 (ediff-hide-face 'ediff-fine-diff-face-B)
873 (or (face-differs-from-default-p 'ediff-fine-diff-face-B)
874 (cond ((ediff-color-display-p)
875 (ediff-set-face 'foreground 'ediff-fine-diff-face-B "Black")
876 (ediff-set-face 'background 'ediff-fine-diff-face-B "cyan"))
877 (t
878 (set-face-underline-p 'ediff-fine-diff-face-B t)
879 (ediff-set-face-pixmap 'ediff-fine-diff-face-B
880 ediff-fine-diff-pixmap)
881 )))
882 'ediff-fine-diff-face-B))
883 "Face for highlighting the refinement of the selected diff in buffer B.")
884
885 (defvar ediff-fine-diff-face-C
886 (if (ediff-has-face-support-p)
887 (progn
888 (make-face 'ediff-fine-diff-face-C)
889 (ediff-hide-face 'ediff-fine-diff-face-C)
890 (or (face-differs-from-default-p 'ediff-fine-diff-face-C)
891 (cond ((ediff-color-display-p)
892 (ediff-set-face 'foreground 'ediff-fine-diff-face-C "black")
893 (ediff-set-face
894 'background 'ediff-fine-diff-face-C "Turquoise"))
895 (t
896 (set-face-underline-p 'ediff-fine-diff-face-C t)
897 (ediff-set-face-pixmap 'ediff-fine-diff-face-C
898 ediff-fine-diff-pixmap)
899 )))
900 'ediff-fine-diff-face-C))
901 "Face for highlighting the refinement of the selected diff in buffer C.")
902
903 (defvar ediff-fine-diff-face-Ancestor
904 (if (ediff-has-face-support-p)
905 (progn
906 (make-face 'ediff-fine-diff-face-Ancestor)
907 (ediff-hide-face 'ediff-fine-diff-face-Ancestor)
908 (or (face-differs-from-default-p 'ediff-fine-diff-face-Ancestor)
909 (progn
910 (copy-face
911 'ediff-fine-diff-face-C 'ediff-fine-diff-face-Ancestor)
912 (ediff-set-face-pixmap 'ediff-fine-diff-face-Ancestor
913 ediff-fine-diff-pixmap))
914 )))
915 "Face highlighting refinements of the selected diff in ancestor buffer.
916 Presently, this is not used, as difference regions are not refined in the
917 ancestor buffer.")
918
919 (defvar ediff-even-diff-face-A
920 (if (ediff-has-face-support-p)
921 (progn
922 (make-face 'ediff-even-diff-face-A)
923 (ediff-hide-face 'ediff-even-diff-face-A)
924 (or (face-differs-from-default-p 'ediff-even-diff-face-A)
925 (cond ((ediff-color-display-p)
926 (ediff-set-face
927 'foreground 'ediff-even-diff-face-A "black")
928 (ediff-set-face
929 'background 'ediff-even-diff-face-A "light grey"))
930 (t
931 (copy-face 'italic 'ediff-even-diff-face-A)
932 (ediff-set-face-pixmap 'ediff-even-diff-face-A
933 ediff-even-diff-pixmap)
934 )))
935 'ediff-even-diff-face-A))
936 "Face used to highlight even-numbered differences in buffer A.")
937
938 (defvar ediff-even-diff-face-B
939 (if (ediff-has-face-support-p)
940 (progn
941 (make-face 'ediff-even-diff-face-B)
942 (ediff-hide-face 'ediff-even-diff-face-B)
943 (or (face-differs-from-default-p 'ediff-even-diff-face-B)
944 (cond ((ediff-color-display-p)
945 (ediff-set-face
946 'foreground 'ediff-even-diff-face-B "White")
947 (ediff-set-face
948 'background 'ediff-even-diff-face-B "Gray"))
949 (t
950 (copy-face 'italic 'ediff-even-diff-face-B)
951 (ediff-set-face-pixmap 'ediff-even-diff-face-B
952 ediff-even-diff-pixmap)
953 )))
954 'ediff-even-diff-face-B))
955 "Face used to highlight even-numbered differences in buffer B.")
956
957 (defvar ediff-even-diff-face-C
958 (if (ediff-has-face-support-p)
959 (progn
960 (make-face 'ediff-even-diff-face-C)
961 (ediff-hide-face 'ediff-even-diff-face-C)
962 (or (face-differs-from-default-p 'ediff-even-diff-face-C)
963 (progn
964 (copy-face 'ediff-even-diff-face-A 'ediff-even-diff-face-C)
965 (ediff-set-face-pixmap 'ediff-even-diff-face-C
966 ediff-even-diff-pixmap)))
967 'ediff-even-diff-face-C))
968 "Face used to highlight even-numbered differences in buffer C.")
969
970 (defvar ediff-even-diff-face-Ancestor
971 (if (ediff-has-face-support-p)
972 (progn
973 (make-face 'ediff-even-diff-face-Ancestor)
974 (ediff-hide-face 'ediff-even-diff-face-Ancestor)
975 (or (face-differs-from-default-p 'ediff-even-diff-face-Ancestor)
976 (progn
977 (copy-face
978 'ediff-even-diff-face-C 'ediff-even-diff-face-Ancestor)
979 (ediff-set-face-pixmap 'ediff-even-diff-face-Ancestor
980 ediff-even-diff-pixmap)))
981 'ediff-even-diff-face-Ancestor))
982 "Face highlighting even-numbered differences in the ancestor buffer.")
983
984 (defvar ediff-odd-diff-face-A
985 (if (ediff-has-face-support-p)
986 (progn
987 (make-face 'ediff-odd-diff-face-A)
988 (ediff-hide-face 'ediff-odd-diff-face-A)
989 (or (face-differs-from-default-p 'ediff-odd-diff-face-A)
990 (cond ((ediff-color-display-p)
991 (ediff-set-face
992 'foreground 'ediff-odd-diff-face-A "White")
993 (ediff-set-face
994 'background 'ediff-odd-diff-face-A "Gray"))
995 (t
996 (copy-face 'italic 'ediff-odd-diff-face-A)
997 (ediff-set-face-pixmap 'ediff-odd-diff-face-A
998 ediff-odd-diff-pixmap)
999 )))
1000 'ediff-odd-diff-face-A))
1001 "Face used to highlight odd-numbered differences in buffer A.")
1002
1003 (defvar ediff-odd-diff-face-B
1004 (if (ediff-has-face-support-p)
1005 (progn
1006 (make-face 'ediff-odd-diff-face-B)
1007 (ediff-hide-face 'ediff-odd-diff-face-B)
1008 (or (face-differs-from-default-p 'ediff-odd-diff-face-B)
1009 (cond ((ediff-color-display-p)
1010 (ediff-set-face
1011 'foreground 'ediff-odd-diff-face-B "Black")
1012 (ediff-set-face
1013 'background 'ediff-odd-diff-face-B "light grey"))
1014 (t
1015 (copy-face 'italic 'ediff-odd-diff-face-B)
1016 (ediff-set-face-pixmap 'ediff-odd-diff-face-B
1017 ediff-odd-diff-pixmap)
1018 )))
1019 'ediff-odd-diff-face-B))
1020 "Face used to highlight odd-numbered differences in buffer B.")
1021
1022 (defvar ediff-odd-diff-face-C
1023 (if (ediff-has-face-support-p)
1024 (progn
1025 (make-face 'ediff-odd-diff-face-C)
1026 (ediff-hide-face 'ediff-odd-diff-face-C)
1027 (or (face-differs-from-default-p 'ediff-odd-diff-face-C)
1028 (progn
1029 (copy-face 'ediff-odd-diff-face-A 'ediff-odd-diff-face-C)
1030 (ediff-set-face-pixmap 'ediff-odd-diff-face-C
1031 ediff-odd-diff-pixmap)))
1032 'ediff-odd-diff-face-C))
1033 "Face used to highlight odd-numbered differences in buffer C.")
1034
1035 (defvar ediff-odd-diff-face-Ancestor
1036 (if (ediff-has-face-support-p)
1037 (progn
1038 (make-face 'ediff-odd-diff-face-Ancestor)
1039 (ediff-hide-face 'ediff-odd-diff-face-Ancestor)
1040 (or (face-differs-from-default-p 'ediff-odd-diff-face-Ancestor)
1041 (progn
1042 (copy-face 'ediff-odd-diff-face-C 'ediff-odd-diff-face-Ancestor)
1043 (ediff-set-face-pixmap 'ediff-odd-diff-face-Ancestor
1044 ediff-odd-diff-pixmap)))
1045 'ediff-odd-diff-face-Ancestor))
1046 "Face used to highlight even-numbered differences in the ancestor buffer.")
1047
1048 ;; Help echo
1049 (put 'ediff-fine-diff-face-A 'ediff-help-echo
1050 "A `refinement' of the current difference region")
1051 (put 'ediff-fine-diff-face-B 'ediff-help-echo
1052 "A `refinement' of the current difference region")
1053 (put 'ediff-fine-diff-face-C 'ediff-help-echo
1054 "A `refinement' of the current difference region")
1055 (put 'ediff-fine-diff-face-Ancestor 'ediff-help-echo
1056 "A `refinement' of the current difference region")
1057
1058
1059 ;;; Overlays
1060
1061 (ediff-defvar-local ediff-current-diff-overlay-A nil
1062 "Overlay for the current difference region in buffer A.")
1063 (ediff-defvar-local ediff-current-diff-overlay-B nil
1064 "Overlay for the current difference region in buffer B.")
1065 (ediff-defvar-local ediff-current-diff-overlay-C nil
1066 "Overlay for the current difference region in buffer C.")
1067 (ediff-defvar-local ediff-current-diff-overlay-Ancestor nil
1068 "Overlay for the current difference region in the ancestor buffer.")
1069
1070 ;; Compute priority of ediff overlay.
1071 (defun ediff-highest-priority (start end buffer)
1072 (let ((pos (max 1 (1- start)))
1073 ovr-list)
1074 (if ediff-xemacs-p
1075 (1+ ediff-shadow-overlay-priority)
1076 (ediff-eval-in-buffer buffer
1077 (while (< pos (min (point-max) (1+ end)))
1078 (setq ovr-list (append (overlays-at pos) ovr-list))
1079 (setq pos (next-overlay-change pos)))
1080 (1+ (apply '+
1081 (mapcar (function
1082 (lambda (ovr)
1083 (if ovr
1084 (or (ediff-overlay-get ovr 'priority) 0)
1085 0)))
1086 ovr-list)
1087 ))
1088 ))))
1089
1090
1091 (defvar ediff-toggle-read-only-function nil
1092 "*Specifies the function to be used to toggle read-only.
1093 If nil, Ediff tries to deduce the function from the binding of C-x C-q.
1094 Normally, this is the `toggle-read-only' function, but, if version
1095 control is used, it could be `vc-toggle-read-only' or `rcs-toggle-read-only'.")
1096
1097
1098 ;;; Misc
1099
1100 ;; if nil, this silences some messages
1101 (defconst ediff-verbose-p t)
1102
1103 (ediff-defvar-local ediff-autostore-merges 'group-jobs-only
1104 "*Save the results of merge jobs automatically.
1105 Nil means don't save automatically. t means always save. Anything but nil or t
1106 means save automatically only if the merge job is part of a group of jobs, such
1107 as `ediff-merge-directory' or `ediff-merge-directory-revisions'.")
1108
1109 ;; file where the result of the merge is to be saved. used internally
1110 (ediff-defvar-local ediff-merge-store-file nil "")
1111
1112 (defvar ediff-no-emacs-help-in-control-buffer nil
1113 "*Non-nil means C-h should not invoke Emacs help in control buffer.
1114 Instead, C-h jumps to previous difference.")
1115
1116 (defvar ediff-temp-file-prefix
1117 (let ((env (or (getenv "TMPDIR")
1118 (getenv "TMP")
1119 (getenv "TEMP")))
1120 d)
1121 (setq d (if (and env (> (length env) 0))
1122 env
1123 (cond ((memq system-type '(vax-vms axp-vms)) "SYS$SCRATCH:")
1124 ((eq system-type 'ms-dos) "c:/")
1125 (t "/tmp"))))
1126 ;; The following is to make sure we get something to which we can
1127 ;; add directory levels on VMS.
1128 (setq d (file-name-as-directory (directory-file-name d)))
1129 )
1130 "*Prefix to put on Ediff temporary file names.
1131 Do not start with `~/' or `~user-name/'.")
1132
1133 (defvar ediff-temp-file-mode 384 ; u=rw only
1134 "*Mode for Ediff temporary files.")
1135
1136 ;; Metacharacters that have to be protected from the shell when executing
1137 ;; a diff/diff3 command.
1138 (defvar ediff-metachars "[ \t\n!\"#$&'()*;<=>?[\\^`{|~]"
1139 "Characters that must be quoted with \\ when used in a shell command line.
1140 More precisely, a regexp to match any one such character.")
1141
1142 ;; needed to simulate frame-char-width in XEmacs.
1143 (defvar ediff-H-glyph (if ediff-xemacs-p (make-glyph "H")))
1144
1145
1146 (ediff-defvar-local ediff-temp-file-A nil
1147 "Temporary file used for refining difference regions in buffer A.")
1148 (ediff-defvar-local ediff-temp-file-B nil
1149 "Temporary file used for refining difference regions in buffer B.")
1150 (ediff-defvar-local ediff-temp-file-C nil
1151 "Temporary file used for refining difference regions in buffer C.")
1152
1153 ;;; In-line functions
1154
1155 (defsubst ediff-file-remote-p (file-name)
1156 (require 'ange-ftp)
1157 (car (if ediff-xemacs-p
1158 (ange-ftp-ftp-path file-name)
1159 (ange-ftp-ftp-name file-name))))
1160
1161
1162 (defsubst ediff-frame-unsplittable-p (frame)
1163 (cdr (assq 'unsplittable (frame-parameters frame))))
1164
1165 (defsubst ediff-get-next-window (wind prev-wind)
1166 (or (window-live-p wind)
1167 (setq wind (if prev-wind
1168 (next-window wind)
1169 (selected-window)))))
1170
1171
1172 (defsubst ediff-kill-buffer-carefully (buf)
1173 "Kill buffer BUF if it exists."
1174 (if (ediff-buffer-live-p buf)
1175 (kill-buffer (get-buffer buf))))
1176
1177
1178 ;; activate faces on diff regions in buffer
1179 (defun ediff-paint-background-regions-in-one-buffer (buf-type unhighlight)
1180 (let ((diff-vector
1181 (eval (intern (format "ediff-difference-vector-%S" buf-type))))
1182 overl diff-num)
1183 (mapcar (function
1184 (lambda (rec)
1185 (setq overl (ediff-get-diff-overlay-from-diff-record rec)
1186 diff-num (ediff-overlay-get overl 'ediff-diff-num))
1187 (ediff-set-overlay-face
1188 overl
1189 (if (not unhighlight)
1190 (ediff-background-face buf-type diff-num))
1191 )))
1192 diff-vector)))
1193
1194
1195 ;; activate faces on diff regions in all buffers
1196 (defun ediff-paint-background-regions (&optional unhighlight)
1197 (ediff-paint-background-regions-in-one-buffer
1198 'A unhighlight)
1199 (ediff-paint-background-regions-in-one-buffer
1200 'B unhighlight)
1201 (ediff-paint-background-regions-in-one-buffer
1202 'C unhighlight)
1203 (ediff-paint-background-regions-in-one-buffer
1204 'Ancestor unhighlight))
1205
1206 (defun ediff-highlight-diff-in-one-buffer (n buf-type)
1207 (if (ediff-buffer-live-p (ediff-get-buffer buf-type))
1208 (let* ((buff (ediff-get-buffer buf-type))
1209 (last (ediff-eval-in-buffer buff (point-max)))
1210 (begin (ediff-get-diff-posn buf-type 'beg n))
1211 (end (ediff-get-diff-posn buf-type 'end n))
1212 (xtra (if (equal begin end) 1 0))
1213 (end-hilit (min last (+ end xtra)))
1214 (current-diff-overlay
1215 (symbol-value
1216 (intern (format "ediff-current-diff-overlay-%S" buf-type)))))
1217
1218 (if ediff-xemacs-p
1219 (ediff-move-overlay current-diff-overlay begin end-hilit)
1220 (ediff-move-overlay current-diff-overlay begin end-hilit buff))
1221 (ediff-overlay-put current-diff-overlay 'priority
1222 (ediff-highest-priority begin end-hilit buff))
1223 (ediff-overlay-put current-diff-overlay 'ediff-diff-num n)
1224
1225 ;; unhighlight the background overlay for diff n so it won't
1226 ;; interfere with the current diff overlay
1227 (ediff-set-overlay-face (ediff-get-diff-overlay n buf-type) nil)
1228 )))
1229
1230
1231 (defun ediff-unhighlight-diff-in-one-buffer (buf-type)
1232 (if (ediff-buffer-live-p (ediff-get-buffer buf-type))
1233 (let ((current-diff-overlay
1234 (symbol-value
1235 (intern (format "ediff-current-diff-overlay-%S" buf-type))))
1236 (overlay
1237 (ediff-get-diff-overlay ediff-current-difference buf-type))
1238 )
1239
1240 (ediff-move-overlay current-diff-overlay 1 1)
1241
1242 ;; rehighlight the overlay in the background of the
1243 ;; current difference region
1244 (ediff-set-overlay-face
1245 overlay
1246 (if (and (ediff-has-face-support-p)
1247 ediff-use-faces ediff-highlight-all-diffs)
1248 (ediff-background-face buf-type ediff-current-difference)))
1249 )))
1250
1251 (defun ediff-unhighlight-diffs-totally-in-one-buffer (buf-type)
1252 (ediff-unselect-and-select-difference -1)
1253 (if (and (ediff-has-face-support-p) ediff-use-faces)
1254 (let* ((inhibit-quit t)
1255 (current-diff-overlay-var
1256 (intern (format "ediff-current-diff-overlay-%S" buf-type)))
1257 (current-diff-overlay (symbol-value current-diff-overlay-var)))
1258 (ediff-paint-background-regions 'unhighlight)
1259 (if (ediff-overlayp current-diff-overlay)
1260 (ediff-delete-overlay current-diff-overlay))
1261 (set current-diff-overlay-var nil)
1262 )))
1263
1264
1265 (defsubst ediff-highlight-diff (n)
1266 "Put face on diff N. Invoked for X displays only."
1267 (ediff-highlight-diff-in-one-buffer n 'A)
1268 (ediff-highlight-diff-in-one-buffer n 'B)
1269 (ediff-highlight-diff-in-one-buffer n 'C)
1270 (ediff-highlight-diff-in-one-buffer n 'Ancestor)
1271 )
1272
1273
1274 (defsubst ediff-unhighlight-diff ()
1275 "Remove overlays from buffers A, B, and C."
1276 (ediff-unhighlight-diff-in-one-buffer 'A)
1277 (ediff-unhighlight-diff-in-one-buffer 'B)
1278 (ediff-unhighlight-diff-in-one-buffer 'C)
1279 (ediff-unhighlight-diff-in-one-buffer 'Ancestor)
1280 )
1281
1282 ;; delete highlighting overlays, restore faces to their original form
1283 (defsubst ediff-unhighlight-diffs-totally ()
1284 (ediff-unhighlight-diffs-totally-in-one-buffer 'A)
1285 (ediff-unhighlight-diffs-totally-in-one-buffer 'B)
1286 (ediff-unhighlight-diffs-totally-in-one-buffer 'C)
1287 (ediff-unhighlight-diffs-totally-in-one-buffer 'Ancestor)
1288 )
1289
1290 (defsubst ediff-background-face (buf-type dif-num)
1291 ;; The value of dif-num is always 1- the one that user sees.
1292 ;; This is why even face is used when dif-num is odd.
1293 (intern (format (if (ediff-odd-p dif-num)
1294 "ediff-even-diff-face-%S"
1295 "ediff-odd-diff-face-%S")
1296 buf-type)))
1297
1298
1299 ;; arg is a record for a given diff in a difference vector
1300 ;; this record is itself a vector
1301 (defsubst ediff-clear-fine-diff-vector (diff-record)
1302 (if diff-record
1303 (mapcar 'ediff-delete-overlay
1304 (ediff-get-fine-diff-vector-from-diff-record diff-record))))
1305
1306 (defsubst ediff-clear-fine-differences-in-one-buffer (n buf-type)
1307 (ediff-clear-fine-diff-vector (ediff-get-difference n buf-type))
1308 (ediff-set-fine-diff-vector n buf-type nil))
1309
1310 (defsubst ediff-clear-fine-differences (n)
1311 (ediff-clear-fine-differences-in-one-buffer n 'A)
1312 (ediff-clear-fine-differences-in-one-buffer n 'B)
1313 (if ediff-3way-job
1314 (ediff-clear-fine-differences-in-one-buffer n 'C)))
1315
1316
1317 (defsubst ediff-convert-fine-diffs-to-overlays (diff-list region-num)
1318 (ediff-set-fine-overlays-in-one-buffer 'A diff-list region-num)
1319 (ediff-set-fine-overlays-in-one-buffer 'B diff-list region-num)
1320 (if ediff-3way-job
1321 (ediff-set-fine-overlays-in-one-buffer 'C diff-list region-num)
1322 ))
1323
1324 (defsubst ediff-mouse-event-p (event)
1325 (if ediff-xemacs-p
1326 (button-event-p event)
1327 (string-match "mouse" (format "%S" (event-basic-type event)))
1328 ))
1329
1330
1331 (defsubst ediff-key-press-event-p (event)
1332 (if ediff-xemacs-p
1333 (key-press-event-p event)
1334 (or (char-or-string-p event) (symbolp event))))
1335
1336 (defun ediff-event-point (event)
1337 (cond ((ediff-mouse-event-p event)
1338 (if ediff-xemacs-p
1339 (event-point event)
1340 (posn-point (event-start event))))
1341 ((ediff-key-press-event-p event)
1342 (point))
1343 (t (error))))
1344
1345 (defun ediff-event-buffer (event)
1346 (cond ((ediff-mouse-event-p event)
1347 (if ediff-xemacs-p
1348 (event-buffer event)
1349 (window-buffer (posn-window (event-start event)))))
1350 ((ediff-key-press-event-p event)
1351 (current-buffer))
1352 (t (error))))
1353
1354
1355 (defsubst ediff-frame-iconified-p (frame)
1356 (if (and (ediff-window-display-p) (frame-live-p frame))
1357 (if ediff-xemacs-p
1358 (frame-iconified-p frame)
1359 (eq (frame-visible-p frame) 'icon))))
1360
1361 (defsubst ediff-window-visible-p (wind)
1362 ;; under TTY, window-live-p also means window is visible
1363 (and (window-live-p wind)
1364 (or (not (ediff-window-display-p))
1365 (frame-visible-p (window-frame wind)))))
1366
1367
1368 (defsubst ediff-frame-char-width (frame)
1369 (if ediff-xemacs-p
1370 (/ (frame-pixel-width frame) (frame-width frame))
1371 (frame-char-width frame)))
1372
1373 (defun ediff-reset-mouse (&optional frame do-not-grab-mouse)
1374 (or frame (setq frame (selected-frame)))
1375 (if (ediff-window-display-p)
1376 (let ((frame-or-wind frame))
1377 (if ediff-xemacs-p
1378 (setq frame-or-wind (frame-selected-window frame)))
1379 (or do-not-grab-mouse
1380 ;; don't set mouse if the user said to never do this
1381 (not ediff-grab-mouse)
1382 ;; Don't grab on quit, if the user doesn't want to.
1383 ;; If ediff-grab-mouse = t, then mouse won't be grabbed for
1384 ;; sessions that are not part of a group (this is done in
1385 ;; ediff-recenter). The condition below affects only terminating
1386 ;; sessions in session groups (in which case mouse is warped into
1387 ;; a meta buffer).
1388 (and (eq ediff-grab-mouse 'maybe)
1389 (memq this-command '(ediff-quit ediff-update-diffs)))
1390 (set-mouse-position frame-or-wind 1 0))
1391 )))
1392
1393 (defsubst ediff-spy-after-mouse ()
1394 (setq ediff-mouse-pixel-position (mouse-pixel-position)))
1395
1396 ;; It is not easy to find out when the user grabs the mouse, since emacs and
1397 ;; xemacs behave differently when mouse is not in any frame. Also, this is
1398 ;; sensitive to when the user grabbed mouse. Not used for now.
1399 (defun ediff-user-grabbed-mouse ()
1400 (if ediff-mouse-pixel-position
1401 (cond ((not (eq (car ediff-mouse-pixel-position)
1402 (car (mouse-pixel-position)))))
1403 ((and (car (cdr ediff-mouse-pixel-position))
1404 (car (cdr (mouse-pixel-position)))
1405 (cdr (cdr ediff-mouse-pixel-position))
1406 (cdr (cdr (mouse-pixel-position))))
1407 (not (and (< (abs (- (car (cdr ediff-mouse-pixel-position))
1408 (car (cdr (mouse-pixel-position)))))
1409 ediff-mouse-pixel-threshold)
1410 (< (abs (- (cdr (cdr ediff-mouse-pixel-position))
1411 (cdr (cdr (mouse-pixel-position)))))
1412 ediff-mouse-pixel-threshold))))
1413 (t nil))))
1414
1415 (defsubst ediff-frame-char-height (frame)
1416 (if ediff-xemacs-p
1417 (glyph-height ediff-H-glyph (selected-window frame))
1418 (frame-char-height frame)))
1419
1420 ;; Some overlay functions
1421
1422 (defsubst ediff-empty-overlay-p (overl)
1423 (= (ediff-overlay-start overl) (ediff-overlay-end overl)))
1424
1425 ;; like overlay-buffer in Emacs. In XEmacs, returns nil if the extent is
1426 ;; dead. Otherwise, works like extent-buffer
1427 (defun ediff-overlay-buffer (overl)
1428 (if ediff-emacs-p
1429 (overlay-buffer overl)
1430 (and (extent-live-p overl) (extent-object overl))))
1431
1432 ;; like overlay-get in Emacs. In XEmacs, returns nil if the extent is
1433 ;; dead. Otherwise, like extent-property
1434 (defun ediff-overlay-get (overl property)
1435 (if ediff-emacs-p
1436 (overlay-get overl property)
1437 (and (extent-live-p overl) (extent-property overl property))))
1438
1439
1440 ;; These two functions are here because XEmacs refuses to
1441 ;; handle overlays whose buffers were deleted.
1442 (defun ediff-move-overlay (overlay beg end &optional buffer)
1443 "Calls `move-overlay' in Emacs and `set-extent-endpoints' in Lemacs.
1444 Checks if overlay's buffer exists before actually doing the move."
1445 (let ((buf (and overlay (ediff-overlay-buffer overlay))))
1446 (if (ediff-buffer-live-p buf)
1447 (if ediff-xemacs-p
1448 (set-extent-endpoints overlay beg end)
1449 (move-overlay overlay beg end buffer))
1450 ;; buffer's dead
1451 (if overlay
1452 (ediff-delete-overlay overlay)))))
1453
1454 (defun ediff-overlay-put (overlay prop value)
1455 "Calls `overlay-put' or `set-extent-property' depending on Emacs version.
1456 Checks if overlay's buffer exists."
1457 (if (ediff-buffer-live-p (ediff-overlay-buffer overlay))
1458 (if ediff-xemacs-p
1459 (set-extent-property overlay prop value)
1460 (overlay-put overlay prop value))
1461 (ediff-delete-overlay overlay)))
1462
1463 ;; Some diff region tests
1464
1465 ;; t if diff region is empty.
1466 ;; In case of buffer C, t also if it is not a 3way
1467 ;; comparison job (merging jobs return t as well).
1468 (defun ediff-empty-diff-region-p (n buf-type)
1469 (if (eq buf-type 'C)
1470 (or (not ediff-3way-comparison-job)
1471 (= (ediff-get-diff-posn 'C 'beg n)
1472 (ediff-get-diff-posn 'C 'end n)))
1473 (= (ediff-get-diff-posn buf-type 'beg n)
1474 (ediff-get-diff-posn buf-type 'end n))))
1475
1476 ;; Test if diff region is white space only.
1477 ;; If 2-way job and buf-type = C, then returns t.
1478 (defun ediff-whitespace-diff-region-p (n buf-type)
1479 (or (and (eq buf-type 'C) (not ediff-3way-job))
1480 (ediff-empty-diff-region-p n buf-type)
1481 (let ((beg (ediff-get-diff-posn buf-type 'beg n))
1482 (end (ediff-get-diff-posn buf-type 'end n)))
1483 (ediff-eval-in-buffer (ediff-get-buffer buf-type)
1484 (save-excursion
1485 (goto-char beg)
1486 (skip-chars-forward ediff-whitespace)
1487 (>= (point) end))))))
1488
1489 ;; temporarily uses DIR to abbreviate file name
1490 ;; if DIR is nil, use default-directory
1491 (defun ediff-abbreviate-file-name (file &optional dir)
1492 (cond ((stringp dir)
1493 (let ((directory-abbrev-alist (list (cons dir ""))))
1494 (abbreviate-file-name file)))
1495 (ediff-emacs-p (abbreviate-file-name file))
1496 (t ; XEmacs requires addl argument
1497 (abbreviate-file-name file t))))
1498
1499 ;; Takes a directory and returns the parent directory.
1500 ;; does nothing to `/'. If the ARG is a regular file,
1501 ;; strip the file AND the last dir.
1502 (defun ediff-strip-last-dir (dir)
1503 (if (not (stringp dir)) (setq dir default-directory))
1504 (setq dir (expand-file-name dir))
1505 (or (file-directory-p dir) (setq dir (file-name-directory dir)))
1506 (let* ((pos (1- (length dir)))
1507 (last-char (aref dir pos)))
1508 (if (and (> pos 0) (= last-char ?/))
1509 (setq dir (substring dir 0 pos)))
1510 (ediff-abbreviate-file-name (file-name-directory dir))))
1511
1512 (defun ediff-truncate-string-left (str newlen)
1513 ;; leave space for ... on the left
1514 (let ((len (length str))
1515 substr)
1516 (if (<= len newlen)
1517 str
1518 (setq newlen (max 0 (- newlen 3)))
1519 (setq substr (substring str (max 0 (- len 1 newlen))))
1520 (concat "..." substr))))
1521
1522 (defun ediff-abbrev-jobname (jobname)
1523 (cond ((eq jobname 'ediff-directories)
1524 "Compare two directories")
1525 ((eq jobname 'ediff-files)
1526 "Compare two files")
1527 ((eq jobname 'ediff-buffers)
1528 "Compare two buffers")
1529 ((eq jobname 'ediff-directories3)
1530 "Compare three directories")
1531 ((eq jobname 'ediff-files3)
1532 "Compare three files")
1533 ((eq jobname 'ediff-buffers3)
1534 "Compare three buffers")
1535 ((eq jobname 'ediff-revision)
1536 "Compare file with a version")
1537 ((eq jobname 'ediff-directory-revisions)
1538 "Compare dir files with versions")
1539 ((eq jobname 'ediff-merge-directory-revisions)
1540 "Merge dir files with versions")
1541 ((eq jobname 'ediff-merge-directory-revisions-with-ancestor)
1542 "Merge dir versions via ancestors")
1543 (t
1544 (let* ((str (substring (symbol-name jobname) 6))
1545 (len (length str))
1546 (pos 0))
1547 (while (< pos len)
1548 (if (= pos 0)
1549 (aset str pos (upcase (aref str pos))))
1550 (if (= (aref str pos) ?-)
1551 (aset str pos ?\ ))
1552 (setq pos (1+ pos)))
1553 str))))
1554
1555
1556
1557 (defsubst ediff-get-region-contents (n buf-type ctrl-buf &optional start end)
1558 (ediff-eval-in-buffer
1559 (ediff-eval-in-buffer ctrl-buf (ediff-get-buffer buf-type))
1560 (buffer-substring
1561 (or start (ediff-get-diff-posn buf-type 'beg n ctrl-buf))
1562 (or end (ediff-get-diff-posn buf-type 'end n ctrl-buf)))))
1563
1564 ;; If ediff modified mode line, strip the modification
1565 (defsubst ediff-strip-mode-line-format ()
1566 (if (member (car mode-line-format) '(" A: " " B: " " C: " " Ancestor: "))
1567 (setq mode-line-format (nth 2 mode-line-format))))
1568
1569 ;; Verify that we have a difference selected.
1570 (defsubst ediff-valid-difference-p (&optional n)
1571 (or n (setq n ediff-current-difference))
1572 (and (>= n 0) (< n ediff-number-of-differences)))
1573
1574 (defsubst ediff-show-all-diffs (n)
1575 "Don't skip difference regions."
1576 nil)
1577
1578 (defsubst Xor (a b)
1579 (or (and a (not b)) (and (not a) b)))
1580
1581 (defsubst ediff-message-if-verbose (string &rest args)
1582 (if ediff-verbose-p
1583 (apply 'message string args)))
1584
1585 (defun ediff-file-attributes (filename attr-number)
1586 (let ((handler (find-file-name-handler filename 'find-file-noselect)))
1587 (if (and handler (string-match "ange-ftp" (format "%S" handler)))
1588 -1
1589 (nth attr-number (file-attributes filename)))))
1590 (defsubst ediff-file-size (filename)
1591 (ediff-file-attributes filename 7))
1592 (defsubst ediff-file-modtime (filename)
1593 (ediff-file-attributes filename 5))
1594
1595
1596 (defun ediff-convert-standard-filename (fname)
1597 (if ediff-emacs-p
1598 (convert-standard-filename fname)
1599 ;; hopefully, XEmacs adds this functionality
1600 fname))
1601
1602
1603 ;;; Local Variables:
1604 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
1605 ;;; eval: (put 'ediff-eval-in-buffer 'lisp-indent-hook 1)
1606 ;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body))
1607 ;;; End:
1608
1609 (provide 'ediff-init)
1610
1611
1612 ;;; ediff-init.el ends here