Commit | Line | Data |
---|---|---|
0f0b0a86 | 1 | ;;; ediff.el --- a comprehensive visual interface to diff & patch |
b578f267 | 2 | |
55d7ff38 | 3 | ;; Copyright (C) 1994, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. |
813f532d RS |
4 | |
5 | ;; Author: Michael Kifer <kifer@cs.sunysb.edu> | |
6 | ;; Created: February 2, 1994 | |
fcbadd58 | 7 | ;; Keywords: comparing, merging, patching, version control. |
813f532d | 8 | |
3af0304a MK |
9 | (defconst ediff-version "2.74" "The current version of Ediff") |
10 | (defconst ediff-date "October 31, 1999" "Date of last update") | |
bbe6126c | 11 | |
eaccd4d8 | 12 | |
813f532d RS |
13 | ;; This file is part of GNU Emacs. |
14 | ||
15 | ;; GNU Emacs is free software; you can redistribute it and/or modify | |
16 | ;; it under the terms of the GNU General Public License as published by | |
17 | ;; the Free Software Foundation; either version 2, or (at your option) | |
18 | ;; any later version. | |
19 | ||
20 | ;; GNU Emacs is distributed in the hope that it will be useful, | |
21 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
23 | ;; GNU General Public License for more details. | |
24 | ||
25 | ;; You should have received a copy of the GNU General Public License | |
b578f267 EN |
26 | ;; along with GNU Emacs; see the file COPYING. If not, write to the |
27 | ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
28 | ;; Boston, MA 02111-1307, USA. | |
813f532d | 29 | |
813f532d | 30 | ;;; Commentary: |
813f532d | 31 | |
0f0b0a86 | 32 | ;; Never read that diff output again! |
bbe6126c | 33 | ;; Apply patch interactively! |
0f0b0a86 | 34 | ;; Merge with ease! |
813f532d | 35 | |
fcbadd58 | 36 | ;; This package provides a convenient way of simultaneous browsing through |
f1a5512a | 37 | ;; the differences between a pair (or a triple) of files or buffers. The |
0f0b0a86 KH |
38 | ;; files being compared, file-A, file-B, and file-C (if applicable) are |
39 | ;; shown in separate windows (side by side, one above the another, or in | |
40 | ;; separate frames), and the differences are highlighted as you step | |
41 | ;; through them. You can also copy difference regions from one buffer to | |
42 | ;; another (and recover old differences if you change your mind). | |
813f532d | 43 | |
87c668b4 | 44 | ;; Ediff also supports merging operations on files and buffers, including |
3af0304a | 45 | ;; merging using ancestor versions. Both comparison and merging operations can |
87c668b4 MK |
46 | ;; be performed on directories, i.e., by pairwise comparison of files in those |
47 | ;; directories. | |
48 | ||
813f532d | 49 | ;; In addition, Ediff can apply a patch to a file and then let you step |
fcbadd58 | 50 | ;; though both files, the patched and the original one, simultaneously, |
813f532d RS |
51 | ;; difference-by-difference. You can even apply a patch right out of a |
52 | ;; mail buffer, i.e., patches received by mail don't even have to be saved. | |
53 | ;; Since Ediff lets you copy differences between buffers, you can, in | |
54 | ;; effect, apply patches selectively (i.e., you can copy a difference | |
0f0b0a86 | 55 | ;; region from file_orig to file, thereby undoing any particular patch that |
813f532d RS |
56 | ;; you don't like). |
57 | ||
f1a5512a | 58 | ;; Ediff is aware of version control, which lets the user compare |
3af0304a MK |
59 | ;; files with their older versions. Ediff can also work with remote and |
60 | ;; compressed files. Details are given below. | |
f1a5512a | 61 | |
bbe6126c | 62 | ;; Finally, Ediff supports directory-level comparison, merging and patching. |
87c668b4 | 63 | ;; See the on-line manual for details. |
813f532d | 64 | |
87c668b4 | 65 | ;; This package builds upon the ideas borrowed from emerge.el and several |
3af0304a | 66 | ;; Ediff's functions are adaptations from emerge.el. Much of the functionality |
87c668b4 MK |
67 | ;; Ediff provides is also influenced by emerge.el. |
68 | ||
3af0304a MK |
69 | ;; The present version of Ediff supersedes Emerge. It provides a superior user |
70 | ;; interface and has numerous major features not found in Emerge. In | |
87c668b4 MK |
71 | ;; particular, it can do patching, and 2-way and 3-way file comparison, |
72 | ;; merging, and directory operations. | |
fcbadd58 | 73 | |
4ae69eac MK |
74 | |
75 | ||
813f532d | 76 | ;;; Bugs: |
813f532d | 77 | |
3af0304a | 78 | ;; 1. The undo command doesn't restore deleted regions well. That is, if |
813f532d | 79 | ;; you delete all characters in a difference region and then invoke |
0f0b0a86 | 80 | ;; `undo', the reinstated text will most likely be inserted outside of |
b3a26225 | 81 | ;; what Ediff thinks is the current difference region. (This problem |
0f0b0a86 | 82 | ;; doesn't seem to exist with XEmacs.) |
b3a26225 RS |
83 | ;; |
84 | ;; If at any point you feel that difference regions are no longer correct, | |
85 | ;; you can hit '!' to recompute the differences. | |
86 | ||
f1a5512a | 87 | ;; 2. On a monochrome display, the repertoire of faces with which to |
3af0304a MK |
88 | ;; highlight fine differences is limited. By default, Ediff is using |
89 | ;; underlining. However, if the region is already underlined by some other | |
b3a26225 | 90 | ;; overlays, there is no simple way to temporarily remove that residual |
3af0304a MK |
91 | ;; underlining. This problem occurs when a buffer is highlighted with |
92 | ;; hilit19.el or font-lock.el packages. If this residual highlighting gets | |
93 | ;; in the way, you can do the following. Both font-lock.el and hilit19.el | |
94 | ;; provide commands for unhighlighting buffers. You can either place these | |
87c668b4 | 95 | ;; commands in `ediff-prepare-buffer-hook' (which will unhighlight every |
b3a26225 RS |
96 | ;; buffer used by Ediff) or you can execute them interactively, at any time |
97 | ;; and on any buffer. | |
0f0b0a86 | 98 | |
4ae69eac | 99 | |
0f0b0a86 KH |
100 | ;;; Acknowledgements: |
101 | ||
87c668b4 MK |
102 | ;; Ediff was inspired by Dale R. Worley's <drw@math.mit.edu> emerge.el. |
103 | ;; Ediff would not have been possible without the help and encouragement of | |
3af0304a MK |
104 | ;; its many users. See Ediff on-line Info for the full list of those who |
105 | ;; helped. Improved defaults in Ediff file-name reading commands. | |
0f0b0a86 | 106 | |
0f0b0a86 KH |
107 | ;;; Code: |
108 | ||
ddc90f39 | 109 | (provide 'ediff) |
eaccd4d8 | 110 | |
ddc90f39 | 111 | ;; Compiler pacifier |
1e70790f MK |
112 | (defvar cvs-cookie-handle) |
113 | (defvar ediff-last-dir-patch) | |
114 | (defvar ediff-patch-default-directory) | |
115 | ||
92c51e07 MK |
116 | (and noninteractive |
117 | (eval-when-compile | |
92c51e07 | 118 | (load-library "dired") |
ddc90f39 MK |
119 | (load-library "info") |
120 | (load "pcl-cvs" 'noerror))) | |
121 | (eval-when-compile | |
122 | (let ((load-path (cons (expand-file-name ".") load-path))) | |
123 | (or (featurep 'ediff-init) | |
124 | (load "ediff-init.el" nil nil 'nosuffix)) | |
125 | (or (featurep 'ediff-mult) | |
126 | (load "ediff-mult.el" nil nil 'nosuffix)) | |
127 | (or (featurep 'ediff-ptch) | |
128 | (load "ediff-ptch.el" nil nil 'nosuffix)) | |
129 | (or (featurep 'ediff-vers) | |
130 | (load "ediff-vers.el" nil nil 'nosuffix)) | |
131 | )) | |
132 | ;; end pacifier | |
133 | ||
134 | (require 'ediff-init) | |
135 | (require 'ediff-mult) ; required because of the registry stuff | |
136 | ||
137 | (defgroup ediff nil | |
138 | "A comprehensive visual interface to diff & patch" | |
34317da2 | 139 | :tag "Ediff" |
ddc90f39 MK |
140 | :group 'tools) |
141 | ||
142 | ||
143 | (defcustom ediff-use-last-dir nil | |
1e70790f | 144 | "*If t, Ediff will use previous directory as default when reading file name." |
ddc90f39 MK |
145 | :type 'boolean |
146 | :group 'ediff) | |
bbe6126c | 147 | |
1e70790f MK |
148 | ;; Last directory used by an Ediff command for file-A. |
149 | (defvar ediff-last-dir-A nil) | |
150 | ;; Last directory used by an Ediff command for file-B. | |
151 | (defvar ediff-last-dir-B nil) | |
152 | ;; Last directory used by an Ediff command for file-C. | |
153 | (defvar ediff-last-dir-C nil) | |
154 | ;; Last directory used by an Ediff command for the ancestor file. | |
155 | (defvar ediff-last-dir-ancestor nil) | |
156 | ;; Last directory used by an Ediff command as the output directory for merge. | |
157 | (defvar ediff-last-merge-autostore-dir) | |
813f532d | 158 | |
87c668b4 | 159 | |
4ae69eac | 160 | ;; Used as a startup hook to set `_orig' patch file read-only. |
f1a5512a | 161 | (defun ediff-set-read-only-in-buf-A () |
e756eb9f | 162 | (ediff-with-current-buffer ediff-buffer-A |
f1a5512a | 163 | (toggle-read-only 1))) |
813f532d | 164 | |
87c668b4 MK |
165 | ;; Return a plausible default for ediff's first file: |
166 | ;; In dired, return the file name under the point, unless it is a directory | |
167 | ;; If the buffer has a file name, return that file name. | |
168 | (defun ediff-get-default-file-name () | |
169 | (cond ((eq major-mode 'dired-mode) | |
170 | (let ((f (dired-get-filename nil 'no-error))) | |
171 | (if (and (stringp f) (not (file-directory-p f))) | |
172 | f))) | |
173 | ((buffer-file-name (current-buffer)) | |
174 | (file-name-nondirectory (buffer-file-name (current-buffer)))) | |
175 | )) | |
176 | ||
0f0b0a86 | 177 | ;;; Compare files/buffers |
813f532d RS |
178 | |
179 | ;;;###autoload | |
180 | (defun ediff-files (file-A file-B &optional startup-hooks) | |
0f0b0a86 | 181 | "Run Ediff on a pair of files, FILE-A and FILE-B." |
813f532d | 182 | (interactive |
0f0b0a86 KH |
183 | (let ((dir-A (if ediff-use-last-dir |
184 | ediff-last-dir-A | |
185 | default-directory)) | |
186 | dir-B f) | |
87c668b4 MK |
187 | (list (setq f (ediff-read-file-name |
188 | "File A to compare" dir-A | |
189 | (ediff-get-default-file-name))) | |
813f532d | 190 | (ediff-read-file-name "File B to compare" |
0f0b0a86 KH |
191 | (setq dir-B |
192 | (if ediff-use-last-dir | |
193 | ediff-last-dir-B | |
194 | (file-name-directory f))) | |
195 | (progn | |
196 | (setq file-name-history | |
87c668b4 | 197 | (cons (ediff-abbreviate-file-name |
0f0b0a86 KH |
198 | (expand-file-name |
199 | (file-name-nondirectory f) | |
200 | dir-B)) | |
201 | file-name-history)) | |
202 | f)) | |
203 | ))) | |
204 | (ediff-files-internal file-A | |
205 | (if (file-directory-p file-B) | |
206 | (expand-file-name | |
207 | (file-name-nondirectory file-A) file-B) | |
208 | file-B) | |
209 | nil ; file-C | |
210 | startup-hooks | |
211 | 'ediff-files)) | |
212 | ||
213 | ;;;###autoload | |
214 | (defun ediff-files3 (file-A file-B file-C &optional startup-hooks) | |
215 | "Run Ediff on three files, FILE-A, FILE-B, and FILE-C." | |
216 | (interactive | |
217 | (let ((dir-A (if ediff-use-last-dir | |
218 | ediff-last-dir-A | |
219 | default-directory)) | |
220 | dir-B dir-C f ff) | |
87c668b4 MK |
221 | (list (setq f (ediff-read-file-name |
222 | "File A to compare" dir-A | |
223 | (ediff-get-default-file-name))) | |
0f0b0a86 KH |
224 | (setq ff (ediff-read-file-name "File B to compare" |
225 | (setq dir-B | |
226 | (if ediff-use-last-dir | |
227 | ediff-last-dir-B | |
228 | (file-name-directory f))) | |
229 | (progn | |
230 | (setq file-name-history | |
231 | (cons | |
87c668b4 | 232 | (ediff-abbreviate-file-name |
0f0b0a86 KH |
233 | (expand-file-name |
234 | (file-name-nondirectory f) | |
235 | dir-B)) | |
236 | file-name-history)) | |
237 | f))) | |
238 | (ediff-read-file-name "File C to compare" | |
239 | (setq dir-C (if ediff-use-last-dir | |
240 | ediff-last-dir-C | |
241 | (file-name-directory ff))) | |
242 | (progn | |
243 | (setq file-name-history | |
87c668b4 | 244 | (cons (ediff-abbreviate-file-name |
0f0b0a86 KH |
245 | (expand-file-name |
246 | (file-name-nondirectory ff) | |
247 | dir-C)) | |
248 | file-name-history)) | |
249 | ff)) | |
813f532d | 250 | ))) |
b3a26225 RS |
251 | (ediff-files-internal file-A |
252 | (if (file-directory-p file-B) | |
253 | (expand-file-name | |
254 | (file-name-nondirectory file-A) file-B) | |
255 | file-B) | |
0f0b0a86 KH |
256 | (if (file-directory-p file-C) |
257 | (expand-file-name | |
258 | (file-name-nondirectory file-A) file-C) | |
259 | file-C) | |
260 | startup-hooks | |
261 | 'ediff-files3)) | |
813f532d | 262 | |
0f0b0a86 KH |
263 | ;;;###autoload |
264 | (defalias 'ediff3 'ediff-files3) | |
813f532d | 265 | |
813f532d | 266 | |
4ae69eac MK |
267 | ;; Visit FILE and arrange its buffer to Ediff's liking. |
268 | ;; FILE is actually a variable symbol that must contain a true file name. | |
269 | ;; BUFFER-NAME is a variable symbol, which will get the buffer object into | |
270 | ;; which FILE is read. | |
271 | ;; LAST-DIR is the directory variable symbol where FILE's | |
3af0304a | 272 | ;; directory name should be returned. HOOKS-VAR is a variable symbol that will |
4ae69eac MK |
273 | ;; be assigned the hook to be executed after `ediff-startup' is finished. |
274 | ;; `ediff-find-file' arranges that the temp files it might create will be | |
275 | ;; deleted. | |
0f0b0a86 | 276 | (defun ediff-find-file (file-var buffer-name &optional last-dir hooks-var) |
0f0b0a86 | 277 | (let* ((file (symbol-value file-var)) |
bd698e98 | 278 | (file-magic (ediff-filename-magic-p file)) |
0f0b0a86 | 279 | (temp-file-name-prefix (file-name-nondirectory file))) |
87c668b4 MK |
280 | (cond ((not (file-readable-p file)) |
281 | (error "File `%s' does not exist or is not readable" file)) | |
282 | ((file-directory-p file) | |
283 | (error "File `%s' is a directory" file))) | |
0f0b0a86 | 284 | |
4ae69eac | 285 | ;; some of the commands, below, require full file name |
0f0b0a86 KH |
286 | (setq file (expand-file-name file)) |
287 | ||
288 | ;; Record the directory of the file | |
289 | (if last-dir | |
290 | (set last-dir (expand-file-name (file-name-directory file)))) | |
291 | ||
292 | ;; Setup the buffer | |
293 | (set buffer-name (find-file-noselect file)) | |
294 | ||
e756eb9f | 295 | (ediff-with-current-buffer (symbol-value buffer-name) |
0f0b0a86 | 296 | (widen) ; Make sure the entire file is seen |
ddc90f39 MK |
297 | (cond (file-magic ; file has a handler, such as jka-compr-handler or |
298 | ;;; ange-ftp-hook-function--arrange for temp file | |
0f0b0a86 | 299 | (ediff-verify-file-buffer 'magic) |
87c668b4 MK |
300 | (setq file |
301 | (ediff-make-temp-file | |
302 | (current-buffer) temp-file-name-prefix)) | |
086171bf | 303 | (set hooks-var (cons `(lambda () (delete-file ,file)) |
0f0b0a86 KH |
304 | (symbol-value hooks-var)))) |
305 | ;; file processed via auto-mode-alist, a la uncompress.el | |
306 | ((not (equal (file-truename file) | |
307 | (file-truename (buffer-file-name)))) | |
87c668b4 MK |
308 | (setq file |
309 | (ediff-make-temp-file | |
310 | (current-buffer) temp-file-name-prefix)) | |
086171bf | 311 | (set hooks-var (cons `(lambda () (delete-file ,file)) |
0f0b0a86 KH |
312 | (symbol-value hooks-var)))) |
313 | (t ;; plain file---just check that the file matches the buffer | |
314 | (ediff-verify-file-buffer)))) | |
315 | (set file-var file))) | |
316 | ||
328b4b70 MK |
317 | ;; MERGE-BUFFER-FILE is the file to be associated with the merge buffer |
318 | (defun ediff-files-internal (file-A file-B file-C startup-hooks job-name | |
319 | &optional merge-buffer-file) | |
0f0b0a86 | 320 | (let (buf-A buf-B buf-C) |
87c668b4 MK |
321 | (message "Reading file %s ... " file-A) |
322 | ;;(sit-for 0) | |
0f0b0a86 | 323 | (ediff-find-file 'file-A 'buf-A 'ediff-last-dir-A 'startup-hooks) |
87c668b4 MK |
324 | (message "Reading file %s ... " file-B) |
325 | ;;(sit-for 0) | |
0f0b0a86 | 326 | (ediff-find-file 'file-B 'buf-B 'ediff-last-dir-B 'startup-hooks) |
87c668b4 | 327 | (if (stringp file-C) |
0f0b0a86 | 328 | (progn |
87c668b4 MK |
329 | (message "Reading file %s ... " file-C) |
330 | ;;(sit-for 0) | |
0f0b0a86 KH |
331 | (ediff-find-file |
332 | 'file-C 'buf-C | |
333 | (if (eq job-name 'ediff-merge-files-with-ancestor) | |
334 | 'ediff-last-dir-ancestor 'ediff-last-dir-C) | |
335 | 'startup-hooks))) | |
336 | (ediff-setup buf-A file-A | |
337 | buf-B file-B | |
338 | buf-C file-C | |
339 | startup-hooks | |
328b4b70 MK |
340 | (list (cons 'ediff-job-name job-name)) |
341 | merge-buffer-file))) | |
0f0b0a86 KH |
342 | |
343 | ||
344 | ;;;###autoload | |
345 | (defalias 'ediff 'ediff-files) | |
813f532d | 346 | |
813f532d RS |
347 | |
348 | ;;;###autoload | |
0f0b0a86 | 349 | (defun ediff-buffers (buffer-A buffer-B &optional startup-hooks job-name) |
813f532d | 350 | "Run Ediff on a pair of buffers, BUFFER-A and BUFFER-B." |
fcbadd58 | 351 | (interactive |
0f0b0a86 KH |
352 | (let (bf) |
353 | (list (setq bf (read-buffer "Buffer A to compare: " | |
354 | (ediff-other-buffer "") t)) | |
355 | (read-buffer "Buffer B to compare: " | |
356 | (progn | |
357 | ;; realign buffers so that two visible bufs will be | |
358 | ;; at the top | |
359 | (save-window-excursion (other-window 1)) | |
360 | (ediff-other-buffer bf)) | |
361 | t)))) | |
0f0b0a86 KH |
362 | (or job-name (setq job-name 'ediff-buffers)) |
363 | (ediff-buffers-internal buffer-A buffer-B nil startup-hooks job-name)) | |
bbe6126c MK |
364 | |
365 | ;;;###autoload | |
366 | (defalias 'ebuffers 'ediff-buffers) | |
367 | ||
0f0b0a86 KH |
368 | |
369 | ;;;###autoload | |
370 | (defun ediff-buffers3 (buffer-A buffer-B buffer-C | |
371 | &optional startup-hooks job-name) | |
372 | "Run Ediff on three buffers, BUFFER-A, BUFFER-B, and BUFFER-C." | |
373 | (interactive | |
374 | (let (bf bff) | |
375 | (list (setq bf (read-buffer "Buffer A to compare: " | |
376 | (ediff-other-buffer "") t)) | |
377 | (setq bff (read-buffer "Buffer B to compare: " | |
378 | (progn | |
379 | ;; realign buffers so that two visible | |
380 | ;; bufs will be at the top | |
381 | (save-window-excursion (other-window 1)) | |
382 | (ediff-other-buffer bf)) | |
383 | t)) | |
384 | (read-buffer "Buffer C to compare: " | |
385 | (progn | |
386 | ;; realign buffers so that three visible | |
387 | ;; bufs will be at the top | |
388 | (save-window-excursion (other-window 1)) | |
389 | (ediff-other-buffer (list bf bff))) | |
390 | t) | |
391 | ))) | |
0f0b0a86 KH |
392 | (or job-name (setq job-name 'ediff-buffers3)) |
393 | (ediff-buffers-internal buffer-A buffer-B buffer-C startup-hooks job-name)) | |
bbe6126c MK |
394 | |
395 | ;;;###autoload | |
396 | (defalias 'ebuffers3 'ediff-buffers3) | |
0f0b0a86 KH |
397 | |
398 | ||
399 | ||
328b4b70 MK |
400 | ;; MERGE-BUFFER-FILE is the file to be associated with the merge buffer |
401 | (defun ediff-buffers-internal (buf-A buf-B buf-C startup-hooks job-name | |
402 | &optional merge-buffer-file) | |
0f0b0a86 KH |
403 | (let* ((buf-A-file-name (buffer-file-name (get-buffer buf-A))) |
404 | (buf-B-file-name (buffer-file-name (get-buffer buf-B))) | |
405 | (buf-C-is-alive (ediff-buffer-live-p buf-C)) | |
406 | (buf-C-file-name (if buf-C-is-alive | |
407 | (buffer-file-name (get-buffer buf-B)))) | |
408 | file-A file-B file-C) | |
409 | (if (not (ediff-buffer-live-p buf-A)) | |
410 | (error "Buffer %S doesn't exist" buf-A)) | |
411 | (if (not (ediff-buffer-live-p buf-B)) | |
412 | (error "Buffer %S doesn't exist" buf-B)) | |
413 | (let ((ediff-job-name job-name)) | |
414 | (if (and ediff-3way-comparison-job | |
415 | (not buf-C-is-alive)) | |
416 | (error "Buffer %S doesn't exist" buf-C))) | |
417 | (if (stringp buf-A-file-name) | |
418 | (setq buf-A-file-name (file-name-nondirectory buf-A-file-name))) | |
419 | (if (stringp buf-B-file-name) | |
420 | (setq buf-B-file-name (file-name-nondirectory buf-B-file-name))) | |
421 | (if (stringp buf-C-file-name) | |
422 | (setq buf-C-file-name (file-name-nondirectory buf-C-file-name))) | |
423 | ||
4ae69eac MK |
424 | (setq file-A (ediff-make-temp-file buf-A buf-A-file-name) |
425 | file-B (ediff-make-temp-file buf-B buf-B-file-name)) | |
0f0b0a86 | 426 | (if buf-C-is-alive |
87c668b4 | 427 | (setq file-C (ediff-make-temp-file buf-C buf-C-file-name))) |
0f0b0a86 KH |
428 | |
429 | (ediff-setup (get-buffer buf-A) file-A | |
430 | (get-buffer buf-B) file-B | |
431 | (if buf-C-is-alive (get-buffer buf-C)) | |
432 | file-C | |
086171bf MK |
433 | (cons `(lambda () |
434 | (delete-file ,file-A) | |
435 | (delete-file ,file-B) | |
436 | (if (stringp ,file-C) (delete-file ,file-C))) | |
0f0b0a86 KH |
437 | startup-hooks) |
438 | (list (cons 'ediff-job-name job-name)) | |
328b4b70 | 439 | merge-buffer-file))) |
87c668b4 MK |
440 | |
441 | ||
442 | ;;; Directory and file group operations | |
443 | ||
444 | ;; Get appropriate default name for directory: | |
445 | ;; If ediff-use-last-dir, use ediff-last-dir-A. | |
446 | ;; In dired mode, use the directory that is under the point (if any); | |
447 | ;; otherwise, use default-directory | |
448 | (defun ediff-get-default-directory-name () | |
449 | (cond (ediff-use-last-dir ediff-last-dir-A) | |
450 | ((eq major-mode 'dired-mode) | |
451 | (let ((f (dired-get-filename nil 'noerror))) | |
452 | (if (and (stringp f) (file-directory-p f)) | |
453 | f | |
454 | default-directory))) | |
455 | (t default-directory))) | |
456 | ||
457 | ||
458 | ;;;###autoload | |
459 | (defun ediff-directories (dir1 dir2 regexp) | |
460 | "Run Ediff on a pair of directories, DIR1 and DIR2, comparing files that have | |
3af0304a MK |
461 | the same name in both. The third argument, REGEXP, is a regular expression |
462 | that can be used to filter out certain file names." | |
87c668b4 MK |
463 | (interactive |
464 | (let ((dir-A (ediff-get-default-directory-name)) | |
465 | f) | |
bbe6126c MK |
466 | (list (setq f (ediff-read-file-name "Directory A to compare:" dir-A nil)) |
467 | (ediff-read-file-name "Directory B to compare:" | |
87c668b4 MK |
468 | (if ediff-use-last-dir |
469 | ediff-last-dir-B | |
470 | (ediff-strip-last-dir f)) | |
471 | nil) | |
472 | (read-string "Filter through regular expression: " | |
bbe6126c | 473 | nil 'ediff-filtering-regexp-history) |
87c668b4 MK |
474 | ))) |
475 | (ediff-directories-internal | |
476 | dir1 dir2 nil regexp 'ediff-files 'ediff-directories | |
477 | )) | |
478 | ||
479 | ;;;###autoload | |
480 | (defalias 'edirs 'ediff-directories) | |
481 | ||
482 | ||
483 | ;;;###autoload | |
484 | (defun ediff-directory-revisions (dir1 regexp) | |
485 | "Run Ediff on a directory, DIR1, comparing its files with their revisions. | |
486 | The second argument, REGEXP, is a regular expression that filters the file | |
3af0304a | 487 | names. Only the files that are under revision control are taken into account." |
87c668b4 MK |
488 | (interactive |
489 | (let ((dir-A (ediff-get-default-directory-name))) | |
490 | (list (ediff-read-file-name | |
bbe6126c | 491 | "Directory to compare with revision:" dir-A nil) |
87c668b4 | 492 | (read-string "Filter through regular expression: " |
bbe6126c | 493 | nil 'ediff-filtering-regexp-history) |
87c668b4 MK |
494 | ))) |
495 | (ediff-directory-revisions-internal | |
496 | dir1 regexp 'ediff-revision 'ediff-directory-revisions | |
497 | )) | |
498 | ||
499 | ;;;###autoload | |
500 | (defalias 'edir-revisions 'ediff-directory-revisions) | |
501 | ||
502 | ||
503 | ;;;###autoload | |
504 | (defun ediff-directories3 (dir1 dir2 dir3 regexp) | |
505 | "Run Ediff on three directories, DIR1, DIR2, and DIR3, comparing files that | |
3af0304a | 506 | have the same name in all three. The last argument, REGEXP, is a regular |
bbe6126c | 507 | expression that can be used to filter out certain file names." |
87c668b4 MK |
508 | (interactive |
509 | (let ((dir-A (ediff-get-default-directory-name)) | |
510 | f) | |
bbe6126c MK |
511 | (list (setq f (ediff-read-file-name "Directory A to compare:" dir-A nil)) |
512 | (setq f (ediff-read-file-name "Directory B to compare:" | |
87c668b4 MK |
513 | (if ediff-use-last-dir |
514 | ediff-last-dir-B | |
515 | (ediff-strip-last-dir f)) | |
516 | nil)) | |
bbe6126c | 517 | (ediff-read-file-name "Directory C to compare:" |
87c668b4 MK |
518 | (if ediff-use-last-dir |
519 | ediff-last-dir-C | |
520 | (ediff-strip-last-dir f)) | |
521 | nil) | |
522 | (read-string "Filter through regular expression: " | |
bbe6126c | 523 | nil 'ediff-filtering-regexp-history) |
87c668b4 MK |
524 | ))) |
525 | (ediff-directories-internal | |
526 | dir1 dir2 dir3 regexp 'ediff-files3 'ediff-directories3 | |
527 | )) | |
528 | ||
529 | ;;;###autoload | |
530 | (defalias 'edirs3 'ediff-directories3) | |
531 | ||
532 | ;;;###autoload | |
3af0304a | 533 | (defun ediff-merge-directories (dir1 dir2 regexp &optional merge-autostore-dir) |
87c668b4 | 534 | "Run Ediff on a pair of directories, DIR1 and DIR2, merging files that have |
3af0304a MK |
535 | the same name in both. The third argument, REGEXP, is a regular expression |
536 | that can be used to filter out certain file names." | |
87c668b4 MK |
537 | (interactive |
538 | (let ((dir-A (ediff-get-default-directory-name)) | |
539 | f) | |
bbe6126c MK |
540 | (list (setq f (ediff-read-file-name "Directory A to merge:" dir-A nil)) |
541 | (ediff-read-file-name "Directory B to merge:" | |
87c668b4 MK |
542 | (if ediff-use-last-dir |
543 | ediff-last-dir-B | |
544 | (ediff-strip-last-dir f)) | |
545 | nil) | |
546 | (read-string "Filter through regular expression: " | |
bbe6126c | 547 | nil 'ediff-filtering-regexp-history) |
87c668b4 MK |
548 | ))) |
549 | (ediff-directories-internal | |
550 | dir1 dir2 nil regexp 'ediff-merge-files 'ediff-merge-directories | |
3af0304a | 551 | nil merge-autostore-dir |
87c668b4 MK |
552 | )) |
553 | ||
554 | ;;;###autoload | |
555 | (defalias 'edirs-merge 'ediff-merge-directories) | |
556 | ||
557 | ;;;###autoload | |
3af0304a MK |
558 | (defun ediff-merge-directories-with-ancestor (dir1 dir2 ancestor-dir regexp |
559 | &optional | |
560 | merge-autostore-dir) | |
bbe6126c | 561 | "Merge files in directories DIR1 and DIR2 using files in ANCESTOR-DIR as ancestors. |
3af0304a | 562 | Ediff merges files that have identical names in DIR1, DIR2. If a pair of files |
bbe6126c | 563 | in DIR1 and DIR2 doesn't have an ancestor in ANCESTOR-DIR, Ediff will merge |
3af0304a | 564 | without ancestor. The fourth argument, REGEXP, is a regular expression that |
bbe6126c | 565 | can be used to filter out certain file names." |
87c668b4 MK |
566 | (interactive |
567 | (let ((dir-A (ediff-get-default-directory-name)) | |
568 | f) | |
bbe6126c MK |
569 | (list (setq f (ediff-read-file-name "Directory A to merge:" dir-A nil)) |
570 | (setq f (ediff-read-file-name "Directory B to merge:" | |
87c668b4 MK |
571 | (if ediff-use-last-dir |
572 | ediff-last-dir-B | |
573 | (ediff-strip-last-dir f)) | |
574 | nil)) | |
bbe6126c | 575 | (ediff-read-file-name "Ancestor directory:" |
87c668b4 MK |
576 | (if ediff-use-last-dir |
577 | ediff-last-dir-C | |
578 | (ediff-strip-last-dir f)) | |
579 | nil) | |
580 | (read-string "Filter through regular expression: " | |
bbe6126c | 581 | nil 'ediff-filtering-regexp-history) |
87c668b4 MK |
582 | ))) |
583 | (ediff-directories-internal | |
bbe6126c | 584 | dir1 dir2 ancestor-dir regexp |
87c668b4 | 585 | 'ediff-merge-files-with-ancestor 'ediff-merge-directories-with-ancestor |
3af0304a | 586 | nil merge-autostore-dir |
87c668b4 MK |
587 | )) |
588 | ||
589 | ;;;###autoload | |
3af0304a MK |
590 | (defun ediff-merge-directory-revisions (dir1 regexp |
591 | &optional merge-autostore-dir) | |
87c668b4 MK |
592 | "Run Ediff on a directory, DIR1, merging its files with their revisions. |
593 | The second argument, REGEXP, is a regular expression that filters the file | |
3af0304a | 594 | names. Only the files that are under revision control are taken into account." |
87c668b4 | 595 | (interactive |
bf5d92c5 | 596 | (let ((dir-A (ediff-get-default-directory-name))) |
87c668b4 | 597 | (list (ediff-read-file-name |
bbe6126c | 598 | "Directory to merge with revisions:" dir-A nil) |
87c668b4 | 599 | (read-string "Filter through regular expression: " |
bbe6126c | 600 | nil 'ediff-filtering-regexp-history) |
87c668b4 MK |
601 | ))) |
602 | (ediff-directory-revisions-internal | |
603 | dir1 regexp 'ediff-merge-revisions 'ediff-merge-directory-revisions | |
3af0304a | 604 | nil merge-autostore-dir |
87c668b4 MK |
605 | )) |
606 | ||
607 | ;;;###autoload | |
608 | (defalias 'edir-merge-revisions 'ediff-merge-directory-revisions) | |
609 | ||
610 | ;;;###autoload | |
3af0304a MK |
611 | (defun ediff-merge-directory-revisions-with-ancestor (dir1 regexp |
612 | &optional | |
613 | merge-autostore-dir) | |
87c668b4 MK |
614 | "Run Ediff on a directory, DIR1, merging its files with their revisions and ancestors. |
615 | The second argument, REGEXP, is a regular expression that filters the file | |
3af0304a | 616 | names. Only the files that are under revision control are taken into account." |
87c668b4 | 617 | (interactive |
bf5d92c5 | 618 | (let ((dir-A (ediff-get-default-directory-name))) |
87c668b4 | 619 | (list (ediff-read-file-name |
bbe6126c | 620 | "Directory to merge with revisions and ancestors:" dir-A nil) |
87c668b4 | 621 | (read-string "Filter through regular expression: " |
bbe6126c | 622 | nil 'ediff-filtering-regexp-history) |
87c668b4 MK |
623 | ))) |
624 | (ediff-directory-revisions-internal | |
625 | dir1 regexp 'ediff-merge-revisions-with-ancestor | |
626 | 'ediff-merge-directory-revisions-with-ancestor | |
3af0304a | 627 | nil merge-autostore-dir |
87c668b4 MK |
628 | )) |
629 | ||
630 | ;;;###autoload | |
631 | (defalias | |
632 | 'edir-merge-revisions-with-ancestor | |
633 | 'ediff-merge-directory-revisions-with-ancestor) | |
634 | ||
635 | ;;;###autoload | |
636 | (defalias 'edirs-merge-with-ancestor 'ediff-merge-directories-with-ancestor) | |
637 | ||
638 | ;; Run ediff-action (ediff-files, ediff-merge, ediff-merge-with-ancestors) | |
639 | ;; on a pair of directories (three directories, in case of ancestor). | |
bbe6126c MK |
640 | ;; The third argument, REGEXP, is a regular expression that can be used to |
641 | ;; filter out certain file names. | |
87c668b4 | 642 | ;; JOBNAME is the symbol indicating the meta-job to be performed. |
3af0304a | 643 | ;; MERGE-AUTOSTORE-DIR is the directory in which to store merged files. |
92c51e07 | 644 | (defun ediff-directories-internal (dir1 dir2 dir3 regexp action jobname |
3af0304a MK |
645 | &optional startup-hooks |
646 | merge-autostore-dir) | |
87c668b4 | 647 | ;; ediff-read-file-name is set to attach a previously entered file name if |
3af0304a | 648 | ;; the currently entered file is a directory. This code takes care of that. |
87c668b4 MK |
649 | (setq dir1 (if (file-directory-p dir1) dir1 (file-name-directory dir1)) |
650 | dir2 (if (file-directory-p dir2) dir2 (file-name-directory dir2))) | |
651 | ||
652 | (if (stringp dir3) | |
653 | (setq dir3 (if (file-directory-p dir3) dir3 (file-name-directory dir3)))) | |
654 | ||
655 | (cond ((string= dir1 dir2) | |
656 | (error "Directories A and B are the same: %s" dir1)) | |
657 | ((and (eq jobname 'ediff-directories3) | |
658 | (string= dir1 dir3)) | |
659 | (error "Directories A and C are the same: %s" dir1)) | |
660 | ((and (eq jobname 'ediff-directories3) | |
661 | (string= dir2 dir3)) | |
662 | (error "Directories B and C are the same: %s" dir1))) | |
663 | ||
3af0304a MK |
664 | (if merge-autostore-dir |
665 | (or (stringp merge-autostore-dir) | |
666 | (error "%s: Directory for storing merged files must be a string" | |
667 | jobname))) | |
87c668b4 MK |
668 | (let (diffs ; var where ediff-intersect-directories returns the diff list |
669 | file-list meta-buf) | |
3af0304a MK |
670 | (if (and ediff-autostore-merges |
671 | (ediff-merge-metajob jobname) | |
672 | (not merge-autostore-dir)) | |
92c51e07 | 673 | (setq merge-autostore-dir |
3af0304a MK |
674 | (read-file-name "Save merged files in directory: " |
675 | (if ediff-use-last-dir | |
92c51e07 MK |
676 | ediff-last-merge-autostore-dir |
677 | (ediff-strip-last-dir dir1)) | |
3af0304a MK |
678 | nil |
679 | 'must-match))) | |
92c51e07 | 680 | ;; verify we are not merging into an orig directory |
3af0304a | 681 | (if merge-autostore-dir |
92c51e07 | 682 | (cond ((and (stringp dir1) (string= merge-autostore-dir dir1)) |
3af0304a MK |
683 | (or (y-or-n-p |
684 | "Directory for saving merged files = Directory A. Sure? ") | |
92c51e07 MK |
685 | (error "Directory merge aborted"))) |
686 | ((and (stringp dir2) (string= merge-autostore-dir dir2)) | |
3af0304a MK |
687 | (or (y-or-n-p |
688 | "Directory for saving merged files = Directory B. Sure? ") | |
92c51e07 MK |
689 | (error "Directory merge aborted"))) |
690 | ((and (stringp dir3) (string= merge-autostore-dir dir3)) | |
691 | (or (y-or-n-p | |
3af0304a | 692 | "Directory for saving merged files = Ancestor Directory. Sure? ") |
92c51e07 MK |
693 | (error "Directory merge aborted"))))) |
694 | ||
87c668b4 | 695 | (setq file-list (ediff-intersect-directories |
92c51e07 MK |
696 | jobname 'diffs |
697 | regexp dir1 dir2 dir3 merge-autostore-dir)) | |
87c668b4 MK |
698 | (setq startup-hooks |
699 | ;; this sets various vars in the meta buffer inside | |
700 | ;; ediff-prepare-meta-buffer | |
086171bf MK |
701 | (cons `(lambda () |
702 | ;; tell what to do if the user clicks on a session record | |
703 | (setq ediff-session-action-function (quote ,action)) | |
704 | ;; set ediff-dir-difference-list | |
705 | (setq ediff-dir-difference-list (quote ,diffs))) | |
87c668b4 MK |
706 | startup-hooks)) |
707 | (setq meta-buf (ediff-prepare-meta-buffer | |
bbe6126c | 708 | 'ediff-filegroup-action |
87c668b4 MK |
709 | file-list |
710 | "*Ediff Session Group Panel" | |
711 | 'ediff-redraw-directory-group-buffer | |
712 | jobname | |
713 | startup-hooks)) | |
714 | (ediff-show-meta-buffer meta-buf) | |
715 | )) | |
716 | ||
3af0304a MK |
717 | ;; MERGE-AUTOSTORE-DIR can be given to tell ediff where to store the merged |
718 | ;; files | |
87c668b4 | 719 | (defun ediff-directory-revisions-internal (dir1 regexp action jobname |
3af0304a MK |
720 | &optional startup-hooks |
721 | merge-autostore-dir) | |
87c668b4 | 722 | (setq dir1 (if (file-directory-p dir1) dir1 (file-name-directory dir1))) |
92c51e07 | 723 | |
3af0304a MK |
724 | (if merge-autostore-dir |
725 | (or (stringp merge-autostore-dir) | |
726 | (error "%S: Directory for storing merged files must be a string" | |
727 | jobname))) | |
728 | (let (file-list meta-buf) | |
729 | (if (and ediff-autostore-merges | |
730 | (ediff-merge-metajob jobname) | |
731 | (not merge-autostore-dir)) | |
92c51e07 | 732 | (setq merge-autostore-dir |
3af0304a MK |
733 | (read-file-name "Save merged files in directory: " |
734 | (if ediff-use-last-dir | |
735 | ediff-last-merge-autostore-dir | |
736 | (ediff-strip-last-dir dir1)) | |
737 | nil | |
738 | 'must-match))) | |
92c51e07 | 739 | ;; verify merge-autostore-dir != dir1 |
3af0304a | 740 | (if (and merge-autostore-dir |
92c51e07 MK |
741 | (stringp dir1) |
742 | (string= merge-autostore-dir dir1)) | |
743 | (or (y-or-n-p | |
3af0304a | 744 | "Directory for saving merged file = directory A. Sure? ") |
92c51e07 MK |
745 | (error "Merge of directory revisions aborted"))) |
746 | ||
87c668b4 | 747 | (setq file-list |
92c51e07 MK |
748 | (ediff-get-directory-files-under-revision |
749 | jobname regexp dir1 merge-autostore-dir)) | |
87c668b4 MK |
750 | (setq startup-hooks |
751 | ;; this sets various vars in the meta buffer inside | |
752 | ;; ediff-prepare-meta-buffer | |
086171bf MK |
753 | (cons `(lambda () |
754 | ;; tell what to do if the user clicks on a session record | |
755 | (setq ediff-session-action-function (quote ,action))) | |
87c668b4 MK |
756 | startup-hooks)) |
757 | (setq meta-buf (ediff-prepare-meta-buffer | |
bbe6126c | 758 | 'ediff-filegroup-action |
87c668b4 MK |
759 | file-list |
760 | "*Ediff Session Group Panel" | |
761 | 'ediff-redraw-directory-group-buffer | |
762 | jobname | |
763 | startup-hooks)) | |
764 | (ediff-show-meta-buffer meta-buf) | |
765 | )) | |
0f0b0a86 KH |
766 | |
767 | ||
768 | ;;; Compare regions and windows | |
769 | ||
770 | ;;;###autoload | |
f1a5512a KH |
771 | (defun ediff-windows-wordwise (dumb-mode &optional wind-A wind-B startup-hooks) |
772 | "Compare WIND-A and WIND-B, which are selected by clicking, wordwise. | |
0f0b0a86 KH |
773 | With prefix argument, DUMB-MODE, or on a non-windowing display, works as |
774 | follows: | |
775 | If WIND-A is nil, use selected window. | |
776 | If WIND-B is nil, use window next to WIND-A." | |
0f0b0a86 | 777 | (interactive "P") |
f1a5512a KH |
778 | (ediff-windows dumb-mode wind-A wind-B |
779 | startup-hooks 'ediff-windows-wordwise 'word-mode)) | |
780 | ||
781 | ;;;###autoload | |
782 | (defun ediff-windows-linewise (dumb-mode &optional wind-A wind-B startup-hooks) | |
783 | "Compare WIND-A and WIND-B, which are selected by clicking, linewise. | |
784 | With prefix argument, DUMB-MODE, or on a non-windowing display, works as | |
785 | follows: | |
786 | If WIND-A is nil, use selected window. | |
787 | If WIND-B is nil, use window next to WIND-A." | |
788 | (interactive "P") | |
789 | (ediff-windows dumb-mode wind-A wind-B | |
790 | startup-hooks 'ediff-windows-linewise nil)) | |
0f0b0a86 | 791 | |
f1a5512a KH |
792 | ;; Compare WIND-A and WIND-B, which are selected by clicking. |
793 | ;; With prefix argument, DUMB-MODE, or on a non-windowing display, | |
794 | ;; works as follows: | |
795 | ;; If WIND-A is nil, use selected window. | |
796 | ;; If WIND-B is nil, use window next to WIND-A. | |
797 | (defun ediff-windows (dumb-mode wind-A wind-B startup-hooks job-name word-mode) | |
798 | (if (or dumb-mode (not (ediff-window-display-p))) | |
0f0b0a86 KH |
799 | (setq wind-A (ediff-get-next-window wind-A nil) |
800 | wind-B (ediff-get-next-window wind-B wind-A)) | |
801 | (setq wind-A (ediff-get-window-by-clicking wind-A nil 1) | |
802 | wind-B (ediff-get-window-by-clicking wind-B wind-A 2))) | |
803 | ||
804 | (let ((buffer-A (window-buffer wind-A)) | |
805 | (buffer-B (window-buffer wind-B)) | |
806 | beg-A end-A beg-B end-B) | |
807 | ||
808 | (save-excursion | |
809 | (save-window-excursion | |
a7acbbe4 | 810 | (sit-for 0) ; sync before using window-start/end -- a precaution |
0f0b0a86 KH |
811 | (select-window wind-A) |
812 | (setq beg-A (window-start) | |
813 | end-A (window-end)) | |
814 | (select-window wind-B) | |
815 | (setq beg-B (window-start) | |
816 | end-B (window-end)))) | |
817 | (ediff-regions-internal | |
818 | buffer-A beg-A end-A buffer-B beg-B end-B | |
ddc90f39 | 819 | startup-hooks job-name word-mode nil))) |
0f0b0a86 KH |
820 | |
821 | ;;;###autoload | |
f1a5512a | 822 | (defun ediff-regions-wordwise (buffer-A buffer-B &optional startup-hooks) |
0f0b0a86 KH |
823 | "Run Ediff on a pair of regions in two different buffers. |
824 | Regions \(i.e., point and mark\) are assumed to be set in advance. | |
825 | This function is effective only for relatively small regions, up to 200 | |
3af0304a | 826 | lines. For large regions, use `ediff-regions-linewise'." |
0f0b0a86 KH |
827 | (interactive |
828 | (let (bf) | |
829 | (list (setq bf (read-buffer "Region's A buffer: " | |
830 | (ediff-other-buffer "") t)) | |
831 | (read-buffer "Region's B buffer: " | |
832 | (progn | |
833 | ;; realign buffers so that two visible bufs will be | |
834 | ;; at the top | |
835 | (save-window-excursion (other-window 1)) | |
836 | (ediff-other-buffer bf)) | |
837 | t)))) | |
838 | (if (not (ediff-buffer-live-p buffer-A)) | |
839 | (error "Buffer %S doesn't exist" buffer-A)) | |
840 | (if (not (ediff-buffer-live-p buffer-B)) | |
841 | (error "Buffer %S doesn't exist" buffer-B)) | |
842 | ||
843 | ||
844 | (let (reg-A-beg reg-A-end reg-B-beg reg-B-end) | |
845 | (save-excursion | |
846 | (set-buffer buffer-A) | |
847 | (setq reg-A-beg (region-beginning) | |
848 | reg-A-end (region-end)) | |
849 | (set-buffer buffer-B) | |
850 | (setq reg-B-beg (region-beginning) | |
851 | reg-B-end (region-end))) | |
852 | ||
853 | (ediff-regions-internal | |
854 | (get-buffer buffer-A) reg-A-beg reg-A-end | |
855 | (get-buffer buffer-B) reg-B-beg reg-B-end | |
ddc90f39 | 856 | startup-hooks 'ediff-regions-wordwise 'word-mode nil))) |
0f0b0a86 KH |
857 | |
858 | ;;;###autoload | |
f1a5512a | 859 | (defun ediff-regions-linewise (buffer-A buffer-B &optional startup-hooks) |
0f0b0a86 KH |
860 | "Run Ediff on a pair of regions in two different buffers. |
861 | Regions \(i.e., point and mark\) are assumed to be set in advance. | |
862 | Each region is enlarged to contain full lines. | |
863 | This function is effective for large regions, over 100-200 | |
3af0304a | 864 | lines. For small regions, use `ediff-regions-wordwise'." |
0f0b0a86 KH |
865 | (interactive |
866 | (let (bf) | |
867 | (list (setq bf (read-buffer "Region A's buffer: " | |
868 | (ediff-other-buffer "") t)) | |
869 | (read-buffer "Region B's buffer: " | |
870 | (progn | |
871 | ;; realign buffers so that two visible bufs will be | |
872 | ;; at the top | |
873 | (save-window-excursion (other-window 1)) | |
874 | (ediff-other-buffer bf)) | |
875 | t)))) | |
fcbadd58 | 876 | (if (not (ediff-buffer-live-p buffer-A)) |
0f0b0a86 | 877 | (error "Buffer %S doesn't exist" buffer-A)) |
fcbadd58 | 878 | (if (not (ediff-buffer-live-p buffer-B)) |
0f0b0a86 KH |
879 | (error "Buffer %S doesn't exist" buffer-B)) |
880 | ||
881 | (let (reg-A-beg reg-A-end reg-B-beg reg-B-end) | |
882 | (save-excursion | |
883 | (set-buffer buffer-A) | |
884 | (setq reg-A-beg (region-beginning) | |
885 | reg-A-end (region-end)) | |
886 | ;; enlarge the region to hold full lines | |
887 | (goto-char reg-A-beg) | |
888 | (beginning-of-line) | |
889 | (setq reg-A-beg (point)) | |
890 | (goto-char reg-A-end) | |
891 | (end-of-line) | |
892 | (or (eobp) (forward-char)) ; include the newline char | |
893 | (setq reg-A-end (point)) | |
fcbadd58 | 894 | |
0f0b0a86 KH |
895 | (set-buffer buffer-B) |
896 | (setq reg-B-beg (region-beginning) | |
897 | reg-B-end (region-end)) | |
898 | ;; enlarge the region to hold full lines | |
0f0b0a86 KH |
899 | (goto-char reg-B-beg) |
900 | (beginning-of-line) | |
901 | (setq reg-B-beg (point)) | |
902 | (goto-char reg-B-end) | |
903 | (end-of-line) | |
904 | (or (eobp) (forward-char)) ; include the newline char | |
905 | (setq reg-B-end (point)) | |
906 | ) ; save excursion | |
907 | ||
908 | (ediff-regions-internal | |
909 | (get-buffer buffer-A) reg-A-beg reg-A-end | |
910 | (get-buffer buffer-B) reg-B-beg reg-B-end | |
1e70790f | 911 | startup-hooks 'ediff-regions-linewise nil nil))) ; no word mode |
0f0b0a86 KH |
912 | |
913 | ;; compare region beg-A to end-A of buffer-A | |
914 | ;; to regions beg-B -- end-B in buffer-B. | |
915 | (defun ediff-regions-internal (buffer-A beg-A end-A buffer-B beg-B end-B | |
ddc90f39 MK |
916 | startup-hooks job-name word-mode |
917 | setup-parameters) | |
0f0b0a86 KH |
918 | (let ((tmp-buffer (get-buffer-create ediff-tmp-buffer)) |
919 | overl-A overl-B | |
920 | file-A file-B) | |
921 | ||
922 | ;; in case beg/end-A/B aren't markers--make them into markers | |
e756eb9f | 923 | (ediff-with-current-buffer buffer-A |
0f0b0a86 KH |
924 | (setq beg-A (move-marker (make-marker) beg-A) |
925 | end-A (move-marker (make-marker) end-A))) | |
e756eb9f | 926 | (ediff-with-current-buffer buffer-B |
0f0b0a86 KH |
927 | (setq beg-B (move-marker (make-marker) beg-B) |
928 | end-B (move-marker (make-marker) end-B))) | |
929 | ||
930 | (if (and (eq buffer-A buffer-B) | |
931 | (or (and (< beg-A end-B) (<= beg-B beg-A)) ; b-B b-A e-B | |
932 | (and (< beg-B end-A) (<= end-A end-B)))) ; b-B e-A e-B | |
933 | (progn | |
934 | (with-output-to-temp-buffer ediff-msg-buffer | |
935 | (princ " | |
936 | You have requested to compare overlapping regions of the same buffer. | |
937 | ||
938 | In this case, Ediff's highlighting may be confusing---in the same window, | |
939 | you may see highlighted regions that belong to different regions. | |
940 | ||
941 | Continue anyway? (y/n) ")) | |
942 | ||
943 | (if (y-or-n-p "Continue anyway? ") | |
944 | () | |
945 | (error "%S aborted" job-name)))) | |
946 | ||
947 | ;; make file-A | |
948 | (if word-mode | |
949 | (ediff-wordify beg-A end-A buffer-A tmp-buffer) | |
950 | (ediff-copy-to-buffer beg-A end-A buffer-A tmp-buffer)) | |
87c668b4 | 951 | (setq file-A (ediff-make-temp-file tmp-buffer "regA")) |
0f0b0a86 KH |
952 | |
953 | ;; make file-B | |
954 | (if word-mode | |
955 | (ediff-wordify beg-B end-B buffer-B tmp-buffer) | |
956 | (ediff-copy-to-buffer beg-B end-B buffer-B tmp-buffer)) | |
87c668b4 | 957 | (setq file-B (ediff-make-temp-file tmp-buffer "regB")) |
0f0b0a86 KH |
958 | |
959 | (setq overl-A (ediff-make-bullet-proof-overlay beg-A end-A buffer-A)) | |
960 | (setq overl-B (ediff-make-bullet-proof-overlay beg-B end-B buffer-B)) | |
961 | (ediff-setup buffer-A file-A | |
962 | buffer-B file-B | |
963 | nil nil ; buffer & file C | |
086171bf MK |
964 | (cons `(lambda () |
965 | (delete-file ,file-A) | |
966 | (delete-file ,file-B)) | |
813f532d | 967 | startup-hooks) |
ddc90f39 MK |
968 | (append |
969 | (list (cons 'ediff-word-mode word-mode) | |
970 | (cons 'ediff-narrow-bounds (list overl-A overl-B)) | |
971 | (cons 'ediff-job-name job-name)) | |
328b4b70 | 972 | setup-parameters)) |
0f0b0a86 KH |
973 | )) |
974 | ||
975 | ||
976 | ;;; Merge files and buffers | |
977 | ||
978 | ;;;###autoload | |
979 | (defalias 'ediff-merge 'ediff-merge-files) | |
980 | ||
981 | (defsubst ediff-merge-on-startup () | |
982 | (ediff-do-merge 0) | |
e756eb9f | 983 | (ediff-with-current-buffer ediff-buffer-C |
0f0b0a86 KH |
984 | (set-buffer-modified-p nil))) |
985 | ||
986 | ;;;###autoload | |
328b4b70 MK |
987 | (defun ediff-merge-files (file-A file-B |
988 | ;; MERGE-BUFFER-FILE is the file to be | |
989 | ;; associated with the merge buffer | |
990 | &optional startup-hooks merge-buffer-file) | |
0f0b0a86 KH |
991 | "Merge two files without ancestor." |
992 | (interactive | |
993 | (let ((dir-A (if ediff-use-last-dir | |
994 | ediff-last-dir-A | |
995 | default-directory)) | |
996 | dir-B f) | |
87c668b4 MK |
997 | (list (setq f (ediff-read-file-name |
998 | "File A to merge" dir-A | |
999 | (ediff-get-default-file-name))) | |
0f0b0a86 KH |
1000 | (ediff-read-file-name "File B to merge" |
1001 | (setq dir-B | |
1002 | (if ediff-use-last-dir | |
1003 | ediff-last-dir-B | |
1004 | (file-name-directory f))) | |
1005 | (progn | |
1006 | (setq file-name-history | |
87c668b4 | 1007 | (cons (ediff-abbreviate-file-name |
0f0b0a86 KH |
1008 | (expand-file-name |
1009 | (file-name-nondirectory f) | |
1010 | dir-B)) | |
1011 | file-name-history)) | |
1012 | f)) | |
1013 | ))) | |
1014 | (setq startup-hooks (cons 'ediff-merge-on-startup startup-hooks)) | |
1015 | (ediff-files-internal file-A | |
1016 | (if (file-directory-p file-B) | |
1017 | (expand-file-name | |
1018 | (file-name-nondirectory file-A) file-B) | |
1019 | file-B) | |
1020 | nil ; file-C | |
1021 | startup-hooks | |
328b4b70 MK |
1022 | 'ediff-merge-files |
1023 | merge-buffer-file)) | |
0f0b0a86 KH |
1024 | |
1025 | ;;;###autoload | |
1026 | (defun ediff-merge-files-with-ancestor (file-A file-B file-ancestor | |
328b4b70 MK |
1027 | &optional |
1028 | startup-hooks | |
1029 | ;; MERGE-BUFFER-FILE is the file | |
1030 | ;; to be associated with the | |
1031 | ;; merge buffer | |
1032 | merge-buffer-file) | |
0f0b0a86 KH |
1033 | "Merge two files with ancestor." |
1034 | (interactive | |
1035 | (let ((dir-A (if ediff-use-last-dir | |
1036 | ediff-last-dir-A | |
1037 | default-directory)) | |
1038 | dir-B dir-ancestor f ff) | |
87c668b4 MK |
1039 | (list (setq f (ediff-read-file-name |
1040 | "File A to merge" dir-A | |
1041 | (ediff-get-default-file-name))) | |
0f0b0a86 KH |
1042 | (setq ff (ediff-read-file-name "File B to merge" |
1043 | (setq dir-B | |
1044 | (if ediff-use-last-dir | |
1045 | ediff-last-dir-B | |
1046 | (file-name-directory f))) | |
1047 | (progn | |
1048 | (setq file-name-history | |
1049 | (cons | |
87c668b4 | 1050 | (ediff-abbreviate-file-name |
0f0b0a86 KH |
1051 | (expand-file-name |
1052 | (file-name-nondirectory f) | |
1053 | dir-B)) | |
1054 | file-name-history)) | |
1055 | f))) | |
1056 | (ediff-read-file-name "Ancestor file" | |
1057 | (setq dir-ancestor | |
1058 | (if ediff-use-last-dir | |
1059 | ediff-last-dir-ancestor | |
1060 | (file-name-directory ff))) | |
1061 | (progn | |
1062 | (setq file-name-history | |
87c668b4 | 1063 | (cons (ediff-abbreviate-file-name |
0f0b0a86 KH |
1064 | (expand-file-name |
1065 | (file-name-nondirectory ff) | |
1066 | dir-ancestor)) | |
1067 | file-name-history)) | |
1068 | ff)) | |
1069 | ))) | |
1070 | (setq startup-hooks (cons 'ediff-merge-on-startup startup-hooks)) | |
1071 | (ediff-files-internal file-A | |
1072 | (if (file-directory-p file-B) | |
1073 | (expand-file-name | |
1074 | (file-name-nondirectory file-A) file-B) | |
1075 | file-B) | |
1076 | file-ancestor | |
1077 | startup-hooks | |
328b4b70 MK |
1078 | 'ediff-merge-files-with-ancestor |
1079 | merge-buffer-file)) | |
0f0b0a86 KH |
1080 | |
1081 | ;;;###autoload | |
1082 | (defalias 'ediff-merge-with-ancestor 'ediff-merge-files-with-ancestor) | |
1083 | ||
1084 | ;;;###autoload | |
328b4b70 MK |
1085 | (defun ediff-merge-buffers (buffer-A buffer-B |
1086 | &optional | |
1087 | ;; MERGE-BUFFER-FILE is the file to be | |
1088 | ;; associated with the merge buffer | |
1089 | startup-hooks job-name merge-buffer-file) | |
0f0b0a86 KH |
1090 | "Merge buffers without ancestor." |
1091 | (interactive | |
1092 | (let (bf) | |
1093 | (list (setq bf (read-buffer "Buffer A to merge: " | |
1094 | (ediff-other-buffer "") t)) | |
1095 | (read-buffer "Buffer B to merge: " | |
1096 | (progn | |
1097 | ;; realign buffers so that two visible bufs will be | |
1098 | ;; at the top | |
1099 | (save-window-excursion (other-window 1)) | |
1100 | (ediff-other-buffer bf)) | |
1101 | t)))) | |
1102 | ||
1103 | (setq startup-hooks (cons 'ediff-merge-on-startup startup-hooks)) | |
1104 | (or job-name (setq job-name 'ediff-merge-buffers)) | |
1105 | (ediff-buffers-internal | |
328b4b70 | 1106 | buffer-A buffer-B nil startup-hooks job-name merge-buffer-file)) |
0f0b0a86 KH |
1107 | |
1108 | ;;;###autoload | |
328b4b70 MK |
1109 | (defun ediff-merge-buffers-with-ancestor (buffer-A buffer-B buffer-ancestor |
1110 | &optional | |
1111 | startup-hooks | |
1112 | job-name | |
1113 | ;; MERGE-BUFFER-FILE is the | |
1114 | ;; file to be associated | |
1115 | ;; with the merge buffer | |
1116 | merge-buffer-file) | |
0f0b0a86 KH |
1117 | "Merge buffers with ancestor." |
1118 | (interactive | |
1119 | (let (bf bff) | |
1120 | (list (setq bf (read-buffer "Buffer A to merge: " | |
1121 | (ediff-other-buffer "") t)) | |
1122 | (setq bff (read-buffer "Buffer B to merge: " | |
1123 | (progn | |
1124 | ;; realign buffers so that two visible | |
1125 | ;; bufs will be at the top | |
1126 | (save-window-excursion (other-window 1)) | |
1127 | (ediff-other-buffer bf)) | |
1128 | t)) | |
1129 | (read-buffer "Ancestor buffer: " | |
1130 | (progn | |
1131 | ;; realign buffers so that three visible | |
1132 | ;; bufs will be at the top | |
1133 | (save-window-excursion (other-window 1)) | |
1134 | (ediff-other-buffer (list bf bff))) | |
1135 | t) | |
1136 | ))) | |
1137 | ||
1138 | (setq startup-hooks (cons 'ediff-merge-on-startup startup-hooks)) | |
1139 | (or job-name (setq job-name 'ediff-merge-buffers-with-ancestor)) | |
1140 | (ediff-buffers-internal | |
328b4b70 | 1141 | buffer-A buffer-B buffer-ancestor startup-hooks job-name merge-buffer-file)) |
0f0b0a86 KH |
1142 | |
1143 | ||
1144 | ;;;###autoload | |
328b4b70 MK |
1145 | (defun ediff-merge-revisions (&optional file startup-hooks merge-buffer-file) |
1146 | ;; MERGE-BUFFER-FILE is the file to be associated with the merge buffer | |
0f0b0a86 | 1147 | "Run Ediff by merging two revisions of a file. |
87c668b4 MK |
1148 | The file is the optional FILE argument or the file visited by the current |
1149 | buffer." | |
1150 | (interactive) | |
87c668b4 | 1151 | (if (stringp file) (find-file file)) |
4ae69eac | 1152 | (let (rev1 rev2) |
87c668b4 MK |
1153 | (setq rev1 |
1154 | (read-string | |
1155 | (format | |
1156 | "Version 1 to merge (default: %s's latest version): " | |
1157 | (if (stringp file) | |
1158 | (file-name-nondirectory file) "current buffer"))) | |
1159 | rev2 | |
1160 | (read-string | |
1161 | (format | |
1162 | "Version 2 to merge (default: %s): " | |
1163 | (if (stringp file) | |
1164 | (file-name-nondirectory file) "current buffer")))) | |
4ae69eac MK |
1165 | (ediff-load-version-control) |
1166 | ;; ancestor-revision=nil | |
1167 | (funcall | |
92c51e07 | 1168 | (intern (format "ediff-%S-merge-internal" ediff-version-control-package)) |
328b4b70 | 1169 | rev1 rev2 nil startup-hooks merge-buffer-file))) |
0f0b0a86 KH |
1170 | |
1171 | ||
1172 | ;;;###autoload | |
328b4b70 MK |
1173 | (defun ediff-merge-revisions-with-ancestor (&optional |
1174 | file startup-hooks | |
1175 | ;; MERGE-BUFFER-FILE is the file to | |
1176 | ;; be associated with the merge | |
1177 | ;; buffer | |
1178 | merge-buffer-file) | |
87c668b4 MK |
1179 | "Run Ediff by merging two revisions of a file with a common ancestor. |
1180 | The file is the the optional FILE argument or the file visited by the current | |
1181 | buffer." | |
1182 | (interactive) | |
87c668b4 | 1183 | (if (stringp file) (find-file file)) |
4ae69eac | 1184 | (let (rev1 rev2 ancestor-rev) |
87c668b4 MK |
1185 | (setq rev1 |
1186 | (read-string | |
1187 | (format | |
1188 | "Version 1 to merge (default: %s's latest version): " | |
1189 | (if (stringp file) | |
1190 | (file-name-nondirectory file) "current buffer"))) | |
1191 | rev2 | |
1192 | (read-string | |
1193 | (format | |
1194 | "Version 2 to merge (default: %s): " | |
1195 | (if (stringp file) | |
1196 | (file-name-nondirectory file) "current buffer"))) | |
1197 | ancestor-rev | |
1198 | (read-string | |
1199 | (format | |
3af0304a | 1200 | "Ancestor version (default: %s's base revision): " |
87c668b4 MK |
1201 | (if (stringp file) |
1202 | (file-name-nondirectory file) "current buffer")))) | |
4ae69eac MK |
1203 | (ediff-load-version-control) |
1204 | (funcall | |
92c51e07 | 1205 | (intern (format "ediff-%S-merge-internal" ediff-version-control-package)) |
328b4b70 | 1206 | rev1 rev2 ancestor-rev startup-hooks merge-buffer-file))) |
4ae69eac MK |
1207 | |
1208 | ;;;###autoload | |
1209 | (defun run-ediff-from-cvs-buffer (pos) | |
1210 | "Run Ediff-merge on appropriate revisions of the selected file. | |
3af0304a | 1211 | First run after `M-x cvs-update'. Then place the cursor on a line describing a |
4ae69eac MK |
1212 | file and then run `run-ediff-from-cvs-buffer'." |
1213 | (interactive "d") | |
1214 | (ediff-load-version-control) | |
1215 | (let ((tin (tin-locate cvs-cookie-handle pos))) | |
1216 | (if tin | |
1217 | (cvs-run-ediff-on-file-descriptor tin) | |
1218 | (error "There is no file to merge")))) | |
0f0b0a86 KH |
1219 | |
1220 | ||
1221 | ;;; Apply patch | |
0f0b0a86 | 1222 | |
bbe6126c | 1223 | ;;;###autoload |
3af0304a MK |
1224 | (defun ediff-patch-file (&optional arg patch-buf) |
1225 | "Run Ediff by patching SOURCE-FILENAME. | |
1226 | If optional PATCH-BUF is given, use the patch in that buffer | |
1227 | and don't ask the user. | |
1228 | If prefix argument, then: if even argument, assume that the patch is in a | |
1229 | buffer. If odd -- assume it is in a file." | |
1230 | (interactive "P") | |
1231 | (let (source-dir source-file) | |
bbe6126c | 1232 | (require 'ediff-ptch) |
3af0304a MK |
1233 | (setq patch-buf |
1234 | (ediff-get-patch-buffer | |
1235 | (if arg (prefix-numeric-value arg)) patch-buf)) | |
bbe6126c MK |
1236 | (setq source-dir (cond (ediff-use-last-dir ediff-last-dir-patch) |
1237 | ((and (not ediff-patch-default-directory) | |
1238 | (buffer-file-name patch-buf)) | |
1239 | (file-name-directory | |
1240 | (expand-file-name | |
1241 | (buffer-file-name patch-buf)))) | |
1242 | (t default-directory))) | |
1243 | (setq source-file | |
1244 | ;; the default is the directory, not the visited file name | |
3af0304a MK |
1245 | (read-file-name |
1246 | "File to patch (directory, if multifile patch): " | |
1247 | source-dir (ediff-get-default-file-name))) | |
bbe6126c | 1248 | (ediff-dispatch-file-patching-job patch-buf source-file))) |
0f0b0a86 | 1249 | |
bbe6126c | 1250 | ;;;###autoload |
3af0304a | 1251 | (defun ediff-patch-buffer (&optional arg patch-buf) |
bbe6126c | 1252 | "Run Ediff by patching BUFFER-NAME." |
3af0304a MK |
1253 | (interactive "P") |
1254 | (require 'ediff-ptch) | |
1255 | (setq patch-buf | |
1256 | (ediff-get-patch-buffer | |
1257 | (if arg (prefix-numeric-value arg)) patch-buf)) | |
1258 | (ediff-patch-buffer-internal | |
1259 | patch-buf | |
1260 | (read-buffer | |
1261 | "Which buffer to patch? " | |
1262 | (ediff-prompt-for-patch-buffer)))) | |
0f0b0a86 | 1263 | |
3af0304a | 1264 | |
bbe6126c MK |
1265 | ;;;###autoload |
1266 | (defalias 'epatch 'ediff-patch-file) | |
1267 | ;;;###autoload | |
1268 | (defalias 'epatch-buffer 'ediff-patch-buffer) | |
0f0b0a86 KH |
1269 | |
1270 | ||
813f532d | 1271 | |
0f0b0a86 | 1272 | \f |
813f532d RS |
1273 | ;;; Versions Control functions |
1274 | ||
1275 | ;;;###autoload | |
87c668b4 MK |
1276 | (defun ediff-revision (&optional file startup-hooks) |
1277 | "Run Ediff by comparing versions of a file. | |
1278 | The file is an optional FILE argument or the file visited by the current | |
3af0304a | 1279 | buffer. Use `vc.el' or `rcs.el' depending on `ediff-version-control-package'." |
87c668b4 | 1280 | ;; if buffer is non-nil, use that buffer instead of the current buffer |
f1a5512a | 1281 | (interactive "P") |
87c668b4 | 1282 | (if (stringp file) (find-file file)) |
f1a5512a | 1283 | (let (rev1 rev2) |
87c668b4 MK |
1284 | (setq rev1 |
1285 | (read-string | |
1286 | (format "Version 1 to compare (default: %s's latest version): " | |
1287 | (if (stringp file) | |
1288 | (file-name-nondirectory file) "current buffer"))) | |
1289 | rev2 | |
1290 | (read-string | |
1291 | (format "Version 2 to compare (default: %s): " | |
1292 | (if (stringp file) | |
1293 | (file-name-nondirectory file) "current buffer")))) | |
f1a5512a KH |
1294 | (ediff-load-version-control) |
1295 | (funcall | |
92c51e07 | 1296 | (intern (format "ediff-%S-internal" ediff-version-control-package)) |
87c668b4 | 1297 | rev1 rev2 startup-hooks) |
f1a5512a | 1298 | )) |
1e70790f MK |
1299 | |
1300 | ||
1301 | ;;;###autoload | |
1302 | (defalias 'erevision 'ediff-revision) | |
0f0b0a86 | 1303 | |
0f0b0a86 KH |
1304 | |
1305 | ;; Test if version control package is loaded and load if not | |
1306 | ;; Is SILENT is non-nil, don't report error if package is not found. | |
1307 | (defun ediff-load-version-control (&optional silent) | |
4ae69eac | 1308 | (require 'ediff-vers) |
0f0b0a86 KH |
1309 | (or (featurep ediff-version-control-package) |
1310 | (if (locate-library (symbol-name ediff-version-control-package)) | |
1311 | (progn | |
1312 | (message "") ; kill the message from `locate-library' | |
87c668b4 | 1313 | (require ediff-version-control-package)) |
0f0b0a86 | 1314 | (or silent |
3af0304a | 1315 | (error "Version control package %S.el not found. Use vc.el instead" |
0f0b0a86 | 1316 | ediff-version-control-package))))) |
87c668b4 | 1317 | |
b3a26225 | 1318 | |
138df2ce MK |
1319 | ;;;###autoload |
1320 | (defun ediff-version () | |
1321 | "Return string describing the version of Ediff. | |
1322 | When called interactively, displays the version." | |
1323 | (interactive) | |
1324 | (if (interactive-p) | |
1325 | (message (ediff-version)) | |
1326 | (format "Ediff %s of %s" ediff-version ediff-date))) | |
1327 | ||
813f532d | 1328 | |
4ae69eac | 1329 | ;;;###autoload |
92c51e07 MK |
1330 | (defun ediff-documentation (&optional node) |
1331 | "Display Ediff's manual. | |
1332 | With optional NODE, goes to that node." | |
4ae69eac MK |
1333 | (interactive) |
1334 | (let ((ctl-window ediff-control-window) | |
1335 | (ctl-buf ediff-control-buffer)) | |
1336 | ||
1337 | (ediff-skip-unsuitable-frames) | |
1338 | (condition-case nil | |
1339 | (progn | |
1340 | (pop-to-buffer (get-buffer-create "*info*")) | |
1341 | (info (if ediff-xemacs-p "ediff.info" "ediff")) | |
92c51e07 MK |
1342 | (if node |
1343 | (Info-goto-node node) | |
1344 | (message "Type `i' to search for a specific topic")) | |
1345 | (raise-frame (selected-frame))) | |
4ae69eac | 1346 | (error (beep 1) |
bbe6126c | 1347 | (with-output-to-temp-buffer ediff-msg-buffer |
92c51e07 | 1348 | (princ ediff-BAD-INFO)) |
4ae69eac MK |
1349 | (if (window-live-p ctl-window) |
1350 | (progn | |
1351 | (select-window ctl-window) | |
1352 | (set-window-buffer ctl-window ctl-buf))))))) | |
1353 | ||
1354 | ||
1355 | ||
1356 | ||
1357 | ;;; Local Variables: | |
1358 | ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun) | |
e756eb9f MK |
1359 | ;;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1) |
1360 | ;;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body)) | |
4ae69eac MK |
1361 | ;;; End: |
1362 | ||
0f0b0a86 | 1363 | (require 'ediff-util) |
813f532d | 1364 | |
3af0304a MK |
1365 | (run-hooks 'ediff-load-hook) |
1366 | ||
813f532d | 1367 | ;;; ediff.el ends here |