annotate lisp/ediff.el @ 14567:94dd08880c3b

(picture-mode-map): Install picture-self-insert where completion has put its own self-insert commands.
author Richard M. Stallman <rms@gnu.org>
date Wed, 14 Feb 1996 20:11:04 +0000
parents 83f275dcd93a
children c768f6d7daaa
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
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
3 ;; Copyright (C) 1994, 1995 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
13217
c3f879af05db (ediff-version): is now autoloaded.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 13133
diff changeset
9 (defconst ediff-version "2.47" "The current version of Ediff")
c3f879af05db (ediff-version): is now autoloaded.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 13133
diff changeset
10 (defconst ediff-date "October 11, 1995" "Date of last update")
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
11
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 ;; This file is part of GNU Emacs.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 ;; GNU Emacs is free software; you can redistribute it and/or modify
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;; 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
16 ;; the Free Software Foundation; either version 2, or (at your option)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; any later version.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; GNU Emacs is distributed in the hope that it will be useful,
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; GNU General Public License for more details.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24 ;; 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
25 ;; 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
26 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 14040
diff changeset
27 ;; Boston, MA 02111-1307, USA.
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 ;;; Commentary:
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
31 ;; Never read that diff output again!
7391
c40d16ee57bf entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 7267
diff changeset
32 ;; Apply patch selectively, like a pro!
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
33 ;; Merge with ease!
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34
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
35 ;; 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
36 ;; 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
37 ;; 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
38 ;; 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
39 ;; 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
40 ;; 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
41 ;; another (and recover old differences if you change your mind).
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
43 ;; 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
44 ;; 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
45 ;; 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
46 ;; directories.
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
47
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 ;; 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
49 ;; though both files, the patched and the original one, simultaneously,
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 ;; 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
51 ;; 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
52 ;; Since Ediff lets you copy differences between buffers, you can, in
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53 ;; 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
54 ;; 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
55 ;; you don't like).
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
57 ;; 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
58 ;; 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
59 ;; compressed files. Details are given below.
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
60
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
61 ;; Finally, Ediff supports directory-level comparison and merging operations.
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
62 ;; See the on-line manual for details.
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
64 ;; 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
65 ;; 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
66 ;; 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
67
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
68 ;; 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
69 ;; 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
70 ;; 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
71 ;; merging, and directory operations.
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 ;;; Bugs:
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 ;; 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
76 ;; 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
77 ;; `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
78 ;; 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
79 ;; doesn't seem to exist with XEmacs.)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
80 ;;
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
81 ;; 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
82 ;; you can hit '!' to recompute the differences.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
83
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
84 ;; 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
85 ;; highlight fine differences is limited. By default, Ediff is using
14040
187735b53d52 Comment fixes.
Karl Heuer <kwzh@gnu.org>
parents: 13604
diff changeset
86 ;; 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
87 ;; 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
88 ;; 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
89 ;; 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
90 ;; 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
91 ;; 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
92 ;; 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
93 ;; 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
94 ;; and on any buffer.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
95
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
96 ;;; Acknowledgements:
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
97
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
98 ;; 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
99 ;; 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
100 ;; 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
101 ;; 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
102
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 ;;; Code:
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
105 (require 'ediff-init)
13604
81099f6b6fb1 (ediff-mult): Require ediff-mult.
Richard M. Stallman <rms@gnu.org>
parents: 13217
diff changeset
106 (require 'ediff-mult)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
107
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 (defvar ediff-use-last-dir nil
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
109 "*If t, Ediff uses previous directory as default when reading file name.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 (defvar ediff-last-dir-A nil
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 "Last directory used by an Ediff command for file-A.")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 (defvar ediff-last-dir-B nil
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 "Last directory used by an Ediff command for file-B.")
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
115 (defvar ediff-last-dir-C nil
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
116 "Last directory used by an Ediff command for file-C.")
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
117 (defvar ediff-last-dir-ancestor nil
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
118 "Last directory used by an Ediff command for the ancestor file.")
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
119 (defvar ediff-last-dir-patch nil
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
120 "Last directory used by an Ediff command for file to patch.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
122 ;;; Patching
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
124 (defvar ediff-backup-extension
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
125 (if (memq system-type '(vax-vms axp-vms emx ms-dos windows-nt windows-95))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
126 "_orig" ".orig")
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
127 "Default backup extension for the patch program.")
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
128
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
129 ;;;###autoload
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
130 (defun ediff-patch-file (source-filename &optional startup-hooks job-name)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
131 "Run Ediff by patching FILE-TP-PATCH."
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
132 ;; This now returns the control buffer
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
133 (interactive
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
134 (list (ediff-read-file-name
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
135 "File to patch"
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
136 (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
137 ediff-last-dir-patch
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
138 default-directory)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
139 (ediff-get-default-file-name))))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
140
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
141 (setq source-filename (expand-file-name source-filename))
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
142 (ediff-get-patch-buffer
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
143 (if (eq job-name 'ediff-patch-buffer)
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
144 (ediff-eval-in-buffer (get-file-buffer source-filename)
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
145 default-directory)
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
146 (file-name-directory source-filename)))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
147
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
148 (let* ((backup-extension
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
149 ;; if the user specified a -b option, extract the backup
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
150 ;; extension from there; else use ediff-backup-extension
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
151 (substring ediff-patch-options
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
152 (if (string-match "-b[ \t]+" ediff-patch-options)
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
153 (match-end 0) 0)
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
154 (if (string-match "-b[ \t]+[^ \t]+" ediff-patch-options)
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
155 (match-end 0) 0)))
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
156 (shell-file-name ediff-shell)
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
157 ;; ediff-find-file may use a temp file to do the patch
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
158 ;; so, we save source-filename and true-source-filename as a var
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
159 ;; that initially is source-filename but may be changed to a temp
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
160 ;; file for the purpose of patching.
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
161 (true-source-filename source-filename)
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
162 (target-filename source-filename)
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
163 target-buf buf-to-patch file-name-magic-p ctl-buf)
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
164
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
165 ;; if the user didn't specify a backup extension, use
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
166 ;; ediff-backup-extension
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
167 (if (string= backup-extension "")
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
168 (setq backup-extension ediff-backup-extension))
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
169
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
170 ;; Make a temp file, if source-filename has a magic file handler (or if
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
171 ;; it is handled via auto-mode-alist and similar magic).
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
172 ;; Check if there is a buffer visiting source-filename and if they are in
14040
187735b53d52 Comment fixes.
Karl Heuer <kwzh@gnu.org>
parents: 13604
diff changeset
173 ;; sync; arrange for the deletion of temp file.
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
174 (ediff-find-file 'true-source-filename 'buf-to-patch
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
175 'ediff-last-dir-patch 'startup-hooks)
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
176
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
177 ;; Check if source file name has triggered black magic, such as file name
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
178 ;; handlers or auto mode alist, and make a note of it.
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
179 ;; true-source-filename should be either the original name or a
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
180 ;; temporary file where we put the after-product of the file handler.
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
181 (setq file-name-magic-p (not (equal (file-truename true-source-filename)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
182 (file-truename source-filename))))
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
183
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
184 ;; Checkout orig file, if necessary, so that the patched file could be
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
185 ;; checked back in.
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
186 (if (ediff-file-checked-in-p (buffer-file-name buf-to-patch))
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
187 (ediff-toggle-read-only buf-to-patch))
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
188
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
189 (ediff-eval-in-buffer ediff-patch-diagnostics
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
190 (message "Applying patch ... ")
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
191 ;;(sit-for 0)
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
192 ;; always pass patch the -f option, so it won't ask any questions
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
193 (shell-command-on-region
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
194 (point-min) (point-max)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
195 (format "%s -f %s -b %s %s"
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
196 ediff-patch-program ediff-patch-options
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
197 backup-extension
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
198 (expand-file-name true-source-filename))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
199 t))
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
200 ;;(message "Applying patch ... done")(sit-for 0)
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
201 (switch-to-buffer ediff-patch-diagnostics)
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
202 (sit-for 0) ; synchronize - let the user see diagnostics
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
203
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
204 (or (file-exists-p (concat true-source-filename backup-extension))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
205 (error "Patch failed or didn't modify the original file"))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
206
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
207 ;; If black magic is involved, apply patch to a temp copy of the
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
208 ;; file. Otherwise, apply patch to the orig copy. If patch is applied
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
209 ;; to temp copy, we name the result old-name_patched for local files
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
210 ;; and temp-copy_patched for remote files. The orig file name isn't
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
211 ;; changed, and the temp copy of the original is later deleted.
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
212 ;; Without magic, the original file is renamed (usually into
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
213 ;; old-name_orig) and the result of patching will have the same name as
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
214 ;; the original.
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
215 (if (not file-name-magic-p)
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
216 (ediff-eval-in-buffer buf-to-patch
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
217 (set-visited-file-name (concat source-filename backup-extension))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
218 (set-buffer-modified-p nil))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
219
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
220 ;; Black magic in effect.
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
221 ;; If orig file was remote, put the patched file in the temp directory.
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
222 ;; If orig file is local, put the patched file in the directory of
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
223 ;; the orig file.
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
224 (setq target-filename
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
225 (concat
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
226 (if (ediff-file-remote-p (file-truename source-filename))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
227 true-source-filename
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
228 source-filename)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
229 "_patched"))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
230
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
231 (rename-file true-source-filename target-filename t)
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
232
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
233 ;; arrange that the temp copy of orig will be deleted
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
234 (rename-file (concat true-source-filename backup-extension)
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
235 true-source-filename t))
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
236
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
237 ;; make orig buffer read-only
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
238 (setq startup-hooks
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
239 (cons 'ediff-set-read-only-in-buf-A startup-hooks))
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
240
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
241 ;; set up a buf for the patched file
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
242 (setq target-buf (find-file-noselect target-filename))
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
243
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
244 (setq ctl-buf
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
245 (ediff-buffers-internal
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
246 buf-to-patch target-buf nil
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
247 startup-hooks (or job-name 'ediff-patch-file)))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
248
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
249 (bury-buffer ediff-patch-diagnostics)
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
250 (message "Patch diagnostics are available in buffer %s"
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
251 (buffer-name ediff-patch-diagnostics))
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
252 ctl-buf))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
253
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
254 (defun ediff-set-read-only-in-buf-A ()
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
255 "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
256 (ediff-eval-in-buffer ediff-buffer-A
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
257 (toggle-read-only 1)))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
258
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
259 ;; 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
260 ;; 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
261 ;; 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
262 (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
263 (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
264 (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
265 (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
266 f)))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
267 ((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
268 (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
269 ))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
270
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
271 ;;;###autoload
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
272 (defalias 'epatch 'ediff-patch-file)
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
273 ;;;###autoload
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
274 (defalias 'epatch-buffer 'ediff-patch-buffer)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
275
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
276 ;;; Compare files/buffers
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
277
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
278 ;;;###autoload
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
279 (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
280 "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
281 (interactive
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
282 (let ((dir-A (if ediff-use-last-dir
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
283 ediff-last-dir-A
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
284 default-directory))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
285 dir-B f)
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
286 (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
287 "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
288 (ediff-get-default-file-name)))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
289 (ediff-read-file-name "File B to compare"
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
290 (setq dir-B
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
291 (if ediff-use-last-dir
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
292 ediff-last-dir-B
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
293 (file-name-directory f)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
294 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
295 (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
296 (cons (ediff-abbreviate-file-name
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
297 (expand-file-name
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
298 (file-name-nondirectory f)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
299 dir-B))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
300 file-name-history))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
301 f))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
302 )))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
303 (ediff-files-internal file-A
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
304 (if (file-directory-p file-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
305 (expand-file-name
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
306 (file-name-nondirectory file-A) file-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
307 file-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
308 nil ; file-C
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
309 startup-hooks
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
310 'ediff-files))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
311
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
312 ;;;###autoload
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
313 (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
314 "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
315 (interactive
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
316 (let ((dir-A (if ediff-use-last-dir
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
317 ediff-last-dir-A
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
318 default-directory))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
319 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
320 (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
321 "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
322 (ediff-get-default-file-name)))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
323 (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
324 (setq dir-B
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
325 (if ediff-use-last-dir
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
326 ediff-last-dir-B
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
327 (file-name-directory f)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
328 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
329 (setq file-name-history
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
330 (cons
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
331 (ediff-abbreviate-file-name
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
332 (expand-file-name
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
333 (file-name-nondirectory f)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
334 dir-B))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
335 file-name-history))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
336 f)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
337 (ediff-read-file-name "File C to compare"
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
338 (setq dir-C (if ediff-use-last-dir
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
339 ediff-last-dir-C
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
340 (file-name-directory ff)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
341 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
342 (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
343 (cons (ediff-abbreviate-file-name
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
344 (expand-file-name
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
345 (file-name-nondirectory ff)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
346 dir-C))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
347 file-name-history))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
348 ff))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
349 )))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
350 (ediff-files-internal file-A
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
351 (if (file-directory-p file-B)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
352 (expand-file-name
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
353 (file-name-nondirectory file-A) file-B)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
354 file-B)
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
355 (if (file-directory-p file-C)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
356 (expand-file-name
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
357 (file-name-nondirectory file-A) file-C)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
358 file-C)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
359 startup-hooks
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
360 'ediff-files3))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
361
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
362 ;;;###autoload
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
363 (defalias 'ediff3 'ediff-files3)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
364
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
365
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
366 (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
367 "Visit FILE and arrange its buffer to Ediff's liking.
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
368 FILE is actually a variable symbol that must contain a true file name.
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
369 BUFFER-NAME is a variable symbol, which will get the buffer object into which
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
370 FILE is read. LAST-DIR is the directory variable symbol where FILE's
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
371 directory name should be returned. HOOKS is a variable symbol that will be
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
372 assigned the hook to be executed after `ediff-startup' is finished.
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
373 `ediff-find-file' arranges that the temp files it might create will be
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
374 deleted."
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
375 (let* ((file (symbol-value file-var))
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
376 (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
377 (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
378 (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
379 (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
380 ((file-directory-p file)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
381 (error "File `%s' is a directory" file)))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
382
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
383 ;; some of the command, below, require full file name
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
384 (setq file (expand-file-name file))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
385
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
386 ;; Record the directory of the file
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
387 (if last-dir
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
388 (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
389
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
390 ;; Setup the buffer
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
391 (set buffer-name (find-file-noselect file))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
392
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
393 (ediff-eval-in-buffer (symbol-value buffer-name)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
394 (widen) ; Make sure the entire file is seen
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
395 (cond (file-magic ;; file has handler, such as jka-compr-handler or
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
396 ;; ange-ftp-hook-function--arrange for temp file
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
397 (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
398 (setq file
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
399 (ediff-make-temp-file
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
400 (current-buffer) temp-file-name-prefix))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
401 (set hooks-var (cons (` (lambda () (delete-file (, file))))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
402 (symbol-value hooks-var))))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
403 ;; 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
404 ((not (equal (file-truename file)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
405 (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
406 (setq file
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
407 (ediff-make-temp-file
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
408 (current-buffer) temp-file-name-prefix))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
409 (set hooks-var (cons (` (lambda () (delete-file (, file))))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
410 (symbol-value hooks-var))))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
411 (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
412 (ediff-verify-file-buffer))))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
413 (set file-var file)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
414
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
415 (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
416 (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
417 (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
418 ;;(sit-for 0)
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
419 (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
420 (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
421 ;;(sit-for 0)
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
422 (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
423 (if (stringp file-C)
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
424 (progn
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
425 (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
426 ;;(sit-for 0)
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
427 (ediff-find-file
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
428 'file-C 'buf-C
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
429 (if (eq job-name 'ediff-merge-files-with-ancestor)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
430 'ediff-last-dir-ancestor 'ediff-last-dir-C)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
431 'startup-hooks)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
432 (ediff-setup buf-A file-A
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
433 buf-B file-B
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
434 buf-C file-C
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
435 startup-hooks
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
436 (list (cons 'ediff-job-name job-name)))))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
437
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
438
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
439 ;;;###autoload
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
440 (defalias 'ediff 'ediff-files)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
441
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
442
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
443 ;;;###autoload
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
444 (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
445 "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
446 (interactive
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
447 (let (bf)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
448 (list (setq bf (read-buffer "Buffer A to compare: "
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
449 (ediff-other-buffer "") t))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
450 (read-buffer "Buffer B to compare: "
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
451 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
452 ;; realign buffers so that two visible bufs will be
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
453 ;; at the top
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
454 (save-window-excursion (other-window 1))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
455 (ediff-other-buffer bf))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
456 t))))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
457
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
458 (or job-name (setq job-name 'ediff-buffers))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
459 (ediff-buffers-internal buffer-A buffer-B nil startup-hooks job-name))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
460
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
461 ;;;###autoload
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
462 (defun ediff-buffers3 (buffer-A buffer-B buffer-C
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
463 &optional startup-hooks job-name)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
464 "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
465 (interactive
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
466 (let (bf bff)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
467 (list (setq bf (read-buffer "Buffer A to compare: "
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
468 (ediff-other-buffer "") t))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
469 (setq bff (read-buffer "Buffer B to compare: "
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
470 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
471 ;; realign buffers so that two visible
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
472 ;; bufs will be at the top
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
473 (save-window-excursion (other-window 1))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
474 (ediff-other-buffer bf))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
475 t))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
476 (read-buffer "Buffer C to compare: "
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
477 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
478 ;; realign buffers so that three visible
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
479 ;; bufs will be at the top
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
480 (save-window-excursion (other-window 1))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
481 (ediff-other-buffer (list bf bff)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
482 t)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
483 )))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
484
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
485 (or job-name (setq job-name 'ediff-buffers3))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
486 (ediff-buffers-internal buffer-A buffer-B buffer-C startup-hooks job-name))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
487
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
488
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
489
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
490 (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
491 (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
492 (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
493 (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
494 (buf-C-file-name (if buf-C-is-alive
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
495 (buffer-file-name (get-buffer buf-B))))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
496 file-A file-B file-C)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
497 (if (not (ediff-buffer-live-p buf-A))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
498 (error "Buffer %S doesn't exist" buf-A))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
499 (if (not (ediff-buffer-live-p buf-B))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
500 (error "Buffer %S doesn't exist" buf-B))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
501 (let ((ediff-job-name job-name))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
502 (if (and ediff-3way-comparison-job
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
503 (not buf-C-is-alive))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
504 (error "Buffer %S doesn't exist" buf-C)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
505 (if (stringp buf-A-file-name)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
506 (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
507 (if (stringp buf-B-file-name)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
508 (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
509 (if (stringp buf-C-file-name)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
510 (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
511
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
512 (setq file-A (ediff-make-temp-file buf-A buf-A-file-name))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
513 (setq 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
514 (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
515 (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
516
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
517 (ediff-setup (get-buffer buf-A) file-A
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
518 (get-buffer buf-B) file-B
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
519 (if buf-C-is-alive (get-buffer buf-C))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
520 file-C
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
521 (cons (` (lambda ()
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
522 (delete-file (, file-A))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
523 (delete-file (, file-B))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
524 (if (stringp (, file-C)) (delete-file (, file-C)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
525 ))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
526 startup-hooks)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
527 (list (cons 'ediff-job-name job-name))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
528 )))
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
529
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
530
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
531 ;;; 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
532
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
533 ;; 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
534 ;; 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
535 ;; 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
536 ;; otherwise, use default-directory
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
537 (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
538 (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
539 ((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
540 (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
541 (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
542 f
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
543 default-directory)))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
544 (t default-directory)))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
545
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 ;;;###autoload
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
548 (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
549 "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
550 the same name in both. The third argument, REGEXP, is a regular expression that
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
551 further filters the file names."
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
552 (interactive
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
553 (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
554 f)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
555 (list (setq f (ediff-read-file-name "Directory A to compare" dir-A nil))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
556 (ediff-read-file-name "Directory B to compare"
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
557 (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
558 ediff-last-dir-B
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
559 (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
560 nil)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
561 (read-string "Filter through regular expression: "
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
562 nil ediff-filtering-regexp-history)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
563 )))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
564 (ediff-directories-internal
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
565 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
566 ))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
567
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
568 ;;;###autoload
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
569 (defalias 'edirs 'ediff-directories)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
570
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
571
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
572 ;;;###autoload
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
573 (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
574 "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
575 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
576 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
577 (interactive
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
578 (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
579 (list (ediff-read-file-name
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
580 "Directory to compare with revision" dir-A nil)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
581 (read-string "Filter through regular expression: "
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
582 nil ediff-filtering-regexp-history)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
583 )))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
584 (ediff-directory-revisions-internal
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
585 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
586 ))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
587
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
588 ;;;###autoload
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
589 (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
590
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 ;;;###autoload
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
593 (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
594 "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
595 have the same name in all three. The last argument, REGEXP, is a regular
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
596 expression that further filters the file names."
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
597 (interactive
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
598 (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
599 f)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
600 (list (setq f (ediff-read-file-name "Directory A to compare" dir-A nil))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
601 (setq f (ediff-read-file-name "Directory B to compare"
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
602 (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
603 ediff-last-dir-B
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
604 (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
605 nil))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
606 (ediff-read-file-name "Directory C to compare"
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
607 (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
608 ediff-last-dir-C
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
609 (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
610 nil)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
611 (read-string "Filter through regular expression: "
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
612 nil ediff-filtering-regexp-history)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
613 )))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
614 (ediff-directories-internal
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
615 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
616 ))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
617
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
618 ;;;###autoload
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
619 (defalias 'edirs3 'ediff-directories3)
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 (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
623 "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
624 the same name in both. The third argument, REGEXP, is a regular expression that
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
625 further filters the file names."
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
626 (interactive
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
627 (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
628 f)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
629 (list (setq f (ediff-read-file-name "Directory A to merge" dir-A nil))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
630 (ediff-read-file-name "Directory B to merge"
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
631 (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
632 ediff-last-dir-B
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
633 (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
634 nil)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
635 (read-string "Filter through regular expression: "
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
636 nil ediff-filtering-regexp-history)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
637 )))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
638 (ediff-directories-internal
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
639 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
640 ))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
641
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
642 ;;;###autoload
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
643 (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
644
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
645 ;;;###autoload
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
646 (defun ediff-merge-directories-with-ancestor (dir1 dir2 dir3 regexp)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
647 "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
648 the same name in both. The third argument, REGEXP, is a regular expression that
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
649 further filters the file names."
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
650 (interactive
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
651 (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
652 f)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
653 (list (setq f (ediff-read-file-name "Directory A to merge" dir-A nil))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
654 (setq f (ediff-read-file-name "Directory B to merge"
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
655 (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
656 ediff-last-dir-B
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
657 (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
658 nil))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
659 (ediff-read-file-name "Ancestor directory: "
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
660 (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
661 ediff-last-dir-C
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
662 (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
663 nil)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
664 (read-string "Filter through regular expression: "
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
665 nil ediff-filtering-regexp-history)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
666 )))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
667 (ediff-directories-internal
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
668 dir1 dir2 dir3 regexp
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
669 '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
670 ))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
671
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
672 ;;;###autoload
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
673 (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
674 "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
675 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
676 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
677 (interactive
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
678 (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
679 (list (ediff-read-file-name
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
680 "Directory to merge with revisions" dir-A nil)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
681 (read-string "Filter through regular expression: "
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
682 nil ediff-filtering-regexp-history)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
683 )))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
684 (ediff-directory-revisions-internal
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
685 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
686 ))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
687
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
688 ;;;###autoload
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
689 (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
690
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
691 ;;;###autoload
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
692 (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
693 "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
694 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
695 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
696 (interactive
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
697 (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
698 (list (ediff-read-file-name
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
699 "Directory to merge with revisions and ancestors" dir-A nil)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
700 (read-string "Filter through regular expression: "
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
701 nil ediff-filtering-regexp-history)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
702 )))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
703 (ediff-directory-revisions-internal
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
704 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
705 '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
706 ))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
707
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
708 ;;;###autoload
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
709 (defalias
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
710 '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
711 '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
712
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
713 ;;;###autoload
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
714 (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
715
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
716 ;; 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
717 ;; on a pair of directories (three directories, in case of ancestor).
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
718 ;; The third argument, REGEXP, is a regular expression that further filters the
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
719 ;; file names.
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
720 ;; JOBNAME is the symbol indicating the meta-job to be performed.
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
721 (defun ediff-directories-internal (dir1 dir2 dir3 regexp
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
722 action jobname
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
723 &optional startup-hooks)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
724 ;; 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
725 ;; 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
726 (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
727 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
728
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
729 (if (stringp dir3)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
730 (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
731
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
732 (cond ((string= dir1 dir2)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
733 (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
734 ((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
735 (string= dir1 dir3))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
736 (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
737 ((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
738 (string= dir2 dir3))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
739 (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
740
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
741 (let (diffs ; var where ediff-intersect-directories returns the diff list
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
742 file-list meta-buf)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
743 (setq file-list (ediff-intersect-directories
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
744 jobname 'diffs regexp dir1 dir2 dir3))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
745 (setq startup-hooks
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
746 ;; 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
747 ;; ediff-prepare-meta-buffer
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
748 (cons (` (lambda ()
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
749 ;; 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
750 (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
751 ;; 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
752 (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
753 startup-hooks))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
754 (setq meta-buf (ediff-prepare-meta-buffer
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
755 'ediff-dir-action
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
756 file-list
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
757 "*Ediff Session Group Panel"
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
758 '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
759 jobname
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
760 startup-hooks))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
761 (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
762 ))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
763
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
764 (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
765 &optional startup-hooks)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
766 (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
767 (let (file-list meta-buf)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
768 (setq file-list
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
769 (ediff-get-directory-files-under-revision jobname regexp dir1))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
770 (setq startup-hooks
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
771 ;; 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
772 ;; ediff-prepare-meta-buffer
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
773 (cons (` (lambda ()
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
774 ;; 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
775 (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
776 ))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
777 startup-hooks))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
778 (setq meta-buf (ediff-prepare-meta-buffer
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
779 'ediff-dir-action
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
780 file-list
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
781 "*Ediff Session Group Panel"
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
782 '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
783 jobname
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
784 startup-hooks))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
785 (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
786 ))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
787
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 ;;; Compare regions and windows
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
790
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
791 ;;;###autoload
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
792 (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
793 "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
794 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
795 follows:
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
796 If WIND-A is nil, use selected window.
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
797 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
798 (interactive "P")
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
799 (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
800 startup-hooks 'ediff-windows-wordwise 'word-mode))
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
801
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
802 ;;;###autoload
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
803 (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
804 "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
805 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
806 follows:
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
807 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
808 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
809 (interactive "P")
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
810 (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
811 startup-hooks 'ediff-windows-linewise nil))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
812
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
813 ;; 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
814 ;; 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
815 ;; works as follows:
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
816 ;; 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
817 ;; 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
818 (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
819 (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
820 (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
821 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
822 (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
823 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
824
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
825 (let ((buffer-A (window-buffer wind-A))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
826 (buffer-B (window-buffer wind-B))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
827 beg-A end-A beg-B end-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
828
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
829 (save-excursion
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
830 (save-window-excursion
14040
187735b53d52 Comment fixes.
Karl Heuer <kwzh@gnu.org>
parents: 13604
diff changeset
831 (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
832 (select-window wind-A)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
833 (setq beg-A (window-start)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
834 end-A (window-end))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
835 (select-window wind-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
836 (setq beg-B (window-start)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
837 end-B (window-end))))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
838 (ediff-regions-internal
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
839 buffer-A beg-A end-A buffer-B beg-B end-B
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
840 startup-hooks job-name word-mode)))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
841
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
842 ;;;###autoload
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
843 (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
844 "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
845 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
846 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
847 lines. For large regions, use `ediff-regions-linewise'."
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
848 (interactive
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
849 (let (bf)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
850 (list (setq bf (read-buffer "Region's A buffer: "
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
851 (ediff-other-buffer "") t))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
852 (read-buffer "Region's B buffer: "
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
853 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
854 ;; realign buffers so that two visible bufs will be
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
855 ;; at the top
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
856 (save-window-excursion (other-window 1))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
857 (ediff-other-buffer bf))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
858 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
859 (if (not (ediff-buffer-live-p buffer-A))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
860 (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
861 (if (not (ediff-buffer-live-p buffer-B))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
862 (error "Buffer %S doesn't exist" buffer-B))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
863
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
864
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
865 (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
866 (save-excursion
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
867 (set-buffer buffer-A)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
868 (setq reg-A-beg (region-beginning)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
869 reg-A-end (region-end))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
870 (set-buffer buffer-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
871 (setq reg-B-beg (region-beginning)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
872 reg-B-end (region-end)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
873
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
874 (ediff-regions-internal
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
875 (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
876 (get-buffer buffer-B) reg-B-beg reg-B-end
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
877 startup-hooks 'ediff-regions-wordwise 'word-mode)))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
878
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
879 ;;;###autoload
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
880 (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
881 "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
882 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
883 Each region is enlarged to contain full lines.
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
884 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
885 lines. For small regions, use `ediff-regions-wordwise'."
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
886 (interactive
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
887 (let (bf)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
888 (list (setq bf (read-buffer "Region A's buffer: "
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
889 (ediff-other-buffer "") t))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
890 (read-buffer "Region B's buffer: "
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
891 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
892 ;; realign buffers so that two visible bufs will be
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
893 ;; at the top
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
894 (save-window-excursion (other-window 1))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
895 (ediff-other-buffer bf))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
896 t))))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
897 (if (not (ediff-buffer-live-p buffer-A))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
898 (error "Buffer %S doesn't exist" buffer-A))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
899 (if (not (ediff-buffer-live-p buffer-B))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
900 (error "Buffer %S doesn't exist" buffer-B))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
901
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
902 (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
903 (save-excursion
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
904 (set-buffer buffer-A)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
905 (setq reg-A-beg (region-beginning)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
906 reg-A-end (region-end))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
907 ;; enlarge the region to hold full lines
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
908 (goto-char reg-A-beg)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
909 (beginning-of-line)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
910 (setq reg-A-beg (point))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
911 (goto-char reg-A-end)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
912 (end-of-line)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
913 (or (eobp) (forward-char)) ; include the newline char
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
914 (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
915
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
916 (set-buffer buffer-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
917 (setq reg-B-beg (region-beginning)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
918 reg-B-end (region-end))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
919 ;; enlarge the region to hold full lines
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
920 (goto-char reg-A-beg)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
921 (goto-char reg-B-beg)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
922 (beginning-of-line)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
923 (setq reg-B-beg (point))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
924 (goto-char reg-B-end)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
925 (end-of-line)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
926 (or (eobp) (forward-char)) ; include the newline char
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
927 (setq reg-B-end (point))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
928 ) ; save excursion
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
929
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
930 (ediff-regions-internal
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
931 (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
932 (get-buffer buffer-B) reg-B-beg reg-B-end
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
933 startup-hooks 'ediff-regions-linewise nil))) ; no word mode
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
934
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
935 ;; 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
936 ;; to regions beg-B -- end-B in buffer-B.
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
937 (defun ediff-regions-internal (buffer-A beg-A end-A buffer-B beg-B end-B
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
938 startup-hooks job-name word-mode)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
939 (let ((tmp-buffer (get-buffer-create ediff-tmp-buffer))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
940 overl-A overl-B
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
941 file-A file-B)
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 ;; 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
944 (ediff-eval-in-buffer buffer-A
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
945 (setq beg-A (move-marker (make-marker) beg-A)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
946 end-A (move-marker (make-marker) end-A)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
947 (ediff-eval-in-buffer buffer-B
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
948 (setq beg-B (move-marker (make-marker) beg-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
949 end-B (move-marker (make-marker) end-B)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
950
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
951 (if (and (eq buffer-A buffer-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
952 (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
953 (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
954 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
955 (with-output-to-temp-buffer ediff-msg-buffer
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
956 (princ "
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
957 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
958
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
959 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
960 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
961
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
962 Continue anyway? (y/n) "))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
963
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
964 (if (y-or-n-p "Continue anyway? ")
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
965 ()
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
966 (error "%S aborted" job-name))))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
967
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
968 ;; make file-A
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
969 (if word-mode
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
970 (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
971 (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
972 (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
973
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
974 ;; make file-B
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
975 (if word-mode
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
976 (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
977 (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
978 (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
979
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
980 (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
981 (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
982 (ediff-setup buffer-A file-A
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
983 buffer-B file-B
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
984 nil nil ; buffer & file C
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
985 (cons (` (lambda ()
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
986 (delete-file (, file-A))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
987 (delete-file (, file-B))))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
988 startup-hooks)
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
989 (list (cons 'ediff-word-mode word-mode)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
990 (cons 'ediff-narrow-bounds (list overl-A overl-B))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
991 (cons 'ediff-job-name job-name))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
992 )
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
993 ))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
994
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
995
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
996 ;;; Merge files and buffers
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
997
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
998 ;;;###autoload
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
999 (defalias 'ediff-merge 'ediff-merge-files)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1000
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1001 (defsubst ediff-merge-on-startup ()
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1002 (ediff-do-merge 0)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1003 (ediff-eval-in-buffer ediff-buffer-C
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1004 (set-buffer-modified-p nil)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1005
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1006 ;;;###autoload
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1007 (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
1008 "Merge two files without ancestor."
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1009 (interactive
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1010 (let ((dir-A (if ediff-use-last-dir
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1011 ediff-last-dir-A
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1012 default-directory))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1013 dir-B f)
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1014 (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
1015 "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
1016 (ediff-get-default-file-name)))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1017 (ediff-read-file-name "File B to merge"
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1018 (setq dir-B
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1019 (if ediff-use-last-dir
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1020 ediff-last-dir-B
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1021 (file-name-directory f)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1022 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1023 (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
1024 (cons (ediff-abbreviate-file-name
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1025 (expand-file-name
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1026 (file-name-nondirectory f)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1027 dir-B))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1028 file-name-history))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1029 f))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1030 )))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1031 (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
1032 (ediff-files-internal file-A
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1033 (if (file-directory-p file-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1034 (expand-file-name
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1035 (file-name-nondirectory file-A) file-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1036 file-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1037 nil ; file-C
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1038 startup-hooks
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1039 'ediff-merge-files))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1040
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1041 ;;;###autoload
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1042 (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
1043 &optional startup-hooks)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1044 "Merge two files with ancestor."
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1045 (interactive
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1046 (let ((dir-A (if ediff-use-last-dir
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1047 ediff-last-dir-A
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1048 default-directory))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1049 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
1050 (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
1051 "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
1052 (ediff-get-default-file-name)))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1053 (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
1054 (setq dir-B
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1055 (if ediff-use-last-dir
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1056 ediff-last-dir-B
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1057 (file-name-directory f)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1058 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1059 (setq file-name-history
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1060 (cons
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1061 (ediff-abbreviate-file-name
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1062 (expand-file-name
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1063 (file-name-nondirectory f)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1064 dir-B))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1065 file-name-history))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1066 f)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1067 (ediff-read-file-name "Ancestor file"
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1068 (setq dir-ancestor
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1069 (if ediff-use-last-dir
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1070 ediff-last-dir-ancestor
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1071 (file-name-directory ff)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1072 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1073 (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
1074 (cons (ediff-abbreviate-file-name
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1075 (expand-file-name
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1076 (file-name-nondirectory ff)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1077 dir-ancestor))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1078 file-name-history))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1079 ff))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1080 )))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1081 (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
1082 (ediff-files-internal file-A
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1083 (if (file-directory-p file-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1084 (expand-file-name
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1085 (file-name-nondirectory file-A) file-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1086 file-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1087 file-ancestor
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1088 startup-hooks
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1089 'ediff-merge-files-with-ancestor))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1090
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1091 ;;;###autoload
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1092 (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
1093
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1094 ;;;###autoload
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1095 (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
1096 "Merge buffers without ancestor."
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1097 (interactive
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1098 (let (bf)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1099 (list (setq bf (read-buffer "Buffer A to merge: "
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1100 (ediff-other-buffer "") t))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1101 (read-buffer "Buffer B to merge: "
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1102 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1103 ;; realign buffers so that two visible bufs will be
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1104 ;; at the top
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1105 (save-window-excursion (other-window 1))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1106 (ediff-other-buffer bf))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1107 t))))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1108
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1109 (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
1110 (or job-name (setq job-name 'ediff-merge-buffers))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1111 (ediff-buffers-internal
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1112 buffer-A buffer-B nil startup-hooks job-name))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1113
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1114 ;;;###autoload
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1115 (defun ediff-merge-buffers-with-ancestor (buffer-A
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1116 buffer-B buffer-ancestor
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1117 &optional startup-hooks job-name)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1118 "Merge buffers with ancestor."
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1119 (interactive
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1120 (let (bf bff)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1121 (list (setq bf (read-buffer "Buffer A to merge: "
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1122 (ediff-other-buffer "") t))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1123 (setq bff (read-buffer "Buffer B to merge: "
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1124 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1125 ;; realign buffers so that two visible
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1126 ;; bufs will be at the top
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1127 (save-window-excursion (other-window 1))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1128 (ediff-other-buffer bf))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1129 t))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1130 (read-buffer "Ancestor buffer: "
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1131 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1132 ;; realign buffers so that three visible
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1133 ;; bufs will be at the top
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1134 (save-window-excursion (other-window 1))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1135 (ediff-other-buffer (list bf bff)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1136 t)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1137 )))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1138
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1139 (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
1140 (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
1141 (ediff-buffers-internal
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1142 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
1143
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1144
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1145 ;;;###autoload
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1146 (defun ediff-merge-revisions (&optional file startup-hooks)
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1147 "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
1148 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
1149 buffer."
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1150 (interactive)
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1151 (ediff-load-version-control)
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1152 (if (stringp file) (find-file file))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1153 (let (rev1 rev2 buf1 buf2)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1154 (setq rev1
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1155 (read-string
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1156 (format
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1157 "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
1158 (if (stringp file)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1159 (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
1160 rev2
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1161 (read-string
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1162 (format
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1163 "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
1164 (if (stringp file)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1165 (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
1166 (cond ((eq ediff-version-control-package 'vc)
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1167 (save-excursion
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1168 (vc-version-other-window rev1)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1169 (setq buf1 (current-buffer)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1170 (save-excursion
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1171 (or (string= rev2 "")
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1172 (vc-version-other-window rev2))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1173 (setq buf2 (current-buffer)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1174 (setq startup-hooks
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1175 (cons
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1176 (` (lambda ()
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1177 (delete-file (, (buffer-file-name buf1)))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1178 (or (, (string= rev2 ""))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1179 (delete-file (, (buffer-file-name buf2))))))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1180 startup-hooks)))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1181 ((eq ediff-version-control-package 'rcs)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1182 (setq buf1 (rcs-ediff-view-revision rev1)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1183 buf2 (if (string= rev2 "")
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1184 (current-buffer)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1185 (rcs-ediff-view-revision rev2))))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1186 ((eq ediff-version-control-package 'generic-sc)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1187 (save-excursion
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1188 (if (string= rev1 "")
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1189 (setq rev1 (generic-sc-get-latest-rev)))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1190 (sc-visit-previous-revision rev1)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1191 (setq buf1 (current-buffer)))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1192 (save-excursion
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1193 (or (string= rev2 "")
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1194 (sc-visit-previous-revision rev2))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1195 (setq buf2 (current-buffer))))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1196 ) ; cond
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1197 (ediff-merge-buffers buf1 buf2 startup-hooks 'ediff-merge-revisions)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1198
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1199
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1200 ;;;###autoload
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1201 (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
1202 "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
1203 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
1204 buffer."
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1205 (interactive)
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1206 (ediff-load-version-control)
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1207 (if (stringp file) (find-file file))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1208 (let (rev1 rev2 ancestor-rev buf1 buf2 ancestor-buf)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1209 (setq rev1
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1210 (read-string
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1211 (format
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1212 "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
1213 (if (stringp file)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1214 (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
1215 rev2
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1216 (read-string
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1217 (format
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1218 "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
1219 (if (stringp file)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1220 (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
1221 ancestor-rev
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
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1224 "Ancestor version (default: %s): "
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1225 (if (stringp file)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1226 (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
1227 (cond ((eq ediff-version-control-package 'vc)
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1228 (save-excursion
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1229 (vc-version-other-window rev1)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1230 (setq buf1 (current-buffer)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1231 (save-excursion
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1232 (or (string= rev2 "")
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1233 (vc-version-other-window rev2))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1234 (setq buf2 (current-buffer)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1235 (save-excursion
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1236 (or (string= ancestor-rev "")
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1237 (vc-version-other-window ancestor-rev))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1238 (setq ancestor-buf (current-buffer)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1239 (setq startup-hooks
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1240 (cons
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1241 (` (lambda ()
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1242 (delete-file (, (buffer-file-name buf1)))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1243 (or (, (string= rev2 ""))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1244 (delete-file (, (buffer-file-name buf2))))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1245 (or (, (string= ancestor-rev ""))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1246 (delete-file (, (buffer-file-name ancestor-buf))))))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1247 startup-hooks)))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1248 ((eq ediff-version-control-package 'rcs)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1249 (setq buf1 (rcs-ediff-view-revision rev1)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1250 buf2 (if (string= rev2 "")
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1251 (current-buffer)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1252 (rcs-ediff-view-revision rev2))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1253 ancestor-buf (if (string= ancestor-rev "")
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1254 (current-buffer)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1255 (rcs-ediff-view-revision ancestor-rev))))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1256 ((eq ediff-version-control-package 'generic-sc)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1257 (save-excursion
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1258 (if (string= rev1 "")
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1259 (setq rev1 (generic-sc-get-latest-rev)))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1260 (sc-visit-previous-revision rev1)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1261 (setq buf1 (current-buffer)))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1262 (save-excursion
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1263 (or (string= rev2 "")
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1264 (sc-visit-previous-revision rev2))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1265 (setq buf2 (current-buffer)))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1266 (save-excursion
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1267 (or (string= ancestor-rev "")
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1268 (sc-visit-previous-revision ancestor-rev))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1269 (setq ancestor-buf (current-buffer))))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1270 ) ; cond
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1271 (ediff-merge-buffers-with-ancestor
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1272 buf1 buf2 ancestor-buf
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1273 startup-hooks 'ediff-merge-revisions-with-ancestor)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1274
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1275
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1276 ;;; Apply patch
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1277
7709
d88d94461e5d (ediff-patch-buffer): Fix autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1278 ;;;###autoload
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1279 (defun ediff-patch-buffer (buffer-name &optional startup-hooks)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1280 "Run Ediff by patching BUFFER-NAME."
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1281 (interactive "bBuffer to patch: ")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1282
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1283 (let* ((buf-to-patch (get-buffer buffer-name))
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1284 (file-name-ok (if buf-to-patch (buffer-file-name buf-to-patch)))
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1285 (buf-mod-status (buffer-modified-p buf-to-patch))
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1286 default-dir file-name ctl-buf)
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1287 (if file-name-ok
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1288 (setq file-name file-name-ok)
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1289 (ediff-eval-in-buffer buffer-name
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1290 (setq default-dir default-directory)
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1291 (setq file-name (ediff-make-temp-file buffer-name))
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1292 (set-visited-file-name file-name)
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1293 (setq buffer-auto-save-file-name nil) ; don't create auto-save file
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1294 (rename-buffer buffer-name) ; don't confuse the user with new buf name
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1295 (set-buffer-modified-p nil)
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1296 (set-visited-file-modtime) ; sync buffer and temp file
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1297 (setq default-directory default-dir)
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1298 ))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1299
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1300 (setq ctl-buf
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1301 (ediff-patch-file file-name startup-hooks 'ediff-patch-buffer))
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1302
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1303 (if file-name-ok
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1304 ()
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1305 (ediff-eval-in-buffer ctl-buf
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1306 (delete-file (buffer-file-name ediff-buffer-A))
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1307 (delete-file (buffer-file-name ediff-buffer-B))
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1308 (ediff-eval-in-buffer ediff-buffer-A
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1309 (if default-dir (setq default-directory default-dir))
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1310 (set-visited-file-name nil)
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1311 (rename-buffer buffer-name)
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1312 (set-buffer-modified-p buf-mod-status))
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1313 (ediff-eval-in-buffer ediff-buffer-B
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1314 (setq buffer-auto-save-file-name nil) ; don't create auto-save file
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1315 (if default-dir (setq default-directory default-dir))
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1316 (set-visited-file-name nil)
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1317 (rename-buffer (ediff-unique-buffer-name
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1318 (concat buffer-name "_patched") ""))
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1319 (set-buffer-modified-p t))))
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1320 ))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1321
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1322
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1323 (defun ediff-get-patch-buffer (dir)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1324 "Obtain patch buffer. If patch is already in a buffer---use it.
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1325 Else, read patch file into a new buffer."
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1326 (if (y-or-n-p "Is the patch file already in a buffer? ")
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1327 (setq ediff-patch-buf
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1328 (get-buffer (read-buffer "Patch buffer name: " nil t))) ;must match
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1329 (setq ediff-patch-buf
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1330 (find-file-noselect (read-file-name "Patch file name: " dir))))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1331
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1332 (setq ediff-patch-diagnostics
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1333 (get-buffer-create "*ediff patch diagnostics*"))
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1334 (ediff-eval-in-buffer ediff-patch-diagnostics
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1335 (insert-buffer ediff-patch-buf)))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1336
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1337
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1338
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1339
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1340
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1341 ;;; Versions Control functions
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1342
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1343 ;;;###autoload
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1344 (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
1345 "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
1346 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
1347 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
1348 ;; 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
1349 (interactive "P")
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1350 (if (stringp file) (find-file file))
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1351 (let (rev1 rev2)
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1352 (setq rev1
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1353 (read-string
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1354 (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
1355 (if (stringp file)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1356 (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
1357 rev2
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1358 (read-string
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1359 (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
1360 (if (stringp file)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1361 (file-name-nondirectory file) "current buffer"))))
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1362 (ediff-load-version-control)
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1363 (funcall
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1364 (intern (format "%S-ediff-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
1365 rev1 rev2 startup-hooks)
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1366 ))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1367
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1368
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1369 ;; 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
1370 ;; 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
1371 (defun ediff-load-version-control (&optional silent)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1372 (or (featurep ediff-version-control-package)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1373 (if (locate-library (symbol-name ediff-version-control-package))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1374 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1375 (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
1376 (require ediff-version-control-package))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1377 (or silent
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1378 (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
1379 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
1380
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1381
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1382 (defun vc-ediff-internal (rev1 rev2 &optional startup-hooks)
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1383 "Run Ediff on versions of the current buffer.
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1384 If REV2 is \"\" then compare current buffer with REV1.
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1385 If the current buffer is named `F', the version is named `F.~REV~'.
7391
c40d16ee57bf entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 7267
diff changeset
1386 If `F.~REV~' already exists, it is used instead of being re-created."
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1387 (let (file1 file2 rev1buf rev2buf)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1388 (save-excursion
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1389 (vc-version-other-window rev1)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1390 (setq rev1buf (current-buffer)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1391 file1 (buffer-file-name)))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1392 (save-excursion
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1393 (or (string= rev2 "") ; use current buffer
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1394 (vc-version-other-window rev2))
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1395 (setq rev2buf (current-buffer)
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1396 file2 (buffer-file-name)))
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1397 (setq startup-hooks
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1398 (cons (` (lambda ()
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1399 (delete-file (, file1))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1400 (or (, (string= rev2 "")) (delete-file (, file2)))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1401 ))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1402 startup-hooks))
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1403 (ediff-buffers
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1404 rev1buf rev2buf
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1405 startup-hooks
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1406 'ediff-revision)))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1407
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1408 (defun rcs-ediff-view-revision (&optional rev)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1409 "View previous RCS revision of current file.
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1410 With prefix argument, prompts for a revision name."
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1411 (interactive (list (if current-prefix-arg
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1412 (read-string "Revision: "))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1413 (let* ((filename (buffer-file-name (current-buffer)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1414 (switches (append '("-p")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1415 (if rev (list (concat "-r" rev)) nil)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1416 (buff (concat (file-name-nondirectory filename) ".~" rev "~")))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1417 (message "Working ...")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1418 (setq filename (expand-file-name filename))
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1419 (with-output-to-temp-buffer buff
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1420 (let ((output-buffer (ediff-rcs-get-output-buffer filename buff)))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1421 (delete-windows-on output-buffer)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1422 (save-excursion
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1423 (set-buffer output-buffer)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1424 (apply 'call-process "co" nil t nil
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1425 ;; -q: quiet (no diagnostics)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1426 (append switches rcs-default-co-switches
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1427 (list "-q" filename)))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1428 (message "")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1429 buff)))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1430
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1431 (defun ediff-rcs-get-output-buffer (file name)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1432 ;; Get a buffer for RCS output for FILE, make it writable and clean it up.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1433 ;; Optional NAME is name to use instead of `*RCS-output*'.
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
1434 ;; This is a modified version from rcs.el v1.1. I use it here to make
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1435 ;; Ediff immune to changes in rcs.el
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1436 (let* ((default-major-mode 'fundamental-mode) ; no frills!
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1437 (buf (get-buffer-create name)))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1438 (save-excursion
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1439 (set-buffer buf)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1440 (setq buffer-read-only nil
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1441 default-directory (file-name-directory (expand-file-name file)))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1442 (erase-buffer))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1443 buf))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1444
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1445 (defun rcs-ediff-internal (rev1 rev2 &optional startup-hooks)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1446 "Run Ediff on versions of the current buffer.
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1447 If REV2 is \"\" then use current buffer."
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1448 (let ((rev2buf (if (string= rev2 "")
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1449 (current-buffer)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1450 (rcs-ediff-view-revision rev2)))
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1451 (rev1buf (rcs-ediff-view-revision rev1)))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1452
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1453 ;; rcs.el doesn't create temp version files, so we don't have to delete
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1454 ;; anything in startup hooks to ediff-buffers
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1455 (ediff-buffers rev1buf rev2buf startup-hooks 'ediff-revision)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1456 ))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1457
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1458 (defun generic-sc-get-latest-rev ()
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1459 (cond ((eq sc-mode 'CCASE)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1460 (eval "main/LATEST"))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1461 (t (eval "")))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1462 )
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1463
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1464 (defun generic-sc-ediff-internal (rev1 rev2 &optional startup-hooks)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1465 "Run Ediff on versions of the current buffer.
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1466 If REV2 is \"\" then compare current buffer with REV1.
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1467 If the current buffer is named `F', the version is named `F.~REV~'.
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1468 If `F.~REV~' already exists, it is used instead of being re-created."
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1469 (let (rev1buf rev2buf)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1470 (save-excursion
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1471 (if (or (not rev1) (string= rev1 ""))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1472 (setq rev1 (generic-sc-get-latest-rev)))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1473 (sc-visit-previous-revision rev1)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1474 (setq rev1buf (current-buffer)))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1475 (save-excursion
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1476 (or (string= rev2 "") ; use current buffer
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1477 (sc-visit-previous-revision rev2))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1478 (setq rev2buf (current-buffer)))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1479 (ediff-buffers rev1buf rev2buf startup-hooks 'ediff-revision)))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1480
13217
c3f879af05db (ediff-version): is now autoloaded.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 13133
diff changeset
1481 ;;;###autoload
c3f879af05db (ediff-version): is now autoloaded.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 13133
diff changeset
1482 (defun ediff-version ()
c3f879af05db (ediff-version): is now autoloaded.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 13133
diff changeset
1483 "Return string describing the version of Ediff.
c3f879af05db (ediff-version): is now autoloaded.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 13133
diff changeset
1484 When called interactively, displays the version."
c3f879af05db (ediff-version): is now autoloaded.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 13133
diff changeset
1485 (interactive)
c3f879af05db (ediff-version): is now autoloaded.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 13133
diff changeset
1486 (if (interactive-p)
c3f879af05db (ediff-version): is now autoloaded.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 13133
diff changeset
1487 (message (ediff-version))
c3f879af05db (ediff-version): is now autoloaded.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 13133
diff changeset
1488 (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
1489
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1490
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1491 (provide 'ediff)
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1492 (require 'ediff-util)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1493
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1494 ;;; ediff.el ends here