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