1 ;;; ediff-init.el --- Macros, variables, and defsubsts used by Ediff
3 ;; Copyright (C) 1994-2015 Free Software Foundation, Inc.
5 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software: you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation, either version 3 of the License, or
13 ;; (at your option) any later version.
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
27 ;; Start compiler pacifier
28 (defvar ediff-metajob-name)
29 (defvar ediff-meta-buffer)
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 (defvar ediff-use-toolbar-p)
36 (defvar mswindowsx-bitmap-file-path)
39 (defvar ediff-force-faces nil
40 "If t, Ediff will think that it is running on a display that supports faces.
41 This is provided as a temporary relief for users of face-capable displays
42 that Ediff doesn't know about.")
44 ;; Are we running as a window application or on a TTY?
45 (defsubst ediff-device-type ()
46 (if (featurep 'xemacs)
47 (device-type (selected-device))
50 ;; in XEmacs: device-type is tty on tty and stream in batch.
51 (defun ediff-window-display-p ()
52 (and (ediff-device-type) (not (memq (ediff-device-type) '(tty pc stream)))))
54 ;; test if supports faces
55 (defun ediff-has-face-support-p ()
56 (cond ((ediff-window-display-p))
58 ((ediff-color-display-p))
59 ((featurep 'emacs) (memq (ediff-device-type) '(pc)))
60 ((featurep 'xemacs) (memq (ediff-device-type) '(tty pc)))
63 ;; toolbar support for emacs hasn't been implemented in ediff
64 (defun ediff-has-toolbar-support-p ()
65 (if (featurep 'xemacs)
66 (if (featurep 'toolbar) (console-on-window-system-p))))
69 (defun ediff-has-gutter-support-p ()
70 (if (featurep 'xemacs)
71 (if (featurep 'gutter) (console-on-window-system-p))))
73 (defun ediff-use-toolbar-p ()
74 (and (ediff-has-toolbar-support-p) ;Can it do it ?
75 (boundp 'ediff-use-toolbar-p)
76 ediff-use-toolbar-p)) ;Does the user want it ?
78 ;; Defines VAR as an advertised local variable.
79 ;; Performs a defvar, then executes `make-variable-buffer-local' on
80 ;; the variable. Also sets the `permanent-local' property,
81 ;; so that `kill-all-local-variables' (called by major-mode setting
82 ;; commands) won't destroy Ediff control variables.
84 ;; Plagiarized from `emerge-defvar-local' for XEmacs.
85 (defmacro ediff-defvar-local (var value doc)
86 "Defines VAR as a local variable."
87 (declare (indent defun))
89 (defvar ,var ,value ,doc)
90 (make-variable-buffer-local ',var)
91 (put ',var 'permanent-local t)))
95 ;; Variables that control each Ediff session---local to the control buffer.
98 ;; The buffer in which the A variant is stored.
99 (ediff-defvar-local ediff-buffer-A nil "")
100 ;; The buffer in which the B variant is stored.
101 (ediff-defvar-local ediff-buffer-B nil "")
102 ;; The buffer in which the C variant is stored or where the merge buffer lives.
103 (ediff-defvar-local ediff-buffer-C nil "")
105 (ediff-defvar-local ediff-ancestor-buffer nil "")
106 ;; The Ediff control buffer
107 (ediff-defvar-local ediff-control-buffer nil "")
109 (ediff-defvar-local ediff-temp-indirect-buffer nil
110 "If t, the buffer is a temporary indirect buffer.
111 It needs to be killed when we quit the session.")
114 ;; Association between buff-type and ediff-buffer-*
115 (defconst ediff-buffer-alist
116 '((?A . ediff-buffer-A)
117 (?B . ediff-buffer-B)
118 (?C . ediff-buffer-C)))
121 (defmacro ediff-odd-p (arg)
122 `(eq (logand ,arg 1) 1))
124 (defmacro ediff-buffer-live-p (buf)
125 `(and ,buf (get-buffer ,buf) (buffer-name (get-buffer ,buf))))
127 (defmacro ediff-get-buffer (arg)
128 `(cond ((eq ,arg 'A) ediff-buffer-A)
129 ((eq ,arg 'B) ediff-buffer-B)
130 ((eq ,arg 'C) ediff-buffer-C)
131 ((eq ,arg 'Ancestor) ediff-ancestor-buffer)
134 (defmacro ediff-get-value-according-to-buffer-type (buf-type list)
135 `(cond ((eq ,buf-type 'A) (nth 0 ,list))
136 ((eq ,buf-type 'B) (nth 1 ,list))
137 ((eq ,buf-type 'C) (nth 2 ,list))
140 (defmacro ediff-char-to-buftype (arg)
141 `(cond ((memq ,arg '(?a ?A)) 'A)
142 ((memq ,arg '(?b ?B)) 'B)
143 ((memq ,arg '(?c ?C)) 'C)
147 ;; A-list is supposed to be of the form (A . symb) (B . symb)...)
148 ;; where the first part of any association is a buffer type and the second is
149 ;; an appropriate symbol. Given buffer-type, this function returns the
150 ;; symbol. This is used to avoid using `intern'
151 (defsubst ediff-get-symbol-from-alist (buf-type alist)
152 (cdr (assoc buf-type alist)))
154 (defconst ediff-difference-vector-alist
155 '((A . ediff-difference-vector-A)
156 (B . ediff-difference-vector-B)
157 (C . ediff-difference-vector-C)
158 (Ancestor . ediff-difference-vector-Ancestor)))
160 (defmacro ediff-get-difference (n buf-type)
163 (ediff-get-symbol-from-alist
164 ,buf-type ediff-difference-vector-alist))
167 ;; Tell if it has been previously determined that the region has
168 ;; no diffs other than the white space and newlines
169 ;; The argument, N, is the diff region number used by Ediff to index the
170 ;; diff vector. It is 1 less than the number seen by the user.
172 ;; t if the diffs are whitespace in all buffers
173 ;; 'A (in 3-buf comparison only) if there are only whitespace
174 ;; diffs in bufs B and C
175 ;; 'B (in 3-buf comparison only) if there are only whitespace
176 ;; diffs in bufs A and C
177 ;; 'C (in 3-buf comparison only) if there are only whitespace
178 ;; diffs in bufs A and B
180 ;; A Difference Vector has the form:
181 ;; [diff diff diff ...]
182 ;; where each diff has the form:
183 ;; [overlay fine-diff-vector no-fine-diffs-flag state-of-difference]
184 ;; fine-diff-vector is a vector [fine-diff fine-diff fine-diff ...]
185 ;; no-fine-diffs-flag says if there are fine differences.
186 ;; state-of-difference is A, B, C, or nil, indicating which buffer is
187 ;; different from the other two (used only in 3-way jobs).
188 (defmacro ediff-no-fine-diffs-p (n)
189 `(aref (ediff-get-difference ,n 'A) 2))
191 (defmacro ediff-get-diff-overlay-from-diff-record (diff-rec)
194 (defmacro ediff-get-diff-overlay (n buf-type)
195 `(ediff-get-diff-overlay-from-diff-record
196 (ediff-get-difference ,n ,buf-type)))
198 (defmacro ediff-get-fine-diff-vector-from-diff-record (diff-rec)
201 (defmacro ediff-set-fine-diff-vector (n buf-type fine-vec)
202 `(aset (ediff-get-difference ,n ,buf-type) 1 ,fine-vec))
204 (defmacro ediff-get-state-of-diff (n buf-type)
205 `(if (ediff-buffer-live-p ediff-buffer-C)
206 (aref (ediff-get-difference ,n ,buf-type) 3)))
207 (defmacro ediff-set-state-of-diff (n buf-type val)
208 `(aset (ediff-get-difference ,n ,buf-type) 3 ,val))
210 (defmacro ediff-get-state-of-merge (n)
211 `(if ediff-state-of-merge
212 (aref (aref ediff-state-of-merge ,n) 0)))
213 (defmacro ediff-set-state-of-merge (n val)
214 `(if ediff-state-of-merge
215 (aset (aref ediff-state-of-merge ,n) 0 ,val)))
217 (defmacro ediff-get-state-of-ancestor (n)
218 `(if ediff-state-of-merge
219 (aref (aref ediff-state-of-merge ,n) 1)))
221 ;; if flag is t, puts a mark on diff region saying that
222 ;; the differences are in white space only. If flag is nil,
223 ;; the region is marked as essential (i.e., differences are
224 ;; not just in the white space and newlines.)
225 (defmacro ediff-mark-diff-as-space-only (n flag)
226 `(aset (ediff-get-difference ,n 'A) 2 ,flag))
228 (defmacro ediff-get-fine-diff-vector (n buf-type)
229 `(ediff-get-fine-diff-vector-from-diff-record
230 (ediff-get-difference ,n ,buf-type)))
232 ;; Macro to switch to BUFFER, evaluate BODY, returns to original buffer.
233 ;; Doesn't save the point and mark.
234 ;; This is `with-current-buffer' with the added test for live buffers."
235 (defmacro ediff-with-current-buffer (buffer &rest body)
236 "Evaluates BODY in BUFFER."
237 (declare (indent 1) (debug (form body)))
238 `(if (ediff-buffer-live-p ,buffer)
242 (or (eq this-command 'ediff-quit)
243 (error ediff-KILLED-VITAL-BUFFER))
247 (defsubst ediff-multiframe-setup-p ()
248 (and (ediff-window-display-p) ediff-multiframe))
250 (defmacro ediff-narrow-control-frame-p ()
251 `(and (ediff-multiframe-setup-p)
252 (equal ediff-help-message ediff-brief-message-string)))
254 (defmacro ediff-3way-comparison-job ()
257 '(ediff-files3 ediff-buffers3)))
258 (ediff-defvar-local ediff-3way-comparison-job nil "")
260 (defmacro ediff-merge-job ()
265 ediff-merge-files-with-ancestor
266 ediff-merge-buffers-with-ancestor
267 ediff-merge-revisions
268 ediff-merge-revisions-with-ancestor)))
269 (ediff-defvar-local ediff-merge-job nil "")
271 (defmacro ediff-patch-job ()
272 `(eq ediff-job-name 'epatch))
274 (defmacro ediff-merge-with-ancestor-job ()
277 '(ediff-merge-files-with-ancestor
278 ediff-merge-buffers-with-ancestor
279 ediff-merge-revisions-with-ancestor)))
280 (ediff-defvar-local ediff-merge-with-ancestor-job nil "")
282 (defmacro ediff-3way-job ()
283 `(or ediff-3way-comparison-job ediff-merge-job))
284 (ediff-defvar-local ediff-3way-job nil "")
286 ;; A diff3 job is like a 3way job, but ediff-merge doesn't require the use
288 (defmacro ediff-diff3-job ()
289 `(or ediff-3way-comparison-job
290 ediff-merge-with-ancestor-job))
291 (ediff-defvar-local ediff-diff3-job nil "")
293 (defmacro ediff-windows-job ()
294 `(memq ediff-job-name '(ediff-windows-wordwise ediff-windows-linewise)))
295 (ediff-defvar-local ediff-windows-job nil "")
297 (defmacro ediff-word-mode-job ()
298 `(memq ediff-job-name '(ediff-windows-wordwise ediff-regions-wordwise)))
299 (ediff-defvar-local ediff-word-mode-job nil "")
301 (defmacro ediff-narrow-job ()
302 `(memq ediff-job-name '(ediff-windows-wordwise
303 ediff-regions-wordwise
304 ediff-windows-linewise
305 ediff-regions-linewise)))
306 (ediff-defvar-local ediff-narrow-job nil "")
308 ;; Note: ediff-merge-directory-revisions-with-ancestor is not treated as an
309 ;; ancestor metajob, since it behaves differently.
310 (defsubst ediff-ancestor-metajob (&optional metajob)
311 (memq (or metajob ediff-metajob-name)
312 '(ediff-merge-directories-with-ancestor
313 ediff-merge-filegroups-with-ancestor)))
314 (defsubst ediff-revision-metajob (&optional metajob)
315 (memq (or metajob ediff-metajob-name)
316 '(ediff-directory-revisions
317 ediff-merge-directory-revisions
318 ediff-merge-directory-revisions-with-ancestor)))
319 (defsubst ediff-patch-metajob (&optional metajob)
320 (memq (or metajob ediff-metajob-name)
321 '(ediff-multifile-patch)))
322 ;; metajob involving only one group of files, such as multipatch or directory
324 (defsubst ediff-one-filegroup-metajob (&optional metajob)
325 (or (ediff-revision-metajob metajob)
326 (ediff-patch-metajob metajob)
329 ;; jobs suitable for the operation of collecting diffs into a multifile patch
330 (defsubst ediff-collect-diffs-metajob (&optional metajob)
331 (memq (or metajob ediff-metajob-name)
333 ediff-merge-directories
334 ediff-merge-directories-with-ancestor
335 ediff-directory-revisions
336 ediff-merge-directory-revisions
337 ediff-merge-directory-revisions-with-ancestor
340 (defsubst ediff-merge-metajob (&optional metajob)
341 (memq (or metajob ediff-metajob-name)
342 '(ediff-merge-directories
343 ediff-merge-directories-with-ancestor
344 ediff-merge-directory-revisions
345 ediff-merge-directory-revisions-with-ancestor
346 ediff-merge-filegroups-with-ancestor
350 (defsubst ediff-metajob3 (&optional metajob)
351 (memq (or metajob ediff-metajob-name)
352 '(ediff-merge-directories-with-ancestor
353 ediff-merge-filegroups-with-ancestor
356 (defsubst ediff-comparison-metajob3 (&optional metajob)
357 (memq (or metajob ediff-metajob-name)
358 '(ediff-directories3 ediff-filegroups3)))
360 ;; with no argument, checks if we are in ediff-control-buffer
361 ;; with argument, checks if we are in ediff-meta-buffer
362 (defun ediff-in-control-buffer-p (&optional meta-buf-p)
363 (and (boundp 'ediff-control-buffer)
364 (eq (if meta-buf-p ediff-meta-buffer ediff-control-buffer)
367 (defsubst ediff-barf-if-not-control-buffer (&optional meta-buf-p)
368 (or (ediff-in-control-buffer-p meta-buf-p)
369 (error "%S: This command runs in Ediff Control Buffer only!"
372 (defgroup ediff-highlighting nil
373 "Highlighting of difference regions in Ediff."
377 (defgroup ediff-merge nil
382 (defgroup ediff-hook nil
383 "Hooks run by Ediff."
389 (defcustom ediff-before-setup-hook nil
390 "Hooks to run before Ediff begins to set up windows and buffers.
391 This hook can be used to save the previous window config, which can be restored
392 on ediff-quit or ediff-suspend."
395 (defcustom ediff-before-setup-windows-hook nil
396 "Hooks to run before Ediff sets its window configuration.
397 This hook is run every time when Ediff arranges its windows.
398 This happens each time Ediff detects that the windows were messed up by the
402 (defcustom ediff-after-setup-windows-hook nil
403 "Hooks to run after Ediff sets its window configuration.
404 This can be used to set up control window or icon in a desired place."
407 (defcustom ediff-before-setup-control-frame-hook nil
408 "Hooks run before setting up the frame to display Ediff Control Panel.
409 Can be used to change control frame parameters to position it where it
413 (defcustom ediff-after-setup-control-frame-hook nil
414 "Hooks run after setting up the frame to display Ediff Control Panel.
415 Can be used to move the frame where it is desired."
418 (defcustom ediff-startup-hook nil
419 "Hooks to run in the control buffer after Ediff has been set up and is ready for the job."
422 (defcustom ediff-select-hook nil
423 "Hooks to run after a difference has been selected."
426 (defcustom ediff-unselect-hook nil
427 "Hooks to run after a difference has been unselected."
430 (defcustom ediff-prepare-buffer-hook nil
431 "Hooks run after buffers A, B, and C are set up.
432 For each buffer, the hooks are run with that buffer made current."
435 (defcustom ediff-load-hook nil
436 "Hook run after Ediff is loaded. Can be used to change defaults."
440 (defcustom ediff-mode-hook nil
441 "Hook run just after ediff-mode is set up in the control buffer.
442 This is done before any windows or frames are created. One can use it to
443 set local variables that determine how the display looks like."
446 (defcustom ediff-keymap-setup-hook nil
447 "Hook run just after the default bindings in Ediff keymap are set up."
451 (defcustom ediff-display-help-hook nil
452 "Hooks run after preparing the help message."
456 (defcustom ediff-suspend-hook nil
457 "Hooks to run in the Ediff control buffer when Ediff is suspended."
460 (defcustom ediff-quit-hook nil
461 "Hooks to run in the Ediff control buffer after finishing Ediff."
464 (defcustom ediff-cleanup-hook nil
465 "Hooks to run on exiting Ediff but before killing the control and variant buffers."
470 (defconst ediff-KILLED-VITAL-BUFFER
471 "You have killed a vital Ediff buffer---you must leave Ediff now!")
472 (defconst ediff-NO-DIFFERENCES
473 "Sorry, comparison of identical variants is not what I am made for...")
474 (defconst ediff-BAD-DIFF-NUMBER
475 ;; %S stands for this-command, %d - diff number, %d - max diff
476 "%S: Bad diff region number, %d. Valid numbers are 1 to %d")
477 (defconst ediff-BAD-INFO (format "
478 *** The Info file for Ediff, a part of the standard distribution
479 *** of %sEmacs, does not seem to be properly installed.
481 *** Please contact your system administrator. "
482 (if (featurep 'xemacs) "X" "")))
484 ;; Selective browsing
486 (ediff-defvar-local ediff-skip-diff-region-function 'ediff-show-all-diffs
487 "Function that determines the next/previous diff region to show.
488 Should return t for regions to be ignored and nil otherwise.
489 This function gets a region number as an argument. The region number
490 is the one used internally by Ediff. It is 1 less than the number seen
493 (ediff-defvar-local ediff-hide-regexp-matches-function
494 'ediff-hide-regexp-matches
495 "Function to use in determining which regions to hide.
496 See the documentation string of `ediff-hide-regexp-matches' for details.")
497 (ediff-defvar-local ediff-focus-on-regexp-matches-function
498 'ediff-focus-on-regexp-matches
499 "Function to use in determining which regions to focus on.
500 See the documentation string of `ediff-focus-on-regexp-matches' for details.")
502 ;; Regexp that determines buf A regions to focus on when skipping to diff
503 (ediff-defvar-local ediff-regexp-focus-A "" "")
504 ;; Regexp that determines buf B regions to focus on when skipping to diff
505 (ediff-defvar-local ediff-regexp-focus-B "" "")
506 ;; Regexp that determines buf C regions to focus on when skipping to diff
507 (ediff-defvar-local ediff-regexp-focus-C "" "")
508 ;; connective that determines whether to focus regions that match both or
509 ;; one of the regexps
510 (ediff-defvar-local ediff-focus-regexp-connective 'and "")
512 ;; Regexp that determines buf A regions to ignore when skipping to diff
513 (ediff-defvar-local ediff-regexp-hide-A "" "")
514 ;; Regexp that determines buf B regions to ignore when skipping to diff
515 (ediff-defvar-local ediff-regexp-hide-B "" "")
516 ;; Regexp that determines buf C regions to ignore when skipping to diff
517 (ediff-defvar-local ediff-regexp-hide-C "" "")
518 ;; connective that determines whether to hide regions that match both or
519 ;; one of the regexps
520 (ediff-defvar-local ediff-hide-regexp-connective 'and "")
523 ;;; Copying difference regions between buffers.
525 ;; A list of killed diffs.
526 ;; A diff is saved here if it is replaced by a diff
527 ;; from another buffer. This alist has the form:
528 ;; \((num (buff-object . diff) (buff-object . diff) (buff-object . diff)) ...),
529 ;; where some buffer-objects may be missing.
530 (ediff-defvar-local ediff-killed-diffs-alist nil "")
532 ;; Syntax table to use in ediff-forward-word-function
533 ;; This is chosen by a heuristic. The important thing is for all buffers to
534 ;; have the same syntax table. Which is not too important.
535 (ediff-defvar-local ediff-syntax-table nil "")
539 (defcustom ediff-before-flag-bol (if (featurep 'xemacs) (make-glyph "->>") "->>")
540 "Flag placed before a highlighted block of differences, if block starts at beginning of a line."
542 :tag "Region before-flag at beginning of line"
545 (defcustom ediff-after-flag-eol (if (featurep 'xemacs) (make-glyph "<<-") "<<-")
546 "Flag placed after a highlighted block of differences, if block ends at end of a line."
548 :tag "Region after-flag at end of line"
551 (defcustom ediff-before-flag-mol (if (featurep 'xemacs) (make-glyph "->>") "->>")
552 "Flag placed before a highlighted block of differences, if block starts in mid-line."
554 :tag "Region before-flag in the middle of line"
556 (defcustom ediff-after-flag-mol (if (featurep 'xemacs) (make-glyph "<<-") "<<-")
557 "Flag placed after a highlighted block of differences, if block ends in mid-line."
559 :tag "Region after-flag in the middle of line"
563 (defcustom ediff-use-faces t
564 "If t, differences are highlighted using faces, if device supports faces.
565 If nil, differences are highlighted using ASCII flags, ediff-before-flag
566 and ediff-after-flag. On a non-window system, differences are always
567 highlighted using ASCII flags."
569 :group 'ediff-highlighting)
570 (make-variable-buffer-local 'ediff-use-faces)
571 (put 'ediff-use-faces 'permanent-local t)
573 ;; this indicates that diff regions are word-size, so fine diffs are
574 ;; permanently nixed; used in ediff-windows-wordwise and ediff-regions-wordwise
575 (ediff-defvar-local ediff-word-mode nil "")
576 ;; Name of the job (ediff-files, ediff-windows, etc.)
577 (ediff-defvar-local ediff-job-name nil "")
579 ;; Narrowing and ediff-region/windows support
580 ;; This is a list (overlay-A overlay-B overlay-C)
581 ;; If set, Ediff compares only those parts of buffers A/B/C that lie within
582 ;; the bounds of these overlays.
583 (ediff-defvar-local ediff-narrow-bounds nil "")
585 ;; List (overlay-A overlay-B overlay-C), where each overlay spans the
586 ;; entire corresponding buffer.
587 (ediff-defvar-local ediff-wide-bounds nil "")
589 ;; Current visibility boundaries in buffers A, B, and C.
590 ;; This is also a list of overlays. When the user toggles narrow/widen,
591 ;; this list changes from ediff-wide-bounds to ediff-narrow-bounds.
593 (ediff-defvar-local ediff-visible-bounds nil "")
595 (ediff-defvar-local ediff-start-narrowed t
596 "Non-nil means start narrowed, if doing ediff-windows-* or ediff-regions-*")
597 (ediff-defvar-local ediff-quit-widened t
598 "Non-nil means: when finished, Ediff widens buffers A/B.
599 Actually, Ediff restores the scope of visibility that existed at startup.")
601 (defcustom ediff-keep-variants t
602 "nil means prompt to remove unmodified buffers A/B/C at session end.
603 Supplying a prefix argument to the quit command `q' temporarily reverses the
604 meaning of this variable."
608 (defcustom ediff-highlight-all-diffs t
609 "If nil, only the selected differences are highlighted.
610 Otherwise, all difference regions are highlighted, but the selected region is
611 shown in brighter colors."
613 :group 'ediff-highlighting)
614 (make-variable-buffer-local 'ediff-highlight-all-diffs)
615 (put 'ediff-highlight-all-diffs 'permanent-local t)
618 ;; The suffix of the control buffer name.
619 (ediff-defvar-local ediff-control-buffer-suffix nil "")
620 ;; Same as ediff-control-buffer-suffix, but without <,>.
621 ;; It's a number rather than string.
622 (ediff-defvar-local ediff-control-buffer-number nil "")
625 ;; The original values of ediff-protected-variables for buffer A
626 (ediff-defvar-local ediff-buffer-values-orig-A nil "")
627 ;; The original values of ediff-protected-variables for buffer B
628 (ediff-defvar-local ediff-buffer-values-orig-B nil "")
629 ;; The original values of ediff-protected-variables for buffer C
630 (ediff-defvar-local ediff-buffer-values-orig-C nil "")
631 ;; The original values of ediff-protected-variables for buffer Ancestor
632 (ediff-defvar-local ediff-buffer-values-orig-Ancestor nil "")
634 ;; association between buff-type and ediff-buffer-values-orig-*
635 (defconst ediff-buffer-values-orig-alist
636 '((A . ediff-buffer-values-orig-A)
637 (B . ediff-buffer-values-orig-B)
638 (C . ediff-buffer-values-orig-C)
639 (Ancestor . ediff-buffer-values-orig-Ancestor)))
641 ;; Buffer-local variables to be saved then restored during Ediff sessions
642 (defconst ediff-protected-variables '(
646 ;; Vector of differences between the variants. Each difference is
647 ;; represented by a vector of two overlays plus a vector of fine diffs,
648 ;; plus a no-fine-diffs flag. The first overlay spans the
649 ;; difference region in the A buffer and the second overlays the diff in
650 ;; the B buffer. If a difference section is empty, the corresponding
651 ;; overlay's endpoints coincide.
653 ;; The precise form of a Difference Vector for one buffer is:
654 ;; [diff diff diff ...]
655 ;; where each diff has the form:
656 ;; [diff-overlay fine-diff-vector no-fine-diffs-flag state-of-diff]
657 ;; fine-diff-vector is a vector [fine-diff-overlay fine-diff-overlay ...]
658 ;; no-fine-diffs-flag says if there are fine differences.
659 ;; state-of-difference is A, B, C, or nil, indicating which buffer is
660 ;; different from the other two (used only in 3-way jobs.
661 (ediff-defvar-local ediff-difference-vector-A nil "")
662 (ediff-defvar-local ediff-difference-vector-B nil "")
663 (ediff-defvar-local ediff-difference-vector-C nil "")
664 (ediff-defvar-local ediff-difference-vector-Ancestor nil "")
665 ;; A-list of diff vector types associated with buffer types
666 (defconst ediff-difference-vector-alist
667 '((A . ediff-difference-vector-A)
668 (B . ediff-difference-vector-B)
669 (C . ediff-difference-vector-C)
670 (Ancestor . ediff-difference-vector-Ancestor)))
672 ;; [ status status status ...]
673 ;; Each status: [state-of-merge state-of-ancestor]
674 ;; state-of-merge is default-A, default-B, prefer-A, or prefer-B. It
675 ;; indicates the way a diff region was created in buffer C.
676 ;; state-of-ancestor says if the corresponding region in ancestor buffer is
678 (ediff-defvar-local ediff-state-of-merge nil "")
680 ;; The difference that is currently selected.
681 (ediff-defvar-local ediff-current-difference -1 "")
682 ;; Number of differences found.
683 (ediff-defvar-local ediff-number-of-differences nil "")
685 ;; Buffer containing the output of diff, which is used by Ediff to step
687 (ediff-defvar-local ediff-diff-buffer nil "")
688 ;; Like ediff-diff-buffer, but contains context diff. It is not used by
689 ;; Ediff, but it is saved in a file, if user requests so.
690 (ediff-defvar-local ediff-custom-diff-buffer nil "")
691 ;; Buffer used for diff-style fine differences between regions.
692 (ediff-defvar-local ediff-fine-diff-buffer nil "")
693 ;; Temporary buffer used for computing fine differences.
694 (defconst ediff-tmp-buffer " *ediff-tmp*" "")
695 ;; Buffer used for messages
696 (defconst ediff-msg-buffer " *ediff-message*" "")
697 ;; Buffer containing the output of diff when diff returns errors.
698 (ediff-defvar-local ediff-error-buffer nil "")
699 ;; Buffer to display debug info
700 (ediff-defvar-local ediff-debug-buffer "*ediff-debug*" "")
702 ;; List of ediff control panels associated with each buffer A/B/C/Ancestor.
703 ;; Not used any more, but may be needed in the future.
704 (ediff-defvar-local ediff-this-buffer-ediff-sessions nil "")
706 ;; to be deleted in due time
707 ;; List of difference overlays disturbed by working with the current diff.
708 (defvar ediff-disturbed-overlays nil "")
710 (defcustom ediff-version-control-package 'vc
711 "Version control package used.
712 Currently, Ediff supports vc.el, rcs.el, pcl-cvs.el, and generic-sc.el. The
713 standard Emacs interface to RCS, CVS, SCCS, etc., is vc.el. However, some
714 people find the other two packages more convenient. Set this variable to the
715 appropriate symbol: `rcs', `pcl-cvs', or `generic-sc' if you so desire."
719 (defcustom ediff-coding-system-for-read 'raw-text
720 "The coding system for read to use when running the diff program as a subprocess.
721 In most cases, the default will do. However, under certain circumstances in
722 MS-Windows you might need to use something like 'raw-text-dos here.
723 So, if the output that your diff program sends to Emacs contains extra ^M's,
724 you might need to experiment here, if the default or 'raw-text-dos doesn't
729 (defcustom ediff-coding-system-for-write (if (featurep 'xemacs)
732 "The coding system for write to use when writing out difference regions
733 to temp files in buffer jobs and when Ediff needs to find fine differences."
738 (defalias 'ediff-read-event
739 (if (featurep 'xemacs) 'next-command-event 'read-event))
741 (defalias 'ediff-overlayp
742 (if (featurep 'xemacs) 'extentp 'overlayp))
744 (defalias 'ediff-make-overlay
745 (if (featurep 'xemacs) 'make-extent 'make-overlay))
747 (defalias 'ediff-delete-overlay
748 (if (featurep 'xemacs) 'delete-extent 'delete-overlay))
750 ;; Assumes that emacs-major-version and emacs-minor-version are defined.
751 (defun ediff-check-version (op major minor &optional type-of-emacs)
752 "Check the current version against MAJOR and MINOR version numbers.
753 The comparison uses operator OP, which may be any of: =, >, >=, <, <=.
754 TYPE-OF-EMACS is either 'xemacs or 'emacs."
755 (declare (obsolete version< "23.1"))
756 (and (cond ((eq type-of-emacs 'xemacs) (featurep 'xemacs))
757 ((eq type-of-emacs 'emacs) (featurep 'emacs))
759 (cond ((eq op '=) (and (= emacs-minor-version minor)
760 (= emacs-major-version major)))
761 ((memq op '(> >= < <=))
762 (and (or (funcall op emacs-major-version major)
763 (= emacs-major-version major))
764 (if (= emacs-major-version major)
765 (funcall op emacs-minor-version minor)
768 (error "%S: Invalid op in ediff-check-version" op)))))
770 (defun ediff-color-display-p ()
772 (if (featurep 'xemacs)
773 (eq (device-class (selected-device)) 'color) ; xemacs form
774 (display-color-p)) ; emacs form
778 ;; A var local to each control panel buffer. Indicates highlighting style
779 ;; in effect for this buffer: `face', `ascii',
780 ;; `off' -- turned off \(on a dumb terminal only\).
781 (ediff-defvar-local ediff-highlighting-style
782 (if (and (ediff-has-face-support-p) ediff-use-faces) 'face 'ascii)
786 (if (featurep 'xemacs)
788 (defalias 'ediff-display-pixel-width 'device-pixel-width)
789 (defalias 'ediff-display-pixel-height 'device-pixel-height))
790 (defalias 'ediff-display-pixel-width 'display-pixel-width)
791 (defalias 'ediff-display-pixel-height 'display-pixel-height))
793 ;; A-list of current-diff-overlay symbols associated with buf types
794 (defconst ediff-current-diff-overlay-alist
795 '((A . ediff-current-diff-overlay-A)
796 (B . ediff-current-diff-overlay-B)
797 (C . ediff-current-diff-overlay-C)
798 (Ancestor . ediff-current-diff-overlay-Ancestor)))
800 ;; A-list of current-diff-face-* symbols associated with buf types
801 (defconst ediff-current-diff-face-alist
802 '((A . ediff-current-diff-A)
803 (B . ediff-current-diff-B)
804 (C . ediff-current-diff-C)
805 (Ancestor . ediff-current-diff-Ancestor)))
808 (defun ediff-set-overlay-face (extent face)
809 (ediff-overlay-put extent 'face face)
810 (ediff-overlay-put extent 'help-echo (if face 'ediff-region-help-echo)))
812 (defun ediff-region-help-echo (extent-or-window &optional overlay _point)
814 (setq overlay extent-or-window))
815 (let ((is-current (ediff-overlay-get overlay 'ediff))
816 (face (ediff-overlay-get overlay 'face))
817 (diff-num (ediff-overlay-get overlay 'ediff-diff-num))
820 ;; This happens only for refinement overlays
822 (setq face (intern face)))
823 (setq face-help (and face (get face 'ediff-help-echo)))
825 (cond ((and is-current diff-num) ; current diff region
826 (format "Difference region %S -- current" (1+ diff-num)))
827 (face-help) ; refinement of current diff region
828 (diff-num ; non-current
829 (format "Difference region %S -- non-current" (1+ diff-num)))
834 (defun ediff-set-face-pixmap (face pixmap)
835 "Set face pixmap on a monochrome display."
836 (if (and (ediff-window-display-p) (not (ediff-color-display-p)))
838 (set-face-background-pixmap face pixmap)
840 (message "Pixmap not found for %S: %s" (face-name face) pixmap)
843 (defun ediff-hide-face (face)
844 (if (and (ediff-has-face-support-p)
845 (boundp 'add-to-list)
846 (boundp 'facemenu-unlisted-faces))
847 (add-to-list 'facemenu-unlisted-faces face)))
851 (defface ediff-current-diff-A
852 (if (featurep 'emacs)
853 '((((class color) (min-colors 88) (background light))
854 :background "#ffdddd")
855 (((class color) (min-colors 88) (background dark))
856 :background "#553333")
857 (((class color) (min-colors 16))
858 (:foreground "firebrick" :background "pale green"))
860 (:foreground "blue3" :background "yellow3"))
861 (t (:inverse-video t)))
862 '((((type tty)) (:foreground "blue3" :background "yellow3"))
863 (((class color)) (:foreground "firebrick" :background "pale green"))
864 (t (:inverse-video t))))
865 "Face for highlighting the selected difference in buffer A."
866 :group 'ediff-highlighting)
867 ;; An internal variable. Ediff takes the face from here. When unhighlighting,
868 ;; this variable is set to nil, then again to the appropriate face.
869 (defvar ediff-current-diff-face-A 'ediff-current-diff-A
870 "Face for highlighting the selected difference in buffer A.
871 DO NOT CHANGE this variable. Instead, use the customization
872 widget to customize the actual face object `ediff-current-diff-A'
873 this variable represents.")
874 (ediff-hide-face ediff-current-diff-face-A)
875 ;; Until custom.el for XEmacs starts supporting :inverse-video we do this.
876 ;; This means that some user customization may be trashed.
877 (and (featurep 'xemacs)
878 (ediff-has-face-support-p)
879 (not (ediff-color-display-p))
880 (copy-face 'modeline ediff-current-diff-face-A))
884 (defface ediff-current-diff-B
885 (if (featurep 'emacs)
886 '((((class color) (min-colors 88) (background light))
887 :background "#ddffdd")
888 (((class color) (min-colors 88) (background dark))
889 :background "#335533")
890 (((class color) (min-colors 16))
891 (:foreground "DarkOrchid" :background "Yellow"))
893 (:foreground "magenta3" :background "yellow3"
895 (t (:inverse-video t)))
896 '((((type tty)) (:foreground "magenta3" :background "yellow3"
898 (((class color)) (:foreground "DarkOrchid" :background "Yellow"))
899 (t (:inverse-video t))))
900 "Face for highlighting the selected difference in buffer B."
901 :group 'ediff-highlighting)
902 ;; An internal variable. Ediff takes the face from here. When unhighlighting,
903 ;; this variable is set to nil, then again to the appropriate face.
904 (defvar ediff-current-diff-face-B 'ediff-current-diff-B
905 "Face for highlighting the selected difference in buffer B.
906 this variable. Instead, use the customization
907 widget to customize the actual face `ediff-current-diff-B'
908 this variable represents.")
909 (ediff-hide-face ediff-current-diff-face-B)
910 ;; Until custom.el for XEmacs starts supporting :inverse-video we do this.
911 ;; This means that some user customization may be trashed.
912 (and (featurep 'xemacs)
913 (ediff-has-face-support-p)
914 (not (ediff-color-display-p))
915 (copy-face 'modeline ediff-current-diff-face-B))
918 (defface ediff-current-diff-C
919 (if (featurep 'emacs)
920 '((((class color) (min-colors 88) (background light))
921 :background "#ffffaa")
922 (((class color) (min-colors 88) (background dark))
923 :background "#888833")
924 (((class color) (min-colors 16))
925 (:foreground "Navy" :background "Pink"))
927 (:foreground "cyan3" :background "yellow3" :weight bold))
928 (t (:inverse-video t)))
929 '((((type tty)) (:foreground "cyan3" :background "yellow3" :weight bold))
930 (((class color)) (:foreground "Navy" :background "Pink"))
931 (t (:inverse-video t))))
932 "Face for highlighting the selected difference in buffer C."
933 :group 'ediff-highlighting)
934 ;; An internal variable. Ediff takes the face from here. When unhighlighting,
935 ;; this variable is set to nil, then again to the appropriate face.
936 (defvar ediff-current-diff-face-C 'ediff-current-diff-C
937 "Face for highlighting the selected difference in buffer C.
938 DO NOT CHANGE this variable. Instead, use the customization
939 widget to customize the actual face object `ediff-current-diff-C'
940 this variable represents.")
941 (ediff-hide-face ediff-current-diff-face-C)
942 ;; Until custom.el for XEmacs starts supporting :inverse-video we do this.
943 ;; This means that some user customization may be trashed.
944 (and (featurep 'xemacs)
945 (ediff-has-face-support-p)
946 (not (ediff-color-display-p))
947 (copy-face 'modeline ediff-current-diff-face-C))
950 (defface ediff-current-diff-Ancestor
951 (if (featurep 'emacs)
952 '((((class color) (min-colors 16))
953 (:foreground "Black" :background "VioletRed"))
955 (:foreground "black" :background "magenta3"))
956 (t (:inverse-video t)))
957 '((((type tty)) (:foreground "black" :background "magenta3"))
958 (((class color)) (:foreground "Black" :background "VioletRed"))
959 (t (:inverse-video t))))
960 "Face for highlighting the selected difference in buffer Ancestor."
961 :group 'ediff-highlighting)
962 ;; An internal variable. Ediff takes the face from here. When unhighlighting,
963 ;; this variable is set to nil, then again to the appropriate face.
964 (defvar ediff-current-diff-face-Ancestor 'ediff-current-diff-Ancestor
965 "Face for highlighting the selected difference in buffer Ancestor.
966 DO NOT CHANGE this variable. Instead, use the customization
967 widget to customize the actual face object `ediff-current-diff-Ancestor'
968 this variable represents.")
969 (ediff-hide-face ediff-current-diff-face-Ancestor)
970 ;; Until custom.el for XEmacs starts supporting :inverse-video we do this.
971 ;; This means that some user customization may be trashed.
972 (and (featurep 'xemacs)
973 (ediff-has-face-support-p)
974 (not (ediff-color-display-p))
975 (copy-face 'modeline ediff-current-diff-face-Ancestor))
978 (defface ediff-fine-diff-A
979 (if (featurep 'emacs)
980 '((((class color) (min-colors 88) (background light))
981 :background "#ffbbbb")
982 (((class color) (min-colors 88) (background dark))
983 :background "#aa2222")
984 (((class color) (min-colors 16))
985 (:foreground "Navy" :background "sky blue"))
987 (:foreground "white" :background "sky blue" :weight bold))
988 (t (:underline t :stipple "gray3")))
989 '((((type tty)) (:foreground "white" :background "sky blue" :weight bold))
990 (((class color)) (:foreground "Navy" :background "sky blue"))
991 (t (:underline t :stipple "gray3"))))
992 "Face for highlighting the refinement of the selected diff in buffer A."
993 :group 'ediff-highlighting)
994 ;; An internal variable. Ediff takes the face from here. When unhighlighting,
995 ;; this variable is set to nil, then again to the appropriate face.
996 (defvar ediff-fine-diff-face-A 'ediff-fine-diff-A
997 "Face for highlighting the fine differences in buffer A.
998 DO NOT CHANGE this variable. Instead, use the customization
999 widget to customize the actual face object `ediff-fine-diff-A'
1000 this variable represents.")
1001 (ediff-hide-face ediff-fine-diff-face-A)
1003 (defface ediff-fine-diff-B
1004 (if (featurep 'emacs)
1005 '((((class color) (min-colors 88) (background light))
1006 :background "#aaffaa")
1007 (((class color) (min-colors 88) (background dark))
1008 :background "#22aa22")
1009 (((class color) (min-colors 16))
1010 (:foreground "Black" :background "cyan"))
1012 (:foreground "magenta3" :background "cyan3"))
1013 (t (:underline t :stipple "gray3")))
1014 '((((type tty)) (:foreground "magenta3" :background "cyan3"))
1015 (((class color)) (:foreground "Black" :background "cyan"))
1016 (t (:underline t :stipple "gray3"))))
1017 "Face for highlighting the refinement of the selected diff in buffer B."
1018 :group 'ediff-highlighting)
1019 ;; An internal variable. Ediff takes the face from here. When unhighlighting,
1020 ;; this variable is set to nil, then again to the appropriate face.
1021 (defvar ediff-fine-diff-face-B 'ediff-fine-diff-B
1022 "Face for highlighting the fine differences in buffer B.
1023 DO NOT CHANGE this variable. Instead, use the customization
1024 widget to customize the actual face object `ediff-fine-diff-B'
1025 this variable represents.")
1026 (ediff-hide-face ediff-fine-diff-face-B)
1028 (defface ediff-fine-diff-C
1029 (if (featurep 'emacs)
1030 '((((class color) (min-colors 88) (background light))
1031 :background "#ffff55")
1032 (((class color) (min-colors 88) (background dark))
1033 :background "#aaaa22")
1035 (:foreground "white" :background "Turquoise"))
1036 (((class color) (min-colors 16))
1037 (:foreground "Black" :background "Turquoise"))
1039 (:foreground "yellow3" :background "Turquoise"
1041 (t (:underline t :stipple "gray3")))
1042 '((((type tty)) (:foreground "yellow3" :background "Turquoise"
1044 (((type pc)) (:foreground "white" :background "Turquoise"))
1045 (((class color)) (:foreground "Black" :background "Turquoise"))
1046 (t (:underline t :stipple "gray3"))))
1047 "Face for highlighting the refinement of the selected diff in buffer C."
1048 :group 'ediff-highlighting)
1049 ;; An internal variable. Ediff takes the face from here. When unhighlighting,
1050 ;; this variable is set to nil, then again to the appropriate face.
1051 (defvar ediff-fine-diff-face-C 'ediff-fine-diff-C
1052 "Face for highlighting the fine differences in buffer C.
1053 DO NOT CHANGE this variable. Instead, use the customization
1054 widget to customize the actual face object `ediff-fine-diff-C'
1055 this variable represents.")
1056 (ediff-hide-face ediff-fine-diff-face-C)
1058 (defface ediff-fine-diff-Ancestor
1059 (if (featurep 'emacs)
1060 '((((class color) (min-colors 16))
1061 (:foreground "Black" :background "Green"))
1063 (:foreground "red3" :background "green"))
1064 (t (:underline t :stipple "gray3")))
1065 '((((type tty)) (:foreground "red3" :background "green"))
1066 (((class color)) (:foreground "Black" :background "Green"))
1067 (t (:underline t :stipple "gray3"))))
1068 "Face for highlighting the refinement of the selected diff in the ancestor buffer.
1069 At present, this face is not used and no fine differences are computed for the
1071 :group 'ediff-highlighting)
1072 ;; An internal variable. Ediff takes the face from here. When unhighlighting,
1073 ;; this variable is set to nil, then again to the appropriate face.
1074 (defvar ediff-fine-diff-face-Ancestor 'ediff-fine-diff-Ancestor
1075 "Face for highlighting the fine differences in buffer Ancestor.
1076 DO NOT CHANGE this variable. Instead, use the customization
1077 widget to customize the actual face object `ediff-fine-diff-Ancestor'
1078 this variable represents.")
1079 (ediff-hide-face ediff-fine-diff-face-Ancestor)
1081 ;; Some installs don't have stipple or Stipple. So, try them in turn.
1082 (defvar stipple-pixmap
1083 (cond ((not (ediff-has-face-support-p)) nil)
1084 ((and (boundp 'x-bitmap-file-path)
1085 (locate-library "stipple" t x-bitmap-file-path)) "stipple")
1086 ((and (boundp 'mswindowsx-bitmap-file-path)
1087 (locate-library "stipple" t mswindowsx-bitmap-file-path)) "stipple")
1090 (defface ediff-even-diff-A
1091 (if (featurep 'emacs)
1093 (:foreground "green3" :background "light grey"))
1094 (((class color) (min-colors 16))
1095 (:foreground "Black" :background "light grey"))
1097 (:foreground "red3" :background "light grey"
1099 (t (:italic t :stipple ,stipple-pixmap)))
1100 `((((type tty)) (:foreground "red3" :background "light grey"
1102 (((type pc)) (:foreground "green3" :background "light grey"))
1103 (((class color)) (:foreground "Black" :background "light grey"))
1104 (t (:italic t :stipple ,stipple-pixmap))))
1105 "Face for highlighting even-numbered non-current differences in buffer A."
1106 :group 'ediff-highlighting)
1107 ;; An internal variable. Ediff takes the face from here. When unhighlighting,
1108 ;; this variable is set to nil, then again to the appropriate face.
1109 (defvar ediff-even-diff-face-A 'ediff-even-diff-A
1110 "Face for highlighting even-numbered non-current differences in buffer A.
1111 DO NOT CHANGE this variable. Instead, use the customization
1112 widget to customize the actual face object `ediff-even-diff-A'
1113 this variable represents.")
1114 (ediff-hide-face ediff-even-diff-face-A)
1116 (defface ediff-even-diff-B
1117 (if (featurep 'emacs)
1118 `((((class color) (min-colors 16))
1119 (:foreground "White" :background "Grey"))
1121 (:foreground "blue3" :background "Grey" :weight bold))
1122 (t (:italic t :stipple ,stipple-pixmap)))
1123 `((((type tty)) (:foreground "blue3" :background "Grey" :weight bold))
1124 (((class color)) (:foreground "White" :background "Grey"))
1125 (t (:italic t :stipple ,stipple-pixmap))))
1126 "Face for highlighting even-numbered non-current differences in buffer B."
1127 :group 'ediff-highlighting)
1128 ;; An internal variable. Ediff takes the face from here. When unhighlighting,
1129 ;; this variable is set to nil, then again to the appropriate face.
1130 (defvar ediff-even-diff-face-B 'ediff-even-diff-B
1131 "Face for highlighting even-numbered non-current differences in buffer B.
1132 DO NOT CHANGE this variable. Instead, use the customization
1133 widget to customize the actual face object `ediff-even-diff-B'
1134 this variable represents.")
1135 (ediff-hide-face ediff-even-diff-face-B)
1137 (defface ediff-even-diff-C
1138 (if (featurep 'emacs)
1140 (:foreground "yellow3" :background "light grey"))
1141 (((class color) (min-colors 16))
1142 (:foreground "Black" :background "light grey"))
1144 (:foreground "yellow3" :background "light grey"
1146 (t (:italic t :stipple ,stipple-pixmap)))
1147 `((((type tty)) (:foreground "yellow3" :background "light grey"
1149 (((type pc)) (:foreground "yellow3" :background "light grey"))
1150 (((class color)) (:foreground "Black" :background "light grey"))
1151 (t (:italic t :stipple ,stipple-pixmap))))
1152 "Face for highlighting even-numbered non-current differences in buffer C."
1153 :group 'ediff-highlighting)
1154 ;; An internal variable. Ediff takes the face from here. When unhighlighting,
1155 ;; this variable is set to nil, then again to the appropriate face.
1156 (defvar ediff-even-diff-face-C 'ediff-even-diff-C
1157 "Face for highlighting even-numbered non-current differences in buffer C.
1158 DO NOT CHANGE this variable. Instead, use the customization
1159 widget to customize the actual face object `ediff-even-diff-C'
1160 this variable represents.")
1161 (ediff-hide-face ediff-even-diff-face-C)
1163 (defface ediff-even-diff-Ancestor
1164 (if (featurep 'emacs)
1166 (:foreground "cyan3" :background "light grey"))
1167 (((class color) (min-colors 16))
1168 (:foreground "White" :background "Grey"))
1170 (:foreground "cyan3" :background "light grey"
1172 (t (:italic t :stipple ,stipple-pixmap)))
1173 `((((type tty)) (:foreground "cyan3" :background "light grey"
1175 (((type pc)) (:foreground "cyan3" :background "light grey"))
1176 (((class color)) (:foreground "White" :background "Grey"))
1177 (t (:italic t :stipple ,stipple-pixmap))))
1178 "Face for highlighting even-numbered non-current differences in the ancestor buffer."
1179 :group 'ediff-highlighting)
1180 ;; An internal variable. Ediff takes the face from here. When unhighlighting,
1181 ;; this variable is set to nil, then again to the appropriate face.
1182 (defvar ediff-even-diff-face-Ancestor 'ediff-even-diff-Ancestor
1183 "Face for highlighting even-numbered non-current differences in buffer Ancestor.
1184 DO NOT CHANGE this variable. Instead, use the customization
1185 widget to customize the actual face object `ediff-even-diff-Ancestor'
1186 this variable represents.")
1187 (ediff-hide-face ediff-even-diff-face-Ancestor)
1189 ;; Association between buffer types and even-diff-face symbols
1190 (defconst ediff-even-diff-face-alist
1191 '((A . ediff-even-diff-A)
1192 (B . ediff-even-diff-B)
1193 (C . ediff-even-diff-C)
1194 (Ancestor . ediff-even-diff-Ancestor)))
1196 (defface ediff-odd-diff-A
1197 (if (featurep 'emacs)
1199 (:foreground "green3" :background "gray40"))
1200 (((class color) (min-colors 16))
1201 (:foreground "White" :background "Grey"))
1203 (:foreground "red3" :background "black" :weight bold))
1204 (t (:italic t :stipple "gray1")))
1205 '((((type tty)) (:foreground "red3" :background "black" :weight bold))
1206 (((type pc)) (:foreground "green3" :background "gray40"))
1207 (((class color)) (:foreground "White" :background "Grey"))
1208 (t (:italic t :stipple "gray1"))))
1209 "Face for highlighting odd-numbered non-current differences in buffer A."
1210 :group 'ediff-highlighting)
1211 ;; An internal variable. Ediff takes the face from here. When unhighlighting,
1212 ;; this variable is set to nil, then again to the appropriate face.
1213 (defvar ediff-odd-diff-face-A 'ediff-odd-diff-A
1214 "Face for highlighting odd-numbered non-current differences in buffer A.
1215 DO NOT CHANGE this variable. Instead, use the customization
1216 widget to customize the actual face object `ediff-odd-diff-A'
1217 this variable represents.")
1218 (ediff-hide-face ediff-odd-diff-face-A)
1221 (defface ediff-odd-diff-B
1222 (if (featurep 'emacs)
1224 (:foreground "White" :background "gray40"))
1225 (((class color) (min-colors 16))
1226 (:foreground "Black" :background "light grey"))
1228 (:foreground "cyan3" :background "black" :weight bold))
1229 (t (:italic t :stipple "gray1")))
1230 '((((type tty)) (:foreground "cyan3" :background "black" :weight bold))
1231 (((type pc)) (:foreground "White" :background "gray40"))
1232 (((class color)) (:foreground "Black" :background "light grey"))
1233 (t (:italic t :stipple "gray1"))))
1234 "Face for highlighting odd-numbered non-current differences in buffer B."
1235 :group 'ediff-highlighting)
1236 ;; An internal variable. Ediff takes the face from here. When unhighlighting,
1237 ;; this variable is set to nil, then again to the appropriate face.
1238 (defvar ediff-odd-diff-face-B 'ediff-odd-diff-B
1239 "Face for highlighting odd-numbered non-current differences in buffer B.
1240 DO NOT CHANGE this variable. Instead, use the customization
1241 widget to customize the actual face object `ediff-odd-diff-B'
1242 this variable represents.")
1243 (ediff-hide-face ediff-odd-diff-face-B)
1245 (defface ediff-odd-diff-C
1246 (if (featurep 'emacs)
1248 (:foreground "yellow3" :background "gray40"))
1249 (((class color) (min-colors 16))
1250 (:foreground "White" :background "Grey"))
1252 (:foreground "yellow3" :background "black" :weight bold))
1253 (t (:italic t :stipple "gray1")))
1254 '((((type tty)) (:foreground "yellow3" :background "black" :weight bold))
1255 (((type pc)) (:foreground "yellow3" :background "gray40"))
1256 (((class color)) (:foreground "White" :background "Grey"))
1257 (t (:italic t :stipple "gray1"))))
1258 "Face for highlighting odd-numbered non-current differences in buffer C."
1259 :group 'ediff-highlighting)
1260 ;; An internal variable. Ediff takes the face from here. When unhighlighting,
1261 ;; this variable is set to nil, then again to the appropriate face.
1262 (defvar ediff-odd-diff-face-C 'ediff-odd-diff-C
1263 "Face for highlighting odd-numbered non-current differences in buffer C.
1264 DO NOT CHANGE this variable. Instead, use the customization
1265 widget to customize the actual face object `ediff-odd-diff-C'
1266 this variable represents.")
1267 (ediff-hide-face ediff-odd-diff-face-C)
1269 (defface ediff-odd-diff-Ancestor
1270 (if (featurep 'emacs)
1271 '((((class color) (min-colors 16))
1272 (:foreground "cyan3" :background "gray40"))
1274 (:foreground "green3" :background "black" :weight bold))
1275 (t (:italic t :stipple "gray1")))
1276 '((((type tty)) (:foreground "green3" :background "black" :weight bold))
1277 (((class color)) (:foreground "cyan3" :background "gray40"))
1278 (t (:italic t :stipple "gray1"))))
1279 "Face for highlighting odd-numbered non-current differences in the ancestor buffer."
1280 :group 'ediff-highlighting)
1281 ;; An internal variable. Ediff takes the face from here. When unhighlighting,
1282 ;; this variable is set to nil, then again to the appropriate face.
1283 (defvar ediff-odd-diff-face-Ancestor 'ediff-odd-diff-Ancestor
1284 "Face for highlighting odd-numbered non-current differences in buffer Ancestor.
1285 DO NOT CHANGE this variable. Instead, use the customization
1286 widget to customize the actual face object `ediff-odd-diff-Ancestor'
1287 this variable represents.")
1288 (ediff-hide-face ediff-odd-diff-face-Ancestor)
1290 ;; Association between buffer types and odd-diff-face symbols
1291 (defconst ediff-odd-diff-face-alist
1292 '((A . ediff-odd-diff-A)
1293 (B . ediff-odd-diff-B)
1294 (C . ediff-odd-diff-C)
1295 (Ancestor . ediff-odd-diff-Ancestor)))
1297 ;; A-list of fine-diff face symbols associated with buffer types
1298 (defconst ediff-fine-diff-face-alist
1299 '((A . ediff-fine-diff-A)
1300 (B . ediff-fine-diff-B)
1301 (C . ediff-fine-diff-C)
1302 (Ancestor . ediff-fine-diff-Ancestor)))
1305 (put ediff-fine-diff-face-A 'ediff-help-echo
1306 "A `refinement' of the current difference region")
1307 (put ediff-fine-diff-face-B 'ediff-help-echo
1308 "A `refinement' of the current difference region")
1309 (put ediff-fine-diff-face-C 'ediff-help-echo
1310 "A `refinement' of the current difference region")
1311 (put ediff-fine-diff-face-Ancestor 'ediff-help-echo
1312 "A `refinement' of the current difference region")
1314 (add-hook 'ediff-quit-hook 'ediff-cleanup-mess)
1315 (add-hook 'ediff-suspend-hook 'ediff-default-suspend-function)
1320 (ediff-defvar-local ediff-current-diff-overlay-A nil
1321 "Overlay for the current difference region in buffer A.")
1322 (ediff-defvar-local ediff-current-diff-overlay-B nil
1323 "Overlay for the current difference region in buffer B.")
1324 (ediff-defvar-local ediff-current-diff-overlay-C nil
1325 "Overlay for the current difference region in buffer C.")
1326 (ediff-defvar-local ediff-current-diff-overlay-Ancestor nil
1327 "Overlay for the current difference region in the ancestor buffer.")
1329 (defvar ediff-toggle-read-only-function 'toggle-read-only
1330 "Function to be used to toggle read-only status of the buffer.
1331 If nil, Ediff tries using the command bound to C-x C-q.")
1333 (defcustom ediff-make-buffers-readonly-at-startup nil
1334 "Make all variant buffers read-only when Ediff starts up.
1335 This property can be toggled interactively."
1342 ;; if nil, this silences some messages
1343 (defvar ediff-verbose-p t)
1345 (defcustom ediff-autostore-merges 'group-jobs-only
1346 "Save the results of merge jobs automatically.
1347 With value nil, don't save automatically. With value t, always
1348 save. Anything else means save automatically only if the merge
1349 job is part of a group of jobs, such as `ediff-merge-directory'
1350 or `ediff-merge-directory-revisions'."
1351 :type '(choice (const nil) (const t) (const group-jobs-only))
1352 :group 'ediff-merge)
1353 (make-variable-buffer-local 'ediff-autostore-merges)
1355 ;; file where the result of the merge is to be saved. used internally
1356 (ediff-defvar-local ediff-merge-store-file nil "")
1358 (defcustom ediff-merge-filename-prefix "merge_"
1359 "Prefix to be attached to saved merge buffers."
1361 :group 'ediff-merge)
1363 (defcustom ediff-no-emacs-help-in-control-buffer nil
1364 "Non-nil means C-h should not invoke Emacs help in control buffer.
1365 Instead, C-h would jump to previous difference."
1369 ;; This is the same as temporary-file-directory from Emacs 20.3.
1370 ;; Copied over here because XEmacs doesn't have this variable.
1371 (defcustom ediff-temp-file-prefix
1372 (file-name-as-directory
1373 (cond ((boundp 'temporary-file-directory) temporary-file-directory)
1374 ((fboundp 'temp-directory) (temp-directory))
1376 ;;; (file-name-as-directory
1377 ;;; (cond ((memq system-type '(ms-dos windows-nt))
1378 ;;; (or (getenv "TEMP") (getenv "TMPDIR") (getenv "TMP") "c:/temp"))
1380 ;;; (or (getenv "TMPDIR") (getenv "TMP") (getenv "TEMP") "/tmp"))))
1381 "Prefix to put on Ediff temporary file names.
1382 Do not start with `~/' or `~USERNAME/'."
1386 (defcustom ediff-temp-file-mode 384 ; u=rw only
1387 "Mode for Ediff temporary files."
1391 ;; Metacharacters that have to be protected from the shell when executing
1392 ;; a diff/diff3 command.
1393 (defcustom ediff-metachars "[ \t\n!\"#$&'()*;<=>?[\\^`{|~]"
1394 "Regexp that matches characters that must be quoted with `\\' in shell command line.
1395 This default should work without changes."
1399 ;; needed to simulate frame-char-width in XEmacs.
1400 (defvar ediff-H-glyph (if (featurep 'xemacs) (make-glyph "H")))
1403 ;; Temporary file used for refining difference regions in buffer A.
1404 (ediff-defvar-local ediff-temp-file-A nil "")
1405 ;; Temporary file used for refining difference regions in buffer B.
1406 (ediff-defvar-local ediff-temp-file-B nil "")
1407 ;; Temporary file used for refining difference regions in buffer C.
1408 (ediff-defvar-local ediff-temp-file-C nil "")
1411 (defun ediff-file-remote-p (file-name)
1412 (file-remote-p file-name))
1414 ;; File for which we can get attributes, such as size or date
1415 (defun ediff-listable-file (file-name)
1416 (let ((handler (find-file-name-handler file-name 'file-local-copy)))
1417 (or (null handler) (eq handler 'dired-handler-fn))))
1420 (defsubst ediff-frame-unsplittable-p (frame)
1421 (cdr (assq 'unsplittable (frame-parameters frame))))
1423 (defsubst ediff-get-next-window (wind prev-wind)
1424 (cond ((window-live-p wind) wind)
1425 (prev-wind (next-window wind))
1426 (t (selected-window))
1430 (defsubst ediff-kill-buffer-carefully (buf)
1431 "Kill buffer BUF if it exists."
1432 (if (ediff-buffer-live-p buf)
1433 (kill-buffer (get-buffer buf))))
1435 (defsubst ediff-background-face (buf-type dif-num)
1436 ;; The value of dif-num is always 1- the one that user sees.
1437 ;; This is why even face is used when dif-num is odd.
1438 (ediff-get-symbol-from-alist
1439 buf-type (if (ediff-odd-p dif-num)
1440 ediff-even-diff-face-alist
1441 ediff-odd-diff-face-alist)
1445 ;; activate faces on diff regions in buffer
1446 (defun ediff-paint-background-regions-in-one-buffer (buf-type unhighlight)
1448 (eval (ediff-get-symbol-from-alist
1449 buf-type ediff-difference-vector-alist)))
1451 (mapcar (lambda (rec)
1452 (setq overl (ediff-get-diff-overlay-from-diff-record rec)
1453 diff-num (ediff-overlay-get overl 'ediff-diff-num))
1454 (if (ediff-overlay-buffer overl)
1455 ;; only if overlay is alive
1456 (ediff-set-overlay-face
1458 (if (not unhighlight)
1459 (ediff-background-face buf-type diff-num))))
1464 ;; activate faces on diff regions in all buffers
1465 (defun ediff-paint-background-regions (&optional unhighlight)
1466 (ediff-paint-background-regions-in-one-buffer
1468 (ediff-paint-background-regions-in-one-buffer
1470 (ediff-paint-background-regions-in-one-buffer
1472 (ediff-paint-background-regions-in-one-buffer
1473 'Ancestor unhighlight))
1476 ;; arg is a record for a given diff in a difference vector
1477 ;; this record is itself a vector
1478 (defsubst ediff-clear-fine-diff-vector (diff-record)
1480 (mapc 'ediff-delete-overlay
1481 (ediff-get-fine-diff-vector-from-diff-record diff-record))))
1483 (defsubst ediff-clear-fine-differences-in-one-buffer (n buf-type)
1484 (ediff-clear-fine-diff-vector (ediff-get-difference n buf-type))
1485 (ediff-set-fine-diff-vector n buf-type nil))
1487 (defsubst ediff-clear-fine-differences (n)
1488 (ediff-clear-fine-differences-in-one-buffer n 'A)
1489 (ediff-clear-fine-differences-in-one-buffer n 'B)
1491 (ediff-clear-fine-differences-in-one-buffer n 'C)))
1494 (defsubst ediff-mouse-event-p (event)
1495 (if (featurep 'xemacs)
1496 (button-event-p event)
1497 (string-match "mouse" (format "%S" (event-basic-type event)))))
1500 (defsubst ediff-key-press-event-p (event)
1501 (if (featurep 'xemacs)
1502 (key-press-event-p event)
1503 (or (char-or-string-p event) (symbolp event))))
1505 (defun ediff-event-point (event)
1506 (cond ((ediff-mouse-event-p event)
1507 (if (featurep 'xemacs)
1509 (posn-point (event-start event))))
1510 ((ediff-key-press-event-p event)
1512 (t (error "Error"))))
1514 (defun ediff-event-buffer (event)
1515 (cond ((ediff-mouse-event-p event)
1516 (if (featurep 'xemacs)
1517 (event-buffer event)
1518 (window-buffer (posn-window (event-start event)))))
1519 ((ediff-key-press-event-p event)
1521 (t (error "Error"))))
1523 (defun ediff-event-key (event-or-key)
1524 (if (featurep 'xemacs)
1525 ;;(if (eventp event-or-key) (event-key event-or-key) event-or-key)
1526 (if (eventp event-or-key) (event-to-character event-or-key t t) event-or-key)
1529 (defun ediff-last-command-char ()
1530 (ediff-event-key last-command-event))
1533 (defsubst ediff-frame-iconified-p (frame)
1534 (and (ediff-window-display-p) (frame-live-p frame)
1535 (if (featurep 'xemacs)
1536 (frame-iconified-p frame)
1537 (eq (frame-visible-p frame) 'icon))))
1539 (defsubst ediff-window-visible-p (wind)
1540 ;; under TTY, window-live-p also means window is visible
1541 (and (window-live-p wind)
1542 (or (not (ediff-window-display-p))
1543 (frame-visible-p (window-frame wind)))))
1546 (defsubst ediff-frame-char-width (frame)
1547 (if (featurep 'xemacs)
1548 (/ (frame-pixel-width frame) (frame-width frame))
1549 (frame-char-width frame)))
1551 (defun ediff-reset-mouse (&optional frame do-not-grab-mouse)
1552 (or frame (setq frame (selected-frame)))
1553 (if (ediff-window-display-p)
1554 (let ((frame-or-wind frame))
1555 (if (featurep 'xemacs)
1556 (setq frame-or-wind (frame-selected-window frame)))
1557 (or do-not-grab-mouse
1558 ;; don't set mouse if the user said to never do this
1559 (not ediff-grab-mouse)
1560 ;; Don't grab on quit, if the user doesn't want to.
1561 ;; If ediff-grab-mouse = t, then mouse won't be grabbed for
1562 ;; sessions that are not part of a group (this is done in
1563 ;; ediff-recenter). The condition below affects only terminating
1564 ;; sessions in session groups (in which case mouse is warped into
1566 (and (eq ediff-grab-mouse 'maybe)
1567 (memq this-command '(ediff-quit ediff-update-diffs)))
1568 (set-mouse-position frame-or-wind 1 0))
1571 (defsubst ediff-spy-after-mouse ()
1572 (setq ediff-mouse-pixel-position (mouse-pixel-position)))
1574 ;; It is not easy to find out when the user grabs the mouse, since emacs and
1575 ;; xemacs behave differently when mouse is not in any frame. Also, this is
1576 ;; sensitive to when the user grabbed mouse. Not used for now.
1577 (defun ediff-user-grabbed-mouse ()
1578 (if ediff-mouse-pixel-position
1579 (cond ((not (eq (car ediff-mouse-pixel-position)
1580 (car (mouse-pixel-position)))))
1581 ((and (car (cdr ediff-mouse-pixel-position))
1582 (car (cdr (mouse-pixel-position)))
1583 (cdr (cdr ediff-mouse-pixel-position))
1584 (cdr (cdr (mouse-pixel-position))))
1585 (not (and (< (abs (- (car (cdr ediff-mouse-pixel-position))
1586 (car (cdr (mouse-pixel-position)))))
1587 ediff-mouse-pixel-threshold)
1588 (< (abs (- (cdr (cdr ediff-mouse-pixel-position))
1589 (cdr (cdr (mouse-pixel-position)))))
1590 ediff-mouse-pixel-threshold))))
1593 (defsubst ediff-frame-char-height (frame)
1594 (if (featurep 'xemacs)
1595 (glyph-height ediff-H-glyph (frame-selected-window frame))
1596 (frame-char-height frame)))
1598 ;; Some overlay functions
1600 (defsubst ediff-overlay-start (overl)
1601 (if (ediff-overlayp overl)
1602 (if (featurep 'xemacs)
1603 (extent-start-position overl)
1604 (overlay-start overl))))
1606 (defsubst ediff-overlay-end (overl)
1607 (if (ediff-overlayp overl)
1608 (if (featurep 'xemacs)
1609 (extent-end-position overl)
1610 (overlay-end overl))))
1612 (defsubst ediff-empty-overlay-p (overl)
1613 (= (ediff-overlay-start overl) (ediff-overlay-end overl)))
1615 ;; like overlay-buffer in Emacs. In XEmacs, returns nil if the extent is
1616 ;; dead. Otherwise, works like extent-buffer
1617 (defun ediff-overlay-buffer (overl)
1618 (if (featurep 'xemacs)
1619 (and (extent-live-p overl) (extent-object overl))
1620 (overlay-buffer overl)))
1622 ;; like overlay-get in Emacs. In XEmacs, returns nil if the extent is
1623 ;; dead. Otherwise, like extent-property
1624 (defun ediff-overlay-get (overl property)
1625 (if (featurep 'xemacs)
1626 (and (extent-live-p overl) (extent-property overl property))
1627 (overlay-get overl property)))
1630 ;; These two functions are here because XEmacs refuses to
1631 ;; handle overlays whose buffers were deleted.
1632 (defun ediff-move-overlay (overlay beg end &optional buffer)
1633 "Calls `move-overlay' in Emacs and `set-extent-endpoints' in Lemacs.
1634 Checks if overlay's buffer exists before actually doing the move."
1635 (let ((buf (and overlay (ediff-overlay-buffer overlay))))
1636 (if (ediff-buffer-live-p buf)
1637 (if (featurep 'xemacs)
1638 (set-extent-endpoints overlay beg end)
1639 (move-overlay overlay beg end buffer))
1642 (ediff-delete-overlay overlay)))))
1644 (defun ediff-overlay-put (overlay prop value)
1645 "Calls `overlay-put' or `set-extent-property' depending on Emacs version.
1646 Checks if overlay's buffer exists."
1647 (if (ediff-buffer-live-p (ediff-overlay-buffer overlay))
1648 (if (featurep 'xemacs)
1649 (set-extent-property overlay prop value)
1650 (overlay-put overlay prop value))
1651 (ediff-delete-overlay overlay)))
1653 ;; temporarily uses DIR to abbreviate file name
1654 ;; if DIR is nil, use default-directory
1655 (defun ediff-abbreviate-file-name (file &optional dir)
1656 (cond ((stringp dir)
1657 (let ((directory-abbrev-alist (list (cons dir ""))))
1658 (abbreviate-file-name file)))
1660 (if (featurep 'xemacs)
1661 ;; XEmacs requires addl argument
1662 (abbreviate-file-name file t)
1663 (abbreviate-file-name file)))))
1665 ;; Takes a directory and returns the parent directory.
1666 ;; does nothing to `/'. If the ARG is a regular file,
1667 ;; strip the file AND the last dir.
1668 (defun ediff-strip-last-dir (dir)
1669 (if (not (stringp dir)) (setq dir default-directory))
1670 (setq dir (expand-file-name dir))
1671 (or (file-directory-p dir) (setq dir (file-name-directory dir)))
1672 (let* ((pos (1- (length dir)))
1673 (last-char (aref dir pos)))
1674 (if (and (> pos 0) (= last-char ?/))
1675 (setq dir (substring dir 0 pos)))
1676 (ediff-abbreviate-file-name (file-name-directory dir))))
1678 (defun ediff-truncate-string-left (str newlen)
1679 ;; leave space for ... on the left
1680 (let ((len (length str))
1684 (setq newlen (max 0 (- newlen 3)))
1685 (setq substr (substring str (max 0 (- len 1 newlen))))
1686 (concat "..." substr))))
1688 (defsubst ediff-nonempty-string-p (string)
1689 (and (stringp string) (not (string= string ""))))
1691 (unless (fboundp 'subst-char-in-string)
1692 (defun subst-char-in-string (fromchar tochar string &optional inplace)
1693 "Replace FROMCHAR with TOCHAR in STRING each time it occurs.
1694 Unless optional argument INPLACE is non-nil, return a new string."
1695 (let ((i (length string))
1696 (newstr (if inplace string (copy-sequence string))))
1699 (if (eq (aref newstr i) fromchar)
1700 (aset newstr i tochar)))
1703 (defun ediff-abbrev-jobname (jobname)
1704 (cond ((eq jobname 'ediff-directories)
1705 "Compare two directories")
1706 ((eq jobname 'ediff-files)
1707 "Compare two files")
1708 ((eq jobname 'ediff-buffers)
1709 "Compare two buffers")
1710 ((eq jobname 'ediff-directories3)
1711 "Compare three directories")
1712 ((eq jobname 'ediff-files3)
1713 "Compare three files")
1714 ((eq jobname 'ediff-buffers3)
1715 "Compare three buffers")
1716 ((eq jobname 'ediff-revision)
1717 "Compare file with a version")
1718 ((eq jobname 'ediff-directory-revisions)
1719 "Compare dir files with versions")
1720 ((eq jobname 'ediff-merge-directory-revisions)
1721 "Merge dir files with versions")
1722 ((eq jobname 'ediff-merge-directory-revisions-with-ancestor)
1723 "Merge dir versions via ancestors")
1726 (subst-char-in-string ?- ?\s (substring (symbol-name jobname) 6))))
1730 ;; If ediff modified mode line, strip the modification
1731 (defsubst ediff-strip-mode-line-format ()
1732 (and (consp mode-line-format)
1733 (member (car mode-line-format)
1734 '(" A: " " B: " " C: " " Ancestor: "))
1735 (setq mode-line-format (nth 2 mode-line-format))))
1737 ;; Verify that we have a difference selected.
1738 (defsubst ediff-valid-difference-p (&optional n)
1739 (or n (setq n ediff-current-difference))
1740 (and (>= n 0) (< n ediff-number-of-differences)))
1742 (defsubst ediff-show-all-diffs (_n)
1743 "Don't skip difference regions."
1746 (defsubst ediff-message-if-verbose (string &rest args)
1748 (apply 'message string args)))
1750 (defun ediff-file-attributes (filename attr-number)
1751 (if (ediff-listable-file filename)
1752 (nth attr-number (file-attributes filename))
1756 (defsubst ediff-file-size (filename)
1757 (ediff-file-attributes filename 7))
1758 (defsubst ediff-file-modtime (filename)
1759 (ediff-file-attributes filename 5))
1762 (defun ediff-convert-standard-filename (fname)
1763 (if (fboundp 'convert-standard-filename)
1764 (convert-standard-filename fname)
1767 (if (featurep 'emacs)
1768 (defalias 'ediff-with-syntax-table 'with-syntax-table)
1769 (if (fboundp 'with-syntax-table)
1770 (defalias 'ediff-with-syntax-table 'with-syntax-table)
1771 ;; stolen from subr.el in emacs 21
1772 (defmacro ediff-with-syntax-table (table &rest body)
1773 (let ((old-table (make-symbol "table"))
1774 (old-buffer (make-symbol "buffer")))
1775 `(let ((,old-table (syntax-table))
1776 (,old-buffer (current-buffer)))
1779 (set-syntax-table (copy-syntax-table ,table))
1781 (save-current-buffer
1782 (set-buffer ,old-buffer)
1783 (set-syntax-table ,old-table))))))))
1786 (provide 'ediff-init)
1791 ;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
1792 ;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1)
1793 ;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body))
1796 ;;; ediff-init.el ends here