annotate lisp/ediff.el @ 19026:db6728252ce2

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