1 ;;; ediff.el --- a comprehensive visual interface to diff & patch
3 ;; Copyright (C) 1994, 95, 96, 97, 98, 99, 2000, 01, 02, 03, 05 Free Software Foundation, Inc.
5 ;; Author: Michael Kifer <kifer@cs.stonybrook.edu>
6 ;; Created: February 2, 1994
7 ;; Keywords: comparing, merging, patching, tools, unix
9 (defconst ediff-version
"2.80" "The current version of Ediff")
10 (defconst ediff-date
"June 3, 2005" "Date of last update")
13 ;; This file is part of GNU Emacs.
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)
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.
25 ;; You should have received a copy of the GNU General Public License
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.
32 ;; Never read that diff output again!
33 ;; Apply patch interactively!
36 ;; This package provides a convenient way of simultaneous browsing through
37 ;; the differences between a pair (or a triple) of files or buffers. The
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).
44 ;; Ediff also supports merging operations on files and buffers, including
45 ;; merging using ancestor versions. Both comparison and merging operations can
46 ;; be performed on directories, i.e., by pairwise comparison of files in those
49 ;; In addition, Ediff can apply a patch to a file and then let you step
50 ;; though both files, the patched and the original one, simultaneously,
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
55 ;; region from file_orig to file, thereby undoing any particular patch that
58 ;; Ediff is aware of version control, which lets the user compare
59 ;; files with their older versions. Ediff can also work with remote and
60 ;; compressed files. Details are given below.
62 ;; Finally, Ediff supports directory-level comparison, merging and patching.
63 ;; See the on-line manual for details.
65 ;; This package builds upon the ideas borrowed from emerge.el and several
66 ;; Ediff's functions are adaptations from emerge.el. Much of the functionality
67 ;; Ediff provides is also influenced by emerge.el.
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
71 ;; particular, it can do patching, and 2-way and 3-way file comparison,
72 ;; merging, and directory operations.
78 ;; 1. The undo command doesn't restore deleted regions well. That is, if
79 ;; you delete all characters in a difference region and then invoke
80 ;; `undo', the reinstated text will most likely be inserted outside of
81 ;; what Ediff thinks is the current difference region. (This problem
82 ;; doesn't seem to exist with XEmacs.)
84 ;; If at any point you feel that difference regions are no longer correct,
85 ;; you can hit '!' to recompute the differences.
87 ;; 2. On a monochrome display, the repertoire of faces with which to
88 ;; highlight fine differences is limited. By default, Ediff is using
89 ;; underlining. However, if the region is already underlined by some other
90 ;; overlays, there is no simple way to temporarily remove that residual
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
95 ;; commands in `ediff-prepare-buffer-hook' (which will unhighlight every
96 ;; buffer used by Ediff) or you can execute them interactively, at any time
100 ;;; Acknowledgements:
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
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.
112 (defvar cvs-cookie-handle
)
113 (defvar ediff-last-dir-patch
)
114 (defvar ediff-patch-default-directory
)
118 (load-library "dired")
119 (load-library "info")
120 (load "pcl-cvs" 'noerror
)))
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
))
134 (require 'ediff-init
)
135 (require 'ediff-mult
) ; required because of the registry stuff
138 "A comprehensive visual interface to diff & patch."
143 (defcustom ediff-use-last-dir nil
144 "*If t, Ediff will use previous directory as default when reading file name."
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 nil
)
160 ;; Used as a startup hook to set `_orig' patch file read-only.
161 (defun ediff-set-read-only-in-buf-A ()
162 (ediff-with-current-buffer ediff-buffer-A
163 (toggle-read-only 1)))
165 ;; Return a plausible default for ediff's first file:
166 ;; In dired, return the file number FILENO (or 0) in the list
167 ;; (all-selected-files, filename under the cursor), where directories are
168 ;; ignored. Otherwise, return DEFAULT file name, if non-nil. Else,
169 ;; if the buffer is visiting a file, return that file name.
170 (defun ediff-get-default-file-name (&optional default fileno
)
171 (cond ((eq major-mode
'dired-mode
)
172 (let ((current (dired-get-filename nil
'no-error
))
173 (marked (condition-case nil
174 (dired-get-marked-files 'no-dir
)
176 aux-list choices result
)
177 (or (integerp fileno
) (setq fileno
0))
178 (if (stringp default
)
179 (setq aux-list
(cons default aux-list
)))
180 (if (and (stringp current
) (not (file-directory-p current
)))
181 (setq aux-list
(cons current aux-list
)))
182 (setq choices
(nconc marked aux-list
))
183 (setq result
(elt choices fileno
))
186 ((stringp default
) default
)
187 ((buffer-file-name (current-buffer))
188 (file-name-nondirectory (buffer-file-name (current-buffer))))
191 ;;; Compare files/buffers
194 (defun ediff-files (file-A file-B
&optional startup-hooks
)
195 "Run Ediff on a pair of files, FILE-A and FILE-B."
197 (let ((dir-A (if ediff-use-last-dir
201 (list (setq f
(ediff-read-file-name
204 (ediff-get-default-file-name)
206 (ediff-read-file-name "File B to compare"
208 (if ediff-use-last-dir
210 (file-name-directory f
)))
212 (setq file-name-history
213 (cons (ediff-abbreviate-file-name
215 (file-name-nondirectory f
)
218 (ediff-get-default-file-name f
1)))
220 (ediff-files-internal file-A
221 (if (file-directory-p file-B
)
223 (file-name-nondirectory file-A
) file-B
)
230 (defun ediff-files3 (file-A file-B file-C
&optional startup-hooks
)
231 "Run Ediff on three files, FILE-A, FILE-B, and FILE-C."
233 (let ((dir-A (if ediff-use-last-dir
237 (list (setq f
(ediff-read-file-name
240 (ediff-get-default-file-name)
242 (setq ff
(ediff-read-file-name "File B to compare"
244 (if ediff-use-last-dir
246 (file-name-directory f
)))
248 (setq file-name-history
250 (ediff-abbreviate-file-name
252 (file-name-nondirectory f
)
255 (ediff-get-default-file-name f
1))))
256 (ediff-read-file-name "File C to compare"
257 (setq dir-C
(if ediff-use-last-dir
259 (file-name-directory ff
)))
261 (setq file-name-history
262 (cons (ediff-abbreviate-file-name
264 (file-name-nondirectory ff
)
267 (ediff-get-default-file-name ff
2)))
269 (ediff-files-internal file-A
270 (if (file-directory-p file-B
)
272 (file-name-nondirectory file-A
) file-B
)
274 (if (file-directory-p file-C
)
276 (file-name-nondirectory file-A
) file-C
)
282 (defalias 'ediff3
'ediff-files3
)
285 ;; Visit FILE and arrange its buffer to Ediff's liking.
286 ;; FILE is actually a variable symbol that must contain a true file name.
287 ;; BUFFER-NAME is a variable symbol, which will get the buffer object into
288 ;; which FILE is read.
289 ;; LAST-DIR is the directory variable symbol where FILE's
290 ;; directory name should be returned. HOOKS-VAR is a variable symbol that will
291 ;; be assigned the hook to be executed after `ediff-startup' is finished.
292 ;; `ediff-find-file' arranges that the temp files it might create will be
294 (defun ediff-find-file (file-var buffer-name
&optional last-dir hooks-var
)
295 (let* ((file (symbol-value file-var
))
296 (file-magic (ediff-filename-magic-p file
))
297 (temp-file-name-prefix (file-name-nondirectory file
)))
298 (cond ((not (file-readable-p file
))
299 (error "File `%s' does not exist or is not readable" file
))
300 ((file-directory-p file
)
301 (error "File `%s' is a directory" file
)))
303 ;; some of the commands, below, require full file name
304 (setq file
(expand-file-name file
))
306 ;; Record the directory of the file
308 (set last-dir
(expand-file-name (file-name-directory file
))))
311 (set buffer-name
(find-file-noselect file
))
313 (ediff-with-current-buffer (symbol-value buffer-name
)
314 (widen) ; Make sure the entire file is seen
315 (cond (file-magic ; file has a handler, such as jka-compr-handler or
316 ;;; ange-ftp-hook-function--arrange for temp file
317 (ediff-verify-file-buffer 'magic
)
319 (ediff-make-temp-file
320 (current-buffer) temp-file-name-prefix
))
321 (set hooks-var
(cons `(lambda () (delete-file ,file
))
322 (symbol-value hooks-var
))))
323 ;; file processed via auto-mode-alist, a la uncompress.el
324 ((not (equal (file-truename file
)
325 (file-truename (buffer-file-name))))
327 (ediff-make-temp-file
328 (current-buffer) temp-file-name-prefix
))
329 (set hooks-var
(cons `(lambda () (delete-file ,file
))
330 (symbol-value hooks-var
))))
331 (t ;; plain file---just check that the file matches the buffer
332 (ediff-verify-file-buffer))))
333 (set file-var file
)))
335 ;; MERGE-BUFFER-FILE is the file to be associated with the merge buffer
336 (defun ediff-files-internal (file-A file-B file-C startup-hooks job-name
337 &optional merge-buffer-file
)
338 (let (buf-A buf-B buf-C
)
339 (if (string= file-A file-B
)
340 (error "Files A and B are the same"))
342 (or (and (string= file-A file-C
) (error "Files A and C are the same"))
343 (and (string= file-B file-C
) (error "Files B and C are the same"))))
344 (message "Reading file %s ... " file-A
)
346 (ediff-find-file 'file-A
'buf-A
'ediff-last-dir-A
'startup-hooks
)
347 (message "Reading file %s ... " file-B
)
349 (ediff-find-file 'file-B
'buf-B
'ediff-last-dir-B
'startup-hooks
)
352 (message "Reading file %s ... " file-C
)
356 (if (eq job-name
'ediff-merge-files-with-ancestor
)
357 'ediff-last-dir-ancestor
'ediff-last-dir-C
)
359 (ediff-setup buf-A file-A
363 (list (cons 'ediff-job-name job-name
))
368 (defalias 'ediff
'ediff-files
)
371 (defun ediff-backup (file)
372 "Run Ediff on FILE and its backup file.
373 Uses the latest backup, if there are several numerical backups.
374 If this file is a backup, `ediff' it with its original."
375 (interactive (list (read-file-name "Ediff (file with backup): ")))
376 ;; The code is taken from `diff-backup'.
379 (if (backup-file-name-p file
)
381 ori
(file-name-sans-versions file
))
382 (setq bak
(or (diff-latest-backup-file file
)
383 (error "No backup found for %s" file
))
385 (ediff-files bak ori
)))
388 (defun ediff-buffers (buffer-A buffer-B
&optional startup-hooks job-name
)
389 "Run Ediff on a pair of buffers, BUFFER-A and BUFFER-B."
392 (list (setq bf
(read-buffer "Buffer A to compare: "
393 (ediff-other-buffer "") t
))
394 (read-buffer "Buffer B to compare: "
396 ;; realign buffers so that two visible bufs will be
398 (save-window-excursion (other-window 1))
399 (ediff-other-buffer bf
))
401 (or job-name
(setq job-name
'ediff-buffers
))
402 (ediff-buffers-internal buffer-A buffer-B nil startup-hooks job-name
))
405 (defalias 'ebuffers
'ediff-buffers
)
409 (defun ediff-buffers3 (buffer-A buffer-B buffer-C
410 &optional startup-hooks job-name
)
411 "Run Ediff on three buffers, BUFFER-A, BUFFER-B, and BUFFER-C."
414 (list (setq bf
(read-buffer "Buffer A to compare: "
415 (ediff-other-buffer "") t
))
416 (setq bff
(read-buffer "Buffer B to compare: "
418 ;; realign buffers so that two visible
419 ;; bufs will be at the top
420 (save-window-excursion (other-window 1))
421 (ediff-other-buffer bf
))
423 (read-buffer "Buffer C to compare: "
425 ;; realign buffers so that three visible
426 ;; bufs will be at the top
427 (save-window-excursion (other-window 1))
428 (ediff-other-buffer (list bf bff
)))
431 (or job-name
(setq job-name
'ediff-buffers3
))
432 (ediff-buffers-internal buffer-A buffer-B buffer-C startup-hooks job-name
))
435 (defalias 'ebuffers3
'ediff-buffers3
)
439 ;; MERGE-BUFFER-FILE is the file to be associated with the merge buffer
440 (defun ediff-buffers-internal (buf-A buf-B buf-C startup-hooks job-name
441 &optional merge-buffer-file
)
442 (let* ((buf-A-file-name (buffer-file-name (get-buffer buf-A
)))
443 (buf-B-file-name (buffer-file-name (get-buffer buf-B
)))
444 (buf-C-is-alive (ediff-buffer-live-p buf-C
))
445 (buf-C-file-name (if buf-C-is-alive
446 (buffer-file-name (get-buffer buf-B
))))
447 file-A file-B file-C
)
448 (if (not (ediff-buffer-live-p buf-A
))
449 (error "Buffer %S doesn't exist" buf-A
))
450 (if (not (ediff-buffer-live-p buf-B
))
451 (error "Buffer %S doesn't exist" buf-B
))
452 (let ((ediff-job-name job-name
))
453 (if (and ediff-3way-comparison-job
454 (not buf-C-is-alive
))
455 (error "Buffer %S doesn't exist" buf-C
)))
456 (if (stringp buf-A-file-name
)
457 (setq buf-A-file-name
(file-name-nondirectory buf-A-file-name
)))
458 (if (stringp buf-B-file-name
)
459 (setq buf-B-file-name
(file-name-nondirectory buf-B-file-name
)))
460 (if (stringp buf-C-file-name
)
461 (setq buf-C-file-name
(file-name-nondirectory buf-C-file-name
)))
463 (setq file-A
(ediff-make-temp-file buf-A buf-A-file-name
)
464 file-B
(ediff-make-temp-file buf-B buf-B-file-name
))
466 (setq file-C
(ediff-make-temp-file buf-C buf-C-file-name
)))
468 (ediff-setup (get-buffer buf-A
) file-A
469 (get-buffer buf-B
) file-B
470 (if buf-C-is-alive
(get-buffer buf-C
))
473 (delete-file ,file-A
)
474 (delete-file ,file-B
)
475 (if (stringp ,file-C
) (delete-file ,file-C
)))
477 (list (cons 'ediff-job-name job-name
))
481 ;;; Directory and file group operations
483 ;; Get appropriate default name for directory:
484 ;; If ediff-use-last-dir, use ediff-last-dir-A.
485 ;; In dired mode, use the directory that is under the point (if any);
486 ;; otherwise, use default-directory
487 (defun ediff-get-default-directory-name ()
488 (cond (ediff-use-last-dir ediff-last-dir-A
)
489 ((eq major-mode
'dired-mode
)
490 (let ((f (dired-get-filename nil
'noerror
)))
491 (if (and (stringp f
) (file-directory-p f
))
494 (t default-directory
)))
498 (defun ediff-directories (dir1 dir2 regexp
)
499 "Run Ediff on a pair of directories, DIR1 and DIR2, comparing files that have
500 the same name in both. The third argument, REGEXP, is nil or a regular
501 expression; only file names that match the regexp are considered."
503 (let ((dir-A (ediff-get-default-directory-name))
504 (default-regexp (eval ediff-default-filtering-regexp
))
506 (list (setq f
(ediff-read-file-name "Directory A to compare:" dir-A nil
))
507 (ediff-read-file-name "Directory B to compare:"
508 (if ediff-use-last-dir
510 (ediff-strip-last-dir f
))
513 (if (stringp default-regexp
)
514 (format "Filter through regular expression (default %s): "
516 "Filter through regular expression: ")
518 'ediff-filtering-regexp-history
519 (eval ediff-default-filtering-regexp
))
521 (ediff-directories-internal
522 dir1 dir2 nil regexp
'ediff-files
'ediff-directories
526 (defalias 'edirs
'ediff-directories
)
530 (defun ediff-directory-revisions (dir1 regexp
)
531 "Run Ediff on a directory, DIR1, comparing its files with their revisions.
532 The second argument, REGEXP, is a regular expression that filters the file
533 names. Only the files that are under revision control are taken into account."
535 (let ((dir-A (ediff-get-default-directory-name))
536 (default-regexp (eval ediff-default-filtering-regexp
))
538 (list (ediff-read-file-name
539 "Directory to compare with revision:" dir-A nil
)
541 (if (stringp default-regexp
)
542 (format "Filter through regular expression (default %s): "
544 "Filter through regular expression: ")
546 'ediff-filtering-regexp-history
547 (eval ediff-default-filtering-regexp
))
549 (ediff-directory-revisions-internal
550 dir1 regexp
'ediff-revision
'ediff-directory-revisions
554 (defalias 'edir-revisions
'ediff-directory-revisions
)
558 (defun ediff-directories3 (dir1 dir2 dir3 regexp
)
559 "Run Ediff on three directories, DIR1, DIR2, and DIR3, comparing files that
560 have the same name in all three. The last argument, REGEXP, is nil or a
561 regular expression; only file names that match the regexp are considered."
564 (let ((dir-A (ediff-get-default-directory-name))
565 (default-regexp (eval ediff-default-filtering-regexp
))
567 (list (setq f
(ediff-read-file-name "Directory A to compare:" dir-A nil
))
568 (setq f
(ediff-read-file-name "Directory B to compare:"
569 (if ediff-use-last-dir
571 (ediff-strip-last-dir f
))
573 (ediff-read-file-name "Directory C to compare:"
574 (if ediff-use-last-dir
576 (ediff-strip-last-dir f
))
579 (if (stringp default-regexp
)
580 (format "Filter through regular expression (default %s): "
582 "Filter through regular expression: ")
584 'ediff-filtering-regexp-history
585 (eval ediff-default-filtering-regexp
))
587 (ediff-directories-internal
588 dir1 dir2 dir3 regexp
'ediff-files3
'ediff-directories3
592 (defalias 'edirs3
'ediff-directories3
)
595 (defun ediff-merge-directories (dir1 dir2 regexp
&optional merge-autostore-dir
)
596 "Run Ediff on a pair of directories, DIR1 and DIR2, merging files that have
597 the same name in both. The third argument, REGEXP, is nil or a regular
598 expression; only file names that match the regexp are considered."
600 (let ((dir-A (ediff-get-default-directory-name))
601 (default-regexp (eval ediff-default-filtering-regexp
))
603 (list (setq f
(ediff-read-file-name "Directory A to merge:" dir-A nil
))
604 (ediff-read-file-name "Directory B to merge:"
605 (if ediff-use-last-dir
607 (ediff-strip-last-dir f
))
610 (if (stringp default-regexp
)
611 (format "Filter through regular expression (default %s): "
613 "Filter through regular expression: ")
615 'ediff-filtering-regexp-history
616 (eval ediff-default-filtering-regexp
))
618 (ediff-directories-internal
619 dir1 dir2 nil regexp
'ediff-merge-files
'ediff-merge-directories
620 nil merge-autostore-dir
624 (defalias 'edirs-merge
'ediff-merge-directories
)
627 (defun ediff-merge-directories-with-ancestor (dir1 dir2 ancestor-dir regexp
630 "Merge files in directories DIR1 and DIR2 using files in ANCESTOR-DIR as ancestors.
631 Ediff merges files that have identical names in DIR1, DIR2. If a pair of files
632 in DIR1 and DIR2 doesn't have an ancestor in ANCESTOR-DIR, Ediff will merge
633 without ancestor. The fourth argument, REGEXP, is nil or a regular expression;
634 only file names that match the regexp are considered."
636 (let ((dir-A (ediff-get-default-directory-name))
637 (default-regexp (eval ediff-default-filtering-regexp
))
639 (list (setq f
(ediff-read-file-name "Directory A to merge:" dir-A nil
))
640 (setq f
(ediff-read-file-name "Directory B to merge:"
641 (if ediff-use-last-dir
643 (ediff-strip-last-dir f
))
645 (ediff-read-file-name "Ancestor directory:"
646 (if ediff-use-last-dir
648 (ediff-strip-last-dir f
))
651 (if (stringp default-regexp
)
652 (format "Filter through regular expression (default %s): "
654 "Filter through regular expression: ")
656 'ediff-filtering-regexp-history
657 (eval ediff-default-filtering-regexp
))
659 (ediff-directories-internal
660 dir1 dir2 ancestor-dir regexp
661 'ediff-merge-files-with-ancestor
'ediff-merge-directories-with-ancestor
662 nil merge-autostore-dir
666 (defun ediff-merge-directory-revisions (dir1 regexp
667 &optional merge-autostore-dir
)
668 "Run Ediff on a directory, DIR1, merging its files with their revisions.
669 The second argument, REGEXP, is a regular expression that filters the file
670 names. Only the files that are under revision control are taken into account."
672 (let ((dir-A (ediff-get-default-directory-name))
673 (default-regexp (eval ediff-default-filtering-regexp
))
675 (list (ediff-read-file-name
676 "Directory to merge with revisions:" dir-A nil
)
678 (if (stringp default-regexp
)
679 (format "Filter through regular expression (default %s): "
681 "Filter through regular expression: ")
683 'ediff-filtering-regexp-history
684 (eval ediff-default-filtering-regexp
))
686 (ediff-directory-revisions-internal
687 dir1 regexp
'ediff-merge-revisions
'ediff-merge-directory-revisions
688 nil merge-autostore-dir
692 (defalias 'edir-merge-revisions
'ediff-merge-directory-revisions
)
695 (defun ediff-merge-directory-revisions-with-ancestor (dir1 regexp
698 "Run Ediff on a directory, DIR1, merging its files with their revisions and ancestors.
699 The second argument, REGEXP, is a regular expression that filters the file
700 names. Only the files that are under revision control are taken into account."
702 (let ((dir-A (ediff-get-default-directory-name))
703 (default-regexp (eval ediff-default-filtering-regexp
))
705 (list (ediff-read-file-name
706 "Directory to merge with revisions and ancestors:" dir-A nil
)
708 (if (stringp default-regexp
)
709 (format "Filter through regular expression (default %s): "
711 "Filter through regular expression: ")
713 'ediff-filtering-regexp-history
714 (eval ediff-default-filtering-regexp
))
716 (ediff-directory-revisions-internal
717 dir1 regexp
'ediff-merge-revisions-with-ancestor
718 'ediff-merge-directory-revisions-with-ancestor
719 nil merge-autostore-dir
724 'edir-merge-revisions-with-ancestor
725 'ediff-merge-directory-revisions-with-ancestor
)
728 (defalias 'edirs-merge-with-ancestor
'ediff-merge-directories-with-ancestor
)
730 ;; Run ediff-action (ediff-files, ediff-merge, ediff-merge-with-ancestors)
731 ;; on a pair of directories (three directories, in case of ancestor).
732 ;; The third argument, REGEXP, is nil or a regular expression;
733 ;; only file names that match the regexp are considered.
734 ;; JOBNAME is the symbol indicating the meta-job to be performed.
735 ;; MERGE-AUTOSTORE-DIR is the directory in which to store merged files.
736 (defun ediff-directories-internal (dir1 dir2 dir3 regexp action jobname
737 &optional startup-hooks
739 ;; ediff-read-file-name is set to attach a previously entered file name if
740 ;; the currently entered file is a directory. This code takes care of that.
741 (setq dir1
(if (file-directory-p dir1
) dir1
(file-name-directory dir1
))
742 dir2
(if (file-directory-p dir2
) dir2
(file-name-directory dir2
)))
745 (setq dir3
(if (file-directory-p dir3
) dir3
(file-name-directory dir3
))))
747 (cond ((string= dir1 dir2
)
748 (error "Directories A and B are the same: %s" dir1
))
749 ((and (eq jobname
'ediff-directories3
)
751 (error "Directories A and C are the same: %s" dir1
))
752 ((and (eq jobname
'ediff-directories3
)
754 (error "Directories B and C are the same: %s" dir1
)))
756 (if merge-autostore-dir
757 (or (stringp merge-autostore-dir
)
758 (error "%s: Directory for storing merged files must be a string"
760 (let (;; dir-diff-struct is of the form (common-list diff-list)
761 ;; It is a structure where ediff-intersect-directories returns
762 ;; commonalities and differences among directories
765 (if (and ediff-autostore-merges
766 (ediff-merge-metajob jobname
)
767 (not merge-autostore-dir
))
768 (setq merge-autostore-dir
769 (read-file-name "Save merged files in directory: "
770 (if ediff-use-last-dir
771 ediff-last-merge-autostore-dir
772 (ediff-strip-last-dir dir1
))
775 ;; verify we are not merging into an orig directory
776 (if merge-autostore-dir
777 (cond ((and (stringp dir1
) (string= merge-autostore-dir dir1
))
779 "Directory for saving merged files = Directory A. Sure? ")
780 (error "Directory merge aborted")))
781 ((and (stringp dir2
) (string= merge-autostore-dir dir2
))
783 "Directory for saving merged files = Directory B. Sure? ")
784 (error "Directory merge aborted")))
785 ((and (stringp dir3
) (string= merge-autostore-dir dir3
))
787 "Directory for saving merged files = Ancestor Directory. Sure? ")
788 (error "Directory merge aborted")))))
790 (setq dir-diff-struct
(ediff-intersect-directories
792 regexp dir1 dir2 dir3 merge-autostore-dir
))
794 ;; this sets various vars in the meta buffer inside
795 ;; ediff-prepare-meta-buffer
797 ;; tell what to do if the user clicks on a session record
798 (setq ediff-session-action-function
(quote ,action
))
799 ;; set ediff-dir-difference-list
800 (setq ediff-dir-difference-list
801 (cdr (quote ,dir-diff-struct
))))
803 (setq meta-buf
(ediff-prepare-meta-buffer
804 'ediff-filegroup-action
805 (car dir-diff-struct
)
806 "*Ediff Session Group Panel"
807 'ediff-redraw-directory-group-buffer
810 (ediff-show-meta-buffer meta-buf
)
813 ;; MERGE-AUTOSTORE-DIR can be given to tell ediff where to store the merged
815 (defun ediff-directory-revisions-internal (dir1 regexp action jobname
816 &optional startup-hooks
818 (setq dir1
(if (file-directory-p dir1
) dir1
(file-name-directory dir1
)))
820 (if merge-autostore-dir
821 (or (stringp merge-autostore-dir
)
822 (error "%S: Directory for storing merged files must be a string"
824 (let (file-list meta-buf
)
825 (if (and ediff-autostore-merges
826 (ediff-merge-metajob jobname
)
827 (not merge-autostore-dir
))
828 (setq merge-autostore-dir
829 (read-file-name "Save merged files in directory: "
830 (if ediff-use-last-dir
831 ediff-last-merge-autostore-dir
832 (ediff-strip-last-dir dir1
))
835 ;; verify merge-autostore-dir != dir1
836 (if (and merge-autostore-dir
838 (string= merge-autostore-dir dir1
))
840 "Directory for saving merged file = directory A. Sure? ")
841 (error "Merge of directory revisions aborted")))
844 (ediff-get-directory-files-under-revision
845 jobname regexp dir1 merge-autostore-dir
))
847 ;; this sets various vars in the meta buffer inside
848 ;; ediff-prepare-meta-buffer
850 ;; tell what to do if the user clicks on a session record
851 (setq ediff-session-action-function
(quote ,action
)))
853 (setq meta-buf
(ediff-prepare-meta-buffer
854 'ediff-filegroup-action
856 "*Ediff Session Group Panel"
857 'ediff-redraw-directory-group-buffer
860 (ediff-show-meta-buffer meta-buf
)
864 ;;; Compare regions and windows
867 (defun ediff-windows-wordwise (dumb-mode &optional wind-A wind-B startup-hooks
)
868 "Compare WIND-A and WIND-B, which are selected by clicking, wordwise.
869 With prefix argument, DUMB-MODE, or on a non-windowing display, works as
871 If WIND-A is nil, use selected window.
872 If WIND-B is nil, use window next to WIND-A."
874 (ediff-windows dumb-mode wind-A wind-B
875 startup-hooks
'ediff-windows-wordwise
'word-mode
))
878 (defun ediff-windows-linewise (dumb-mode &optional wind-A wind-B startup-hooks
)
879 "Compare WIND-A and WIND-B, which are selected by clicking, linewise.
880 With prefix argument, DUMB-MODE, or on a non-windowing display, works as
882 If WIND-A is nil, use selected window.
883 If WIND-B is nil, use window next to WIND-A."
885 (ediff-windows dumb-mode wind-A wind-B
886 startup-hooks
'ediff-windows-linewise nil
))
888 ;; Compare WIND-A and WIND-B, which are selected by clicking.
889 ;; With prefix argument, DUMB-MODE, or on a non-windowing display,
891 ;; If WIND-A is nil, use selected window.
892 ;; If WIND-B is nil, use window next to WIND-A.
893 (defun ediff-windows (dumb-mode wind-A wind-B startup-hooks job-name word-mode
)
894 (if (or dumb-mode
(not (ediff-window-display-p)))
895 (setq wind-A
(ediff-get-next-window wind-A nil
)
896 wind-B
(ediff-get-next-window wind-B wind-A
))
897 (setq wind-A
(ediff-get-window-by-clicking wind-A nil
1)
898 wind-B
(ediff-get-window-by-clicking wind-B wind-A
2)))
900 (let ((buffer-A (window-buffer wind-A
))
901 (buffer-B (window-buffer wind-B
))
902 beg-A end-A beg-B end-B
)
905 (save-window-excursion
906 (sit-for 0) ; sync before using window-start/end -- a precaution
907 (select-window wind-A
)
908 (setq beg-A
(window-start)
910 (select-window wind-B
)
911 (setq beg-B
(window-start)
912 end-B
(window-end))))
914 (ediff-clone-buffer-for-window-comparison
915 buffer-A wind-A
"-Window.A-")
917 (ediff-clone-buffer-for-window-comparison
918 buffer-B wind-B
"-Window.B-"))
919 (ediff-regions-internal
920 buffer-A beg-A end-A buffer-B beg-B end-B
921 startup-hooks job-name word-mode nil
)))
925 (defun ediff-regions-wordwise (buffer-A buffer-B
&optional startup-hooks
)
926 "Run Ediff on a pair of regions in specified buffers.
927 Regions \(i.e., point and mark\) are assumed to be set in advance except
928 for the second region in the case both regions are from the same buffer.
929 In such a case the user is asked to interactively establish the second
931 This function is effective only for relatively small regions, up to 200
932 lines. For large regions, use `ediff-regions-linewise'."
935 (list (setq bf
(read-buffer "Region's A buffer: "
936 (ediff-other-buffer "") t
))
937 (read-buffer "Region's B buffer: "
939 ;; realign buffers so that two visible bufs will be
941 (save-window-excursion (other-window 1))
942 (ediff-other-buffer bf
))
944 (if (not (ediff-buffer-live-p buffer-A
))
945 (error "Buffer %S doesn't exist" buffer-A
))
946 (if (not (ediff-buffer-live-p buffer-B
))
947 (error "Buffer %S doesn't exist" buffer-B
))
951 (ediff-clone-buffer-for-region-comparison buffer-A
"-Region.A-"))
953 (ediff-clone-buffer-for-region-comparison buffer-B
"-Region.B-"))
954 reg-A-beg reg-A-end reg-B-beg reg-B-end
)
956 (set-buffer buffer-A
)
957 (setq reg-A-beg
(region-beginning)
958 reg-A-end
(region-end))
959 (set-buffer buffer-B
)
960 (setq reg-B-beg
(region-beginning)
961 reg-B-end
(region-end)))
963 (ediff-regions-internal
964 (get-buffer buffer-A
) reg-A-beg reg-A-end
965 (get-buffer buffer-B
) reg-B-beg reg-B-end
966 startup-hooks
'ediff-regions-wordwise
'word-mode nil
)))
969 (defun ediff-regions-linewise (buffer-A buffer-B
&optional startup-hooks
)
970 "Run Ediff on a pair of regions in specified buffers.
971 Regions \(i.e., point and mark\) are assumed to be set in advance except
972 for the second region in the case both regions are from the same buffer.
973 In such a case the user is asked to interactively establish the second
975 Each region is enlarged to contain full lines.
976 This function is effective for large regions, over 100-200
977 lines. For small regions, use `ediff-regions-wordwise'."
980 (list (setq bf
(read-buffer "Region A's buffer: "
981 (ediff-other-buffer "") t
))
982 (read-buffer "Region B's buffer: "
984 ;; realign buffers so that two visible bufs will be
986 (save-window-excursion (other-window 1))
987 (ediff-other-buffer bf
))
989 (if (not (ediff-buffer-live-p buffer-A
))
990 (error "Buffer %S doesn't exist" buffer-A
))
991 (if (not (ediff-buffer-live-p buffer-B
))
992 (error "Buffer %S doesn't exist" buffer-B
))
995 (ediff-clone-buffer-for-region-comparison buffer-A
"-Region.A-"))
997 (ediff-clone-buffer-for-region-comparison buffer-B
"-Region.B-"))
998 reg-A-beg reg-A-end reg-B-beg reg-B-end
)
1000 (set-buffer buffer-A
)
1001 (setq reg-A-beg
(region-beginning)
1002 reg-A-end
(region-end))
1003 ;; enlarge the region to hold full lines
1004 (goto-char reg-A-beg
)
1006 (setq reg-A-beg
(point))
1007 (goto-char reg-A-end
)
1009 (or (eobp) (forward-char)) ; include the newline char
1010 (setq reg-A-end
(point))
1012 (set-buffer buffer-B
)
1013 (setq reg-B-beg
(region-beginning)
1014 reg-B-end
(region-end))
1015 ;; enlarge the region to hold full lines
1016 (goto-char reg-B-beg
)
1018 (setq reg-B-beg
(point))
1019 (goto-char reg-B-end
)
1021 (or (eobp) (forward-char)) ; include the newline char
1022 (setq reg-B-end
(point))
1025 (ediff-regions-internal
1026 (get-buffer buffer-A
) reg-A-beg reg-A-end
1027 (get-buffer buffer-B
) reg-B-beg reg-B-end
1028 startup-hooks
'ediff-regions-linewise nil nil
))) ; no word mode
1030 ;; compare region beg-A to end-A of buffer-A
1031 ;; to regions beg-B -- end-B in buffer-B.
1032 (defun ediff-regions-internal (buffer-A beg-A end-A buffer-B beg-B end-B
1033 startup-hooks job-name word-mode
1035 (let ((tmp-buffer (get-buffer-create ediff-tmp-buffer
))
1039 ;; in case beg/end-A/B aren't markers--make them into markers
1040 (ediff-with-current-buffer buffer-A
1041 (setq beg-A
(move-marker (make-marker) beg-A
)
1042 end-A
(move-marker (make-marker) end-A
)))
1043 (ediff-with-current-buffer buffer-B
1044 (setq beg-B
(move-marker (make-marker) beg-B
)
1045 end-B
(move-marker (make-marker) end-B
)))
1049 (ediff-wordify beg-A end-A buffer-A tmp-buffer
)
1050 (ediff-copy-to-buffer beg-A end-A buffer-A tmp-buffer
))
1051 (setq file-A
(ediff-make-temp-file tmp-buffer
"regA"))
1055 (ediff-wordify beg-B end-B buffer-B tmp-buffer
)
1056 (ediff-copy-to-buffer beg-B end-B buffer-B tmp-buffer
))
1057 (setq file-B
(ediff-make-temp-file tmp-buffer
"regB"))
1059 (setq overl-A
(ediff-make-bullet-proof-overlay beg-A end-A buffer-A
))
1060 (setq overl-B
(ediff-make-bullet-proof-overlay beg-B end-B buffer-B
))
1061 (ediff-setup buffer-A file-A
1063 nil nil
; buffer & file C
1065 (delete-file ,file-A
)
1066 (delete-file ,file-B
))
1069 (list (cons 'ediff-word-mode word-mode
)
1070 (cons 'ediff-narrow-bounds
(list overl-A overl-B
))
1071 (cons 'ediff-job-name job-name
))
1076 ;;; Merge files and buffers
1079 (defalias 'ediff-merge
'ediff-merge-files
)
1081 (defsubst ediff-merge-on-startup
()
1083 ;; Can't remember why this is here, but it may cause the automatically merged
1084 ;; buffer to be lost. So, keep the buffer modified.
1085 ;;(ediff-with-current-buffer ediff-buffer-C
1086 ;; (set-buffer-modified-p nil))
1090 (defun ediff-merge-files (file-A file-B
1091 ;; MERGE-BUFFER-FILE is the file to be
1092 ;; associated with the merge buffer
1093 &optional startup-hooks merge-buffer-file
)
1094 "Merge two files without ancestor."
1096 (let ((dir-A (if ediff-use-last-dir
1100 (list (setq f
(ediff-read-file-name
1103 (ediff-get-default-file-name)
1105 (ediff-read-file-name "File B to merge"
1107 (if ediff-use-last-dir
1109 (file-name-directory f
)))
1111 (setq file-name-history
1112 (cons (ediff-abbreviate-file-name
1114 (file-name-nondirectory f
)
1117 (ediff-get-default-file-name f
1)))
1119 (setq startup-hooks
(cons 'ediff-merge-on-startup startup-hooks
))
1120 (ediff-files-internal file-A
1121 (if (file-directory-p file-B
)
1123 (file-name-nondirectory file-A
) file-B
)
1131 (defun ediff-merge-files-with-ancestor (file-A file-B file-ancestor
1134 ;; MERGE-BUFFER-FILE is the file
1135 ;; to be associated with the
1138 "Merge two files with ancestor."
1140 (let ((dir-A (if ediff-use-last-dir
1143 dir-B dir-ancestor f ff
)
1144 (list (setq f
(ediff-read-file-name
1147 (ediff-get-default-file-name)
1149 (setq ff
(ediff-read-file-name "File B to merge"
1151 (if ediff-use-last-dir
1153 (file-name-directory f
)))
1155 (setq file-name-history
1157 (ediff-abbreviate-file-name
1159 (file-name-nondirectory f
)
1162 (ediff-get-default-file-name f
1))))
1163 (ediff-read-file-name "Ancestor file"
1165 (if ediff-use-last-dir
1166 ediff-last-dir-ancestor
1167 (file-name-directory ff
)))
1169 (setq file-name-history
1170 (cons (ediff-abbreviate-file-name
1172 (file-name-nondirectory ff
)
1175 (ediff-get-default-file-name ff
2)))
1177 (setq startup-hooks
(cons 'ediff-merge-on-startup startup-hooks
))
1178 (ediff-files-internal file-A
1179 (if (file-directory-p file-B
)
1181 (file-name-nondirectory file-A
) file-B
)
1185 'ediff-merge-files-with-ancestor
1189 (defalias 'ediff-merge-with-ancestor
'ediff-merge-files-with-ancestor
)
1192 (defun ediff-merge-buffers (buffer-A buffer-B
1194 ;; MERGE-BUFFER-FILE is the file to be
1195 ;; associated with the merge buffer
1196 startup-hooks job-name merge-buffer-file
)
1197 "Merge buffers without ancestor."
1200 (list (setq bf
(read-buffer "Buffer A to merge: "
1201 (ediff-other-buffer "") t
))
1202 (read-buffer "Buffer B to merge: "
1204 ;; realign buffers so that two visible bufs will be
1206 (save-window-excursion (other-window 1))
1207 (ediff-other-buffer bf
))
1210 (setq startup-hooks
(cons 'ediff-merge-on-startup startup-hooks
))
1211 (or job-name
(setq job-name
'ediff-merge-buffers
))
1212 (ediff-buffers-internal
1213 buffer-A buffer-B nil startup-hooks job-name merge-buffer-file
))
1216 (defun ediff-merge-buffers-with-ancestor (buffer-A buffer-B buffer-ancestor
1220 ;; MERGE-BUFFER-FILE is the
1221 ;; file to be associated
1222 ;; with the merge buffer
1224 "Merge buffers with ancestor."
1227 (list (setq bf
(read-buffer "Buffer A to merge: "
1228 (ediff-other-buffer "") t
))
1229 (setq bff
(read-buffer "Buffer B to merge: "
1231 ;; realign buffers so that two visible
1232 ;; bufs will be at the top
1233 (save-window-excursion (other-window 1))
1234 (ediff-other-buffer bf
))
1236 (read-buffer "Ancestor buffer: "
1238 ;; realign buffers so that three visible
1239 ;; bufs will be at the top
1240 (save-window-excursion (other-window 1))
1241 (ediff-other-buffer (list bf bff
)))
1245 (setq startup-hooks
(cons 'ediff-merge-on-startup startup-hooks
))
1246 (or job-name
(setq job-name
'ediff-merge-buffers-with-ancestor
))
1247 (ediff-buffers-internal
1248 buffer-A buffer-B buffer-ancestor startup-hooks job-name merge-buffer-file
))
1252 (defun ediff-merge-revisions (&optional file startup-hooks merge-buffer-file
)
1253 ;; MERGE-BUFFER-FILE is the file to be associated with the merge buffer
1254 "Run Ediff by merging two revisions of a file.
1255 The file is the optional FILE argument or the file visited by the current
1258 (if (stringp file
) (find-file file
))
1263 "Version 1 to merge (default: %s's working version): "
1265 (file-name-nondirectory file
) "current buffer")))
1269 "Version 2 to merge (default: %s): "
1271 (file-name-nondirectory file
) "current buffer"))))
1272 (ediff-load-version-control)
1273 ;; ancestor-revision=nil
1275 (intern (format "ediff-%S-merge-internal" ediff-version-control-package
))
1276 rev1 rev2 nil startup-hooks merge-buffer-file
)))
1280 (defun ediff-merge-revisions-with-ancestor (&optional
1282 ;; MERGE-BUFFER-FILE is the file to
1283 ;; be associated with the merge
1286 "Run Ediff by merging two revisions of a file with a common ancestor.
1287 The file is the optional FILE argument or the file visited by the current
1290 (if (stringp file
) (find-file file
))
1291 (let (rev1 rev2 ancestor-rev
)
1295 "Version 1 to merge (default: %s's working version): "
1297 (file-name-nondirectory file
) "current buffer")))
1301 "Version 2 to merge (default: %s): "
1303 (file-name-nondirectory file
) "current buffer")))
1307 "Ancestor version (default: %s's base revision): "
1309 (file-name-nondirectory file
) "current buffer"))))
1310 (ediff-load-version-control)
1312 (intern (format "ediff-%S-merge-internal" ediff-version-control-package
))
1313 rev1 rev2 ancestor-rev startup-hooks merge-buffer-file
)))
1315 ;; MK: Check. This function doesn't seem to be used any more by pcvs or pcl-cvs
1317 (defun run-ediff-from-cvs-buffer (pos)
1318 "Run Ediff-merge on appropriate revisions of the selected file.
1319 First run after `M-x cvs-update'. Then place the cursor on a line describing a
1320 file and then run `run-ediff-from-cvs-buffer'."
1322 (ediff-load-version-control)
1323 (let ((tin (tin-locate cvs-cookie-handle pos
)))
1325 (cvs-run-ediff-on-file-descriptor tin
)
1326 (error "There is no file to merge"))))
1332 (defun ediff-patch-file (&optional arg patch-buf
)
1333 "Run Ediff by patching SOURCE-FILENAME.
1334 If optional PATCH-BUF is given, use the patch in that buffer
1335 and don't ask the user.
1336 If prefix argument, then: if even argument, assume that the patch is in a
1337 buffer. If odd -- assume it is in a file."
1339 (let (source-dir source-file
)
1340 (require 'ediff-ptch
)
1342 (ediff-get-patch-buffer
1343 (if arg
(prefix-numeric-value arg
)) patch-buf
))
1344 (setq source-dir
(cond (ediff-use-last-dir ediff-last-dir-patch
)
1345 ((and (not ediff-patch-default-directory
)
1346 (buffer-file-name patch-buf
))
1347 (file-name-directory
1349 (buffer-file-name patch-buf
))))
1350 (t default-directory
)))
1353 "File to patch (directory, if multifile patch): "
1354 ;; use an explicit initial file
1355 source-dir nil nil
(ediff-get-default-file-name)))
1356 (ediff-dispatch-file-patching-job patch-buf source-file
)))
1359 (defun ediff-patch-buffer (&optional arg patch-buf
)
1360 "Run Ediff by patching BUFFER-NAME.
1361 Without prefix argument: asks if the patch is in some buffer and prompts for
1362 the buffer or a file, depending on the answer.
1363 With prefix arg=1: assumes the patch is in a file and prompts for the file.
1364 With prefix arg=2: assumes the patch is in a buffer and prompts for the buffer."
1366 (require 'ediff-ptch
)
1368 (ediff-get-patch-buffer
1369 (if arg
(prefix-numeric-value arg
)) patch-buf
))
1370 (ediff-patch-buffer-internal
1373 "Which buffer to patch? "
1378 (defalias 'epatch
'ediff-patch-file
)
1380 (defalias 'epatch-buffer
'ediff-patch-buffer
)
1385 ;;; Versions Control functions
1388 (defun ediff-revision (&optional file startup-hooks
)
1389 "Run Ediff by comparing versions of a file.
1390 The file is an optional FILE argument or the file entered at the prompt.
1391 Default: the file visited by the current buffer.
1392 Uses `vc.el' or `rcs.el' depending on `ediff-version-control-package'."
1393 ;; if buffer is non-nil, use that buffer instead of the current buffer
1395 (if (not (stringp file
))
1397 (ediff-read-file-name "Compare revisions for file"
1398 (if ediff-use-last-dir
1401 (ediff-get-default-file-name)
1404 (if (and (buffer-modified-p)
1405 (y-or-n-p (message "Buffer %s is modified. Save buffer? "
1407 (save-buffer (current-buffer)))
1411 (format "Revision 1 to compare (default: %s's latest revision): "
1412 (file-name-nondirectory file
)))
1415 (format "Revision 2 to compare (default: %s's current state): "
1416 (file-name-nondirectory file
))))
1417 (ediff-load-version-control)
1419 (intern (format "ediff-%S-internal" ediff-version-control-package
))
1420 rev1 rev2 startup-hooks
)
1425 (defalias 'erevision
'ediff-revision
)
1428 ;; Test if version control package is loaded and load if not
1429 ;; Is SILENT is non-nil, don't report error if package is not found.
1430 (defun ediff-load-version-control (&optional silent
)
1431 (require 'ediff-vers
)
1432 (or (featurep ediff-version-control-package
)
1433 (if (locate-library (symbol-name ediff-version-control-package
))
1435 (message "") ; kill the message from `locate-library'
1436 (require ediff-version-control-package
))
1438 (error "Version control package %S.el not found. Use vc.el instead"
1439 ediff-version-control-package
)))))
1443 (defun ediff-version ()
1444 "Return string describing the version of Ediff.
1445 When called interactively, displays the version."
1448 (message (ediff-version))
1449 (format "Ediff %s of %s" ediff-version ediff-date
)))
1453 (defun ediff-documentation (&optional node
)
1454 "Display Ediff's manual.
1455 With optional NODE, goes to that node."
1457 (let ((ctl-window ediff-control-window
)
1458 (ctl-buf ediff-control-buffer
))
1460 (ediff-skip-unsuitable-frames)
1463 (pop-to-buffer (get-buffer-create "*info*"))
1464 (info (if ediff-xemacs-p
"ediff.info" "ediff"))
1466 (Info-goto-node node
)
1467 (message "Type `i' to search for a specific topic"))
1468 (raise-frame (selected-frame)))
1470 (with-output-to-temp-buffer ediff-msg-buffer
1471 (ediff-with-current-buffer standard-output
1473 (princ ediff-BAD-INFO
))
1474 (if (window-live-p ctl-window
)
1476 (select-window ctl-window
)
1477 (set-window-buffer ctl-window ctl-buf
)))))))
1480 (dolist (mess '("^Errors in diff output. Diff output is in "
1481 "^Hmm... I don't see an Ediff command around here...$"
1482 "^Undocumented command! Type `G' in Ediff Control Panel to drop a note to the Ediff maintainer$"
1483 ": This command runs in Ediff Control Buffer only!$"
1484 ": Invalid op in ediff-check-version$"
1485 "^ediff-shrink-window-C can be used only for merging jobs$"
1486 "^Lost difference info on these directories$"
1487 "^This command is inapplicable in the present context$"
1488 "^This session group has no parent$"
1489 "^Can't hide active session, $"
1490 "^Ediff: something wrong--no multiple diffs buffer$"
1491 "^Can't make context diff for Session $"
1492 "^The patch buffer wasn't found$"
1494 "^This Ediff session is not part of a session group$"
1495 "^No active Ediff sessions or corrupted session registry$"
1496 "^No session info in this line$"
1497 "^`.*' is not an ordinary file$"
1498 "^Patch appears to have failed$"
1499 "^Recomputation of differences cancelled$"
1500 "^No fine differences in this mode$"
1501 "^Lost connection to ancestor buffer...sorry$"
1502 "^Not merging with ancestor$"
1503 "^Don't know how to toggle read-only in buffer "
1504 "Emacs is not running as a window application$"
1505 "^This command makes sense only when merging with an ancestor$"
1506 "^At end of the difference list$"
1507 "^At beginning of the difference list$"
1508 "^Nothing saved for diff .* in buffer "
1509 "^Buffer is out of sync for file "
1510 "^Buffer out of sync for file "
1511 "^Output from `diff' not found$"
1512 "^You forgot to specify a region in buffer "
1513 "^All right. Make up your mind and come back...$"
1514 "^Current buffer is not visiting any file$"
1515 "^Failed to retrieve revision: $"
1516 "^Can't determine display width.$"
1517 "^File `.*' does not exist or is not readable$"
1518 "^File `.*' is a directory$"
1519 "^Buffer .* doesn't exist$"
1520 "^Directories . and . are the same: "
1521 "^Directory merge aborted$"
1522 "^Merge of directory revisions aborted$"
1523 "^Buffer .* doesn't exist$"
1524 "^There is no file to merge$"
1525 "^Version control package .*.el not found. Use vc.el instead$"))
1526 (add-to-list 'debug-ignored-errors mess
))
1529 ;;; Local Variables:
1530 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
1531 ;;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1)
1532 ;;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body))
1535 (require 'ediff-util
)
1537 (run-hooks 'ediff-load-hook
)
1539 ;;; arch-tag: 97c71396-db02-4f41-8b48-6a51c3348fcc
1540 ;;; ediff.el ends here