annotate lisp/ediff.el @ 15298:7c0be13394a1

(gnus-inews-date): Avoid race condition.
author Karl Heuer <kwzh@gnu.org>
date Tue, 28 May 1996 15:43:27 +0000
parents c768f6d7daaa
children 43a3308fcf61
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
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
9 (defconst ediff-version "2.54" "The current version of Ediff")
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
10 (defconst ediff-date "February 14, 1996" "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
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
73
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
74
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 ;;; Bugs:
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 ;; 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
78 ;; 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
79 ;; `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
80 ;; 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
81 ;; doesn't seem to exist with XEmacs.)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
82 ;;
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
83 ;; 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
84 ;; you can hit '!' to recompute the differences.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
85
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
86 ;; 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
87 ;; highlight fine differences is limited. By default, Ediff is using
14040
187735b53d52 Comment fixes.
Karl Heuer <kwzh@gnu.org>
parents: 13604
diff changeset
88 ;; 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
89 ;; 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
90 ;; 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
91 ;; 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
92 ;; 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
93 ;; 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
94 ;; 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
95 ;; 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
96 ;; and on any buffer.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
97
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
98
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
99 ;;; Acknowledgements:
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
100
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
101 ;; 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
102 ;; 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
103 ;; 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
104 ;; 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
105
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 ;;; Code:
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
108 (require 'ediff-init)
13604
81099f6b6fb1 (ediff-mult): Require ediff-mult.
Richard M. Stallman <rms@gnu.org>
parents: 13217
diff changeset
109 (require 'ediff-mult)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
110
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 (defvar ediff-use-last-dir nil
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
112 "*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
113
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 (defvar ediff-last-dir-A nil
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 "Last directory used by an Ediff command for file-A.")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116 (defvar ediff-last-dir-B nil
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 "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
118 (defvar ediff-last-dir-C nil
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
119 "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
120 (defvar ediff-last-dir-ancestor nil
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
121 "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
122 (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
123 "Last directory used by an Ediff command for file to patch.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
125 ;;; Patching
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
127 (defvar ediff-backup-extension
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
128 (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
129 "_orig" ".orig")
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
130 "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
131
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
132 ;;;###autoload
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
133 (defun ediff-patch-file (source-filename &optional startup-hooks job-name)
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
134 "Run Ediff by patching SOURCE-FILENAME."
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
135 ;; 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
136 (interactive
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
137 (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
138 "File to patch"
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
139 (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
140 ediff-last-dir-patch
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
141 default-directory)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
142 (ediff-get-default-file-name))))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
143
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
144 (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
145 (ediff-get-patch-buffer
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
146 (if (eq job-name 'ediff-patch-buffer)
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
147 (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
148 default-directory)
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
149 (file-name-directory source-filename)))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
150
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 (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
152 ;; 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
153 ;; 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
154 (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
155 (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
156 (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
157 (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
158 (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
159 (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
160 ;; 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
161 ;; 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
162 ;; 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
163 ;; 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
164 (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
165 (target-filename source-filename)
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
166 target-buf buf-to-patch file-name-magic-p ctl-buf backup-style)
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
167
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
168 ;; 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
169 ;; ediff-backup-extension
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
170 (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
171 (setq backup-extension ediff-backup-extension))
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
172 (if (string-match "-V" ediff-patch-options)
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
173 (error
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
174 "Ediff doesn't take the -V option in `ediff-patch-options'--sorry"))
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
175
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 ;; 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
177 ;; 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
178 ;; 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
179 ;; 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
180 (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
181 '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
182
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 ;; 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
184 ;; 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
185 ;; 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
186 ;; 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
187 (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
188 (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
189
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
190 ;; 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
191 ;; checked back in.
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
192 (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
193 (ediff-toggle-read-only buf-to-patch))
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
194
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
195 (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
196 (message "Applying patch ... ")
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
197 ;; fix environment for gnu patch, so it won't make numbered extensions
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
198 (setq backup-style (getenv "VERSION_CONTROL"))
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
199 (setenv "VERSION_CONTROL" nil)
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
200 ;; 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
201 (shell-command-on-region
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
202 (point-min) (point-max)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
203 (format "%s -f %s -b %s %s"
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
204 ediff-patch-program ediff-patch-options
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
205 backup-extension
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
206 (expand-file-name true-source-filename))
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
207 t)
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
208 ;; restore environment for gnu patch
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
209 (setenv "VERSION_CONTROL" backup-style))
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
210 ;;(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
211 (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
212 (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
213
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
214 (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
215 (error "Patch failed or didn't modify the original file"))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
216
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
217 ;; 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
218 ;; 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
219 ;; 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
220 ;; 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
221 ;; 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
222 ;; 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
223 ;; 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
224 ;; 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
225 (if (not file-name-magic-p)
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
226 (ediff-eval-in-buffer buf-to-patch
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
227 (set-visited-file-name (concat source-filename backup-extension))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
228 (set-buffer-modified-p nil))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
229
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
230 ;; Black magic in effect.
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
231 ;; 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
232 ;; 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
233 ;; the orig file.
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
234 (setq target-filename
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
235 (concat
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
236 (if (ediff-file-remote-p (file-truename source-filename))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
237 true-source-filename
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
238 source-filename)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
239 "_patched"))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
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 (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
242
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 ;; 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
244 (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
245 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
246
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
247 ;; make orig buffer read-only
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
248 (setq startup-hooks
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
249 (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
250
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
251 ;; 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
252 (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
253
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
254 (setq ctl-buf
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
255 (ediff-buffers-internal
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
256 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
257 startup-hooks (or job-name 'ediff-patch-file)))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
258
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
259 (bury-buffer ediff-patch-diagnostics)
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
260 (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
261 (buffer-name ediff-patch-diagnostics))
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
262 ctl-buf))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
263
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
264 ;; 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
265 (defun ediff-set-read-only-in-buf-A ()
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
266 (ediff-eval-in-buffer ediff-buffer-A
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
267 (toggle-read-only 1)))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
268
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
269 ;; 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
270 ;; 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
271 ;; 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
272 (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
273 (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
274 (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
275 (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
276 f)))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
277 ((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
278 (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
279 ))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
280
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
281 ;;;###autoload
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
282 (defalias 'epatch 'ediff-patch-file)
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
283 ;;;###autoload
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
284 (defalias 'epatch-buffer 'ediff-patch-buffer)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
285
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
286 ;;; Compare files/buffers
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
287
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
288 ;;;###autoload
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
289 (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
290 "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
291 (interactive
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
292 (let ((dir-A (if ediff-use-last-dir
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
293 ediff-last-dir-A
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
294 default-directory))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
295 dir-B f)
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
296 (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
297 "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
298 (ediff-get-default-file-name)))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
299 (ediff-read-file-name "File B to compare"
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
300 (setq dir-B
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
301 (if ediff-use-last-dir
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
302 ediff-last-dir-B
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
303 (file-name-directory f)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
304 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
305 (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
306 (cons (ediff-abbreviate-file-name
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
307 (expand-file-name
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
308 (file-name-nondirectory f)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
309 dir-B))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
310 file-name-history))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
311 f))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
312 )))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
313 (ediff-files-internal file-A
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
314 (if (file-directory-p file-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
315 (expand-file-name
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
316 (file-name-nondirectory file-A) file-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
317 file-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
318 nil ; file-C
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
319 startup-hooks
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
320 'ediff-files))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
321
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
322 ;;;###autoload
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
323 (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
324 "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
325 (interactive
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
326 (let ((dir-A (if ediff-use-last-dir
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
327 ediff-last-dir-A
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
328 default-directory))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
329 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
330 (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
331 "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
332 (ediff-get-default-file-name)))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
333 (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
334 (setq dir-B
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
335 (if ediff-use-last-dir
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
336 ediff-last-dir-B
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
337 (file-name-directory f)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
338 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
339 (setq file-name-history
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
340 (cons
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
341 (ediff-abbreviate-file-name
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
342 (expand-file-name
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
343 (file-name-nondirectory f)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
344 dir-B))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
345 file-name-history))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
346 f)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
347 (ediff-read-file-name "File C to compare"
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
348 (setq dir-C (if ediff-use-last-dir
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
349 ediff-last-dir-C
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
350 (file-name-directory ff)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
351 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
352 (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
353 (cons (ediff-abbreviate-file-name
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
354 (expand-file-name
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
355 (file-name-nondirectory ff)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
356 dir-C))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
357 file-name-history))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
358 ff))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
359 )))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
360 (ediff-files-internal file-A
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
361 (if (file-directory-p file-B)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
362 (expand-file-name
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
363 (file-name-nondirectory file-A) file-B)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
364 file-B)
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
365 (if (file-directory-p file-C)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
366 (expand-file-name
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
367 (file-name-nondirectory file-A) file-C)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
368 file-C)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
369 startup-hooks
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
370 'ediff-files3))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
371
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
372 ;;;###autoload
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
373 (defalias 'ediff3 'ediff-files3)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
374
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
375
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
376 ;; Visit FILE and arrange its buffer to Ediff's liking.
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
377 ;; FILE is actually a variable symbol that must contain a true file name.
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
378 ;; BUFFER-NAME is a variable symbol, which will get the buffer object into
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
379 ;; which FILE is read.
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
380 ;; LAST-DIR is the directory variable symbol where FILE's
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
381 ;; directory name should be returned. HOOKS-VAR is a variable symbol that will
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
382 ;; be assigned the hook to be executed after `ediff-startup' is finished.
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
383 ;; `ediff-find-file' arranges that the temp files it might create will be
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
384 ;; deleted.
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
385 (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
386 (let* ((file (symbol-value file-var))
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
387 (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
388 (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
389 (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
390 (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
391 ((file-directory-p file)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
392 (error "File `%s' is a directory" file)))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
393
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
394 ;; some of the commands, below, require full file name
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
395 (setq file (expand-file-name file))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
396
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
397 ;; Record the directory of the file
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
398 (if last-dir
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
399 (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
400
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
401 ;; Setup the buffer
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
402 (set buffer-name (find-file-noselect file))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
403
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
404 (ediff-eval-in-buffer (symbol-value buffer-name)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
405 (widen) ; Make sure the entire file is seen
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
406 (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
407 ;; ange-ftp-hook-function--arrange for temp file
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
408 (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
409 (setq file
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
410 (ediff-make-temp-file
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
411 (current-buffer) temp-file-name-prefix))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
412 (set hooks-var (cons (` (lambda () (delete-file (, file))))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
413 (symbol-value hooks-var))))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
414 ;; 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
415 ((not (equal (file-truename file)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
416 (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
417 (setq file
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
418 (ediff-make-temp-file
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
419 (current-buffer) temp-file-name-prefix))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
420 (set hooks-var (cons (` (lambda () (delete-file (, file))))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
421 (symbol-value hooks-var))))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
422 (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
423 (ediff-verify-file-buffer))))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
424 (set file-var file)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
425
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
426 (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
427 (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
428 (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
429 ;;(sit-for 0)
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
430 (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
431 (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
432 ;;(sit-for 0)
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
433 (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
434 (if (stringp file-C)
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
435 (progn
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
436 (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
437 ;;(sit-for 0)
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
438 (ediff-find-file
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
439 'file-C 'buf-C
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
440 (if (eq job-name 'ediff-merge-files-with-ancestor)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
441 'ediff-last-dir-ancestor 'ediff-last-dir-C)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
442 'startup-hooks)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
443 (ediff-setup buf-A file-A
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
444 buf-B file-B
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
445 buf-C file-C
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
446 startup-hooks
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
447 (list (cons 'ediff-job-name job-name)))))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
448
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
449
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
450 ;;;###autoload
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
451 (defalias 'ediff 'ediff-files)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
452
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
453
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
454 ;;;###autoload
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
455 (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
456 "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
457 (interactive
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
458 (let (bf)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
459 (list (setq bf (read-buffer "Buffer A to compare: "
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
460 (ediff-other-buffer "") t))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
461 (read-buffer "Buffer B to compare: "
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
462 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
463 ;; realign buffers so that two visible bufs will be
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
464 ;; at the top
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
465 (save-window-excursion (other-window 1))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
466 (ediff-other-buffer bf))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
467 t))))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
468
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
469 (or job-name (setq job-name 'ediff-buffers))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
470 (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
471
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
472 ;;;###autoload
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
473 (defun ediff-buffers3 (buffer-A buffer-B buffer-C
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
474 &optional startup-hooks job-name)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
475 "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
476 (interactive
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
477 (let (bf bff)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
478 (list (setq bf (read-buffer "Buffer A to compare: "
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
479 (ediff-other-buffer "") t))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
480 (setq bff (read-buffer "Buffer B to compare: "
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
481 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
482 ;; realign buffers so that two visible
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
483 ;; bufs will be at the top
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
484 (save-window-excursion (other-window 1))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
485 (ediff-other-buffer bf))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
486 t))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
487 (read-buffer "Buffer C to compare: "
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
488 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
489 ;; realign buffers so that three visible
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
490 ;; bufs will be at the top
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
491 (save-window-excursion (other-window 1))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
492 (ediff-other-buffer (list bf bff)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
493 t)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
494 )))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
495
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
496 (or job-name (setq job-name 'ediff-buffers3))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
497 (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
498
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
499
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
500
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
501 (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
502 (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
503 (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
504 (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
505 (buf-C-file-name (if buf-C-is-alive
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
506 (buffer-file-name (get-buffer buf-B))))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
507 file-A file-B file-C)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
508 (if (not (ediff-buffer-live-p buf-A))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
509 (error "Buffer %S doesn't exist" buf-A))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
510 (if (not (ediff-buffer-live-p buf-B))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
511 (error "Buffer %S doesn't exist" buf-B))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
512 (let ((ediff-job-name job-name))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
513 (if (and ediff-3way-comparison-job
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
514 (not buf-C-is-alive))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
515 (error "Buffer %S doesn't exist" buf-C)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
516 (if (stringp buf-A-file-name)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
517 (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
518 (if (stringp buf-B-file-name)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
519 (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
520 (if (stringp buf-C-file-name)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
521 (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
522
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
523 (setq file-A (ediff-make-temp-file buf-A buf-A-file-name)
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
524 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
525 (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
526 (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
527
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
528 (ediff-setup (get-buffer buf-A) file-A
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
529 (get-buffer buf-B) file-B
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
530 (if buf-C-is-alive (get-buffer buf-C))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
531 file-C
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
532 (cons (` (lambda ()
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
533 (delete-file (, file-A))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
534 (delete-file (, file-B))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
535 (if (stringp (, file-C)) (delete-file (, file-C)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
536 ))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
537 startup-hooks)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
538 (list (cons 'ediff-job-name job-name))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
539 )))
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
540
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
541
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
542 ;;; 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
543
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
544 ;; 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
545 ;; 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
546 ;; 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
547 ;; otherwise, use default-directory
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
548 (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
549 (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
550 ((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
551 (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
552 (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
553 f
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
554 default-directory)))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
555 (t default-directory)))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
556
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
557
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
558 ;;;###autoload
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
559 (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
560 "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
561 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
562 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
563 (interactive
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
564 (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
565 f)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
566 (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
567 (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
568 (if ediff-use-last-dir
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
569 ediff-last-dir-B
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
570 (ediff-strip-last-dir f))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
571 nil)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
572 (read-string "Filter through regular expression: "
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
573 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
574 )))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
575 (ediff-directories-internal
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
576 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
577 ))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
578
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
579 ;;;###autoload
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
580 (defalias 'edirs 'ediff-directories)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
581
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
582
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
583 ;;;###autoload
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
584 (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
585 "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
586 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
587 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
588 (interactive
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
589 (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
590 (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
591 "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
592 (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
593 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
594 )))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
595 (ediff-directory-revisions-internal
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
596 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
597 ))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
598
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
599 ;;;###autoload
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
600 (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
601
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
602
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
603 ;;;###autoload
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
604 (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
605 "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
606 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
607 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
608 (interactive
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
609 (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
610 f)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
611 (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
612 (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
613 (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
614 ediff-last-dir-B
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
615 (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
616 nil))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
617 (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
618 (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
619 ediff-last-dir-C
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
620 (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
621 nil)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
622 (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
623 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
624 )))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
625 (ediff-directories-internal
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
626 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
627 ))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
628
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
629 ;;;###autoload
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
630 (defalias 'edirs3 'ediff-directories3)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
631
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
632 ;;;###autoload
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
633 (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
634 "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
635 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
636 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
637 (interactive
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
638 (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
639 f)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
640 (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
641 (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
642 (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
643 ediff-last-dir-B
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
644 (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
645 nil)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
646 (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
647 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
648 )))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
649 (ediff-directories-internal
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
650 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
651 ))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
652
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
653 ;;;###autoload
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
654 (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
655
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
656 ;;;###autoload
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
657 (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
658 "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
659 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
660 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
661 (interactive
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
662 (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
663 f)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
664 (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
665 (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
666 (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
667 ediff-last-dir-B
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
668 (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
669 nil))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
670 (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
671 (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
672 ediff-last-dir-C
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
673 (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
674 nil)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
675 (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
676 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
677 )))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
678 (ediff-directories-internal
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
679 dir1 dir2 dir3 regexp
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
680 '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
681 ))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
682
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
683 ;;;###autoload
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
684 (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
685 "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
686 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
687 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
688 (interactive
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
689 (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
690 (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
691 "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
692 (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
693 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
694 )))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
695 (ediff-directory-revisions-internal
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
696 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
697 ))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
698
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
699 ;;;###autoload
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
700 (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
701
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
702 ;;;###autoload
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
703 (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
704 "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
705 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
706 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
707 (interactive
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
708 (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
709 (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
710 "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
711 (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
712 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
713 )))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
714 (ediff-directory-revisions-internal
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
715 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
716 '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
717 ))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
718
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
719 ;;;###autoload
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
720 (defalias
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
721 '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
722 '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
723
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
724 ;;;###autoload
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
725 (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
726
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
727 ;; 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
728 ;; 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
729 ;; 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
730 ;; file names.
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
731 ;; 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
732 (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
733 action jobname
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
734 &optional startup-hooks)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
735 ;; 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
736 ;; 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
737 (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
738 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
739
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
740 (if (stringp dir3)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
741 (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
742
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
743 (cond ((string= dir1 dir2)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
744 (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
745 ((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
746 (string= dir1 dir3))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
747 (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
748 ((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
749 (string= dir2 dir3))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
750 (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
751
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
752 (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
753 file-list meta-buf)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
754 (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
755 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
756 (setq startup-hooks
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
757 ;; 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
758 ;; ediff-prepare-meta-buffer
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
759 (cons (` (lambda ()
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
760 ;; 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
761 (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
762 ;; 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
763 (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
764 startup-hooks))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
765 (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
766 'ediff-dir-action
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
767 file-list
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
768 "*Ediff Session Group Panel"
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
769 '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
770 jobname
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
771 startup-hooks))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
772 (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
773 ))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
774
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
775 (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
776 &optional startup-hooks)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
777 (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
778 (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
779 (setq file-list
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
780 (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
781 (setq startup-hooks
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
782 ;; 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
783 ;; ediff-prepare-meta-buffer
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
784 (cons (` (lambda ()
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
785 ;; 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
786 (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
787 ))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
788 startup-hooks))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
789 (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
790 'ediff-dir-action
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
791 file-list
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
792 "*Ediff Session Group Panel"
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
793 '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
794 jobname
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
795 startup-hooks))
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
796 (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
797 ))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
798
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
799
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
800 ;;; Compare regions and windows
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
801
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
802 ;;;###autoload
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
803 (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
804 "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
805 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
806 follows:
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
807 If WIND-A is nil, use selected window.
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
808 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
809 (interactive "P")
12083
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-wordwise 'word-mode))
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
812
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
813 ;;;###autoload
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
814 (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
815 "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
816 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
817 follows:
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
818 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
819 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
820 (interactive "P")
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
821 (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
822 startup-hooks 'ediff-windows-linewise nil))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
823
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
824 ;; 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
825 ;; 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
826 ;; works as follows:
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
827 ;; 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
828 ;; 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
829 (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
830 (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
831 (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
832 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
833 (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
834 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
835
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
836 (let ((buffer-A (window-buffer wind-A))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
837 (buffer-B (window-buffer wind-B))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
838 beg-A end-A beg-B end-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
839
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
840 (save-excursion
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
841 (save-window-excursion
14040
187735b53d52 Comment fixes.
Karl Heuer <kwzh@gnu.org>
parents: 13604
diff changeset
842 (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
843 (select-window wind-A)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
844 (setq beg-A (window-start)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
845 end-A (window-end))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
846 (select-window wind-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
847 (setq beg-B (window-start)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
848 end-B (window-end))))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
849 (ediff-regions-internal
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
850 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
851 startup-hooks job-name word-mode)))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
852
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
853 ;;;###autoload
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
854 (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
855 "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
856 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
857 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
858 lines. For large regions, use `ediff-regions-linewise'."
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
859 (interactive
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
860 (let (bf)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
861 (list (setq bf (read-buffer "Region's A buffer: "
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
862 (ediff-other-buffer "") t))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
863 (read-buffer "Region's B buffer: "
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
864 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
865 ;; realign buffers so that two visible bufs will be
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
866 ;; at the top
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
867 (save-window-excursion (other-window 1))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
868 (ediff-other-buffer bf))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
869 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
870 (if (not (ediff-buffer-live-p buffer-A))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
871 (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
872 (if (not (ediff-buffer-live-p buffer-B))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
873 (error "Buffer %S doesn't exist" buffer-B))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
874
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
875
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
876 (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
877 (save-excursion
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
878 (set-buffer buffer-A)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
879 (setq reg-A-beg (region-beginning)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
880 reg-A-end (region-end))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
881 (set-buffer buffer-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
882 (setq reg-B-beg (region-beginning)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
883 reg-B-end (region-end)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
884
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
885 (ediff-regions-internal
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
886 (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
887 (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
888 startup-hooks 'ediff-regions-wordwise 'word-mode)))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
889
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
890 ;;;###autoload
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
891 (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
892 "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
893 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
894 Each region is enlarged to contain full lines.
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
895 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
896 lines. For small regions, use `ediff-regions-wordwise'."
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
897 (interactive
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
898 (let (bf)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
899 (list (setq bf (read-buffer "Region A's buffer: "
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
900 (ediff-other-buffer "") t))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
901 (read-buffer "Region B's buffer: "
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
902 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
903 ;; realign buffers so that two visible bufs will be
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
904 ;; at the top
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
905 (save-window-excursion (other-window 1))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
906 (ediff-other-buffer bf))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
907 t))))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
908 (if (not (ediff-buffer-live-p buffer-A))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
909 (error "Buffer %S doesn't exist" buffer-A))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
910 (if (not (ediff-buffer-live-p buffer-B))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
911 (error "Buffer %S doesn't exist" buffer-B))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
912
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
913 (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
914 (save-excursion
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
915 (set-buffer buffer-A)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
916 (setq reg-A-beg (region-beginning)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
917 reg-A-end (region-end))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
918 ;; enlarge the region to hold full lines
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
919 (goto-char reg-A-beg)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
920 (beginning-of-line)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
921 (setq reg-A-beg (point))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
922 (goto-char reg-A-end)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
923 (end-of-line)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
924 (or (eobp) (forward-char)) ; include the newline char
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
925 (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
926
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
927 (set-buffer buffer-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
928 (setq reg-B-beg (region-beginning)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
929 reg-B-end (region-end))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
930 ;; enlarge the region to hold full lines
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
931 (goto-char reg-A-beg)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
932 (goto-char reg-B-beg)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
933 (beginning-of-line)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
934 (setq reg-B-beg (point))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
935 (goto-char reg-B-end)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
936 (end-of-line)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
937 (or (eobp) (forward-char)) ; include the newline char
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
938 (setq reg-B-end (point))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
939 ) ; save excursion
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
940
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
941 (ediff-regions-internal
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
942 (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
943 (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
944 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
945
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
946 ;; 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
947 ;; to regions beg-B -- end-B in buffer-B.
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
948 (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
949 startup-hooks job-name word-mode)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
950 (let ((tmp-buffer (get-buffer-create ediff-tmp-buffer))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
951 overl-A overl-B
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
952 file-A file-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
953
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
954 ;; 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
955 (ediff-eval-in-buffer buffer-A
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
956 (setq beg-A (move-marker (make-marker) beg-A)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
957 end-A (move-marker (make-marker) end-A)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
958 (ediff-eval-in-buffer buffer-B
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
959 (setq beg-B (move-marker (make-marker) beg-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
960 end-B (move-marker (make-marker) end-B)))
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 (if (and (eq buffer-A buffer-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
963 (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
964 (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
965 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
966 (with-output-to-temp-buffer ediff-msg-buffer
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
967 (princ "
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
968 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
969
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
970 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
971 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
972
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
973 Continue anyway? (y/n) "))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
974
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
975 (if (y-or-n-p "Continue anyway? ")
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
976 ()
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
977 (error "%S aborted" job-name))))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
978
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
979 ;; make file-A
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
980 (if word-mode
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
981 (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
982 (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
983 (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
984
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
985 ;; make file-B
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
986 (if word-mode
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
987 (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
988 (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
989 (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
990
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
991 (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
992 (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
993 (ediff-setup buffer-A file-A
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
994 buffer-B file-B
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
995 nil nil ; buffer & file C
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
996 (cons (` (lambda ()
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
997 (delete-file (, file-A))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
998 (delete-file (, file-B))))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
999 startup-hooks)
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1000 (list (cons 'ediff-word-mode word-mode)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1001 (cons 'ediff-narrow-bounds (list overl-A overl-B))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1002 (cons 'ediff-job-name job-name))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1003 )
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1004 ))
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
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1007 ;;; Merge files and buffers
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1008
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1009 ;;;###autoload
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1010 (defalias 'ediff-merge 'ediff-merge-files)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1011
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1012 (defsubst ediff-merge-on-startup ()
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1013 (ediff-do-merge 0)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1014 (ediff-eval-in-buffer ediff-buffer-C
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1015 (set-buffer-modified-p nil)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1016
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1017 ;;;###autoload
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1018 (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
1019 "Merge two files without ancestor."
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1020 (interactive
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1021 (let ((dir-A (if ediff-use-last-dir
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1022 ediff-last-dir-A
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1023 default-directory))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1024 dir-B f)
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1025 (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
1026 "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
1027 (ediff-get-default-file-name)))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1028 (ediff-read-file-name "File B to merge"
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1029 (setq dir-B
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1030 (if ediff-use-last-dir
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1031 ediff-last-dir-B
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1032 (file-name-directory f)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1033 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1034 (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
1035 (cons (ediff-abbreviate-file-name
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1036 (expand-file-name
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1037 (file-name-nondirectory f)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1038 dir-B))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1039 file-name-history))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1040 f))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1041 )))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1042 (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
1043 (ediff-files-internal file-A
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1044 (if (file-directory-p file-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1045 (expand-file-name
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1046 (file-name-nondirectory file-A) file-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1047 file-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1048 nil ; file-C
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1049 startup-hooks
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1050 'ediff-merge-files))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1051
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1052 ;;;###autoload
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1053 (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
1054 &optional startup-hooks)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1055 "Merge two files with ancestor."
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1056 (interactive
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1057 (let ((dir-A (if ediff-use-last-dir
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1058 ediff-last-dir-A
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1059 default-directory))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1060 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
1061 (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
1062 "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
1063 (ediff-get-default-file-name)))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1064 (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
1065 (setq dir-B
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1066 (if ediff-use-last-dir
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1067 ediff-last-dir-B
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1068 (file-name-directory f)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1069 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1070 (setq file-name-history
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1071 (cons
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1072 (ediff-abbreviate-file-name
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1073 (expand-file-name
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1074 (file-name-nondirectory f)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1075 dir-B))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1076 file-name-history))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1077 f)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1078 (ediff-read-file-name "Ancestor file"
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1079 (setq dir-ancestor
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1080 (if ediff-use-last-dir
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1081 ediff-last-dir-ancestor
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1082 (file-name-directory ff)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1083 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1084 (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
1085 (cons (ediff-abbreviate-file-name
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1086 (expand-file-name
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1087 (file-name-nondirectory ff)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1088 dir-ancestor))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1089 file-name-history))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1090 ff))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1091 )))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1092 (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
1093 (ediff-files-internal file-A
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1094 (if (file-directory-p file-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1095 (expand-file-name
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1096 (file-name-nondirectory file-A) file-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1097 file-B)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1098 file-ancestor
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1099 startup-hooks
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1100 'ediff-merge-files-with-ancestor))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1101
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1102 ;;;###autoload
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1103 (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
1104
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1105 ;;;###autoload
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1106 (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
1107 "Merge buffers without ancestor."
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1108 (interactive
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1109 (let (bf)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1110 (list (setq bf (read-buffer "Buffer A to merge: "
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1111 (ediff-other-buffer "") t))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1112 (read-buffer "Buffer B to merge: "
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1113 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1114 ;; realign buffers so that two visible bufs will be
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1115 ;; at the top
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1116 (save-window-excursion (other-window 1))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1117 (ediff-other-buffer bf))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1118 t))))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1119
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1120 (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
1121 (or job-name (setq job-name 'ediff-merge-buffers))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1122 (ediff-buffers-internal
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1123 buffer-A buffer-B nil startup-hooks job-name))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1124
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1125 ;;;###autoload
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1126 (defun ediff-merge-buffers-with-ancestor (buffer-A
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1127 buffer-B buffer-ancestor
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1128 &optional startup-hooks job-name)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1129 "Merge buffers with ancestor."
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1130 (interactive
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1131 (let (bf bff)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1132 (list (setq bf (read-buffer "Buffer A to merge: "
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1133 (ediff-other-buffer "") t))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1134 (setq bff (read-buffer "Buffer B to merge: "
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1135 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1136 ;; realign buffers so that two visible
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1137 ;; bufs will be at the top
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1138 (save-window-excursion (other-window 1))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1139 (ediff-other-buffer bf))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1140 t))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1141 (read-buffer "Ancestor buffer: "
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1142 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1143 ;; realign buffers so that three visible
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1144 ;; bufs will be at the top
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1145 (save-window-excursion (other-window 1))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1146 (ediff-other-buffer (list bf bff)))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1147 t)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1148 )))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1149
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1150 (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
1151 (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
1152 (ediff-buffers-internal
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1153 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
1154
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1155
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1156 ;;;###autoload
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1157 (defun ediff-merge-revisions (&optional file startup-hooks)
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1158 "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
1159 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
1160 buffer."
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1161 (interactive)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1162 (if (stringp file) (find-file file))
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1163 (let (rev1 rev2)
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1164 (setq rev1
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1165 (read-string
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1166 (format
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1167 "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
1168 (if (stringp file)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1169 (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
1170 rev2
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1171 (read-string
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1172 (format
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1173 "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
1174 (if (stringp file)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1175 (file-name-nondirectory file) "current buffer"))))
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1176 (ediff-load-version-control)
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1177 ;; ancestor-revision=nil
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1178 (funcall
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1179 (intern (format "%S-ediff-merge-internal" ediff-version-control-package))
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1180 rev1 rev2 nil startup-hooks)))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1181
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1182
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1183 ;;;###autoload
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1184 (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
1185 "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
1186 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
1187 buffer."
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1188 (interactive)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1189 (if (stringp file) (find-file file))
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1190 (let (rev1 rev2 ancestor-rev)
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1191 (setq rev1
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1192 (read-string
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1193 (format
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1194 "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
1195 (if (stringp file)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1196 (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
1197 rev2
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1198 (read-string
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1199 (format
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1200 "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
1201 (if (stringp file)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1202 (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
1203 ancestor-rev
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1204 (read-string
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1205 (format
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1206 "Ancestor version (default: %s): "
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1207 (if (stringp file)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1208 (file-name-nondirectory file) "current buffer"))))
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1209 (ediff-load-version-control)
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1210 (funcall
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1211 (intern (format "%S-ediff-merge-internal" ediff-version-control-package))
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1212 rev1 rev2 ancestor-rev startup-hooks)))
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1213
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1214 ;;;###autoload
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1215 (defun run-ediff-from-cvs-buffer (pos)
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1216 "Run Ediff-merge on appropriate revisions of the selected file.
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1217 First run after `M-x cvs-update'. Then place the cursor on a lide describing a
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1218 file and then run `run-ediff-from-cvs-buffer'."
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1219 (interactive "d")
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1220 (ediff-load-version-control)
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1221 (let ((tin (tin-locate cvs-cookie-handle pos)))
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1222 (if tin
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1223 (cvs-run-ediff-on-file-descriptor tin)
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1224 (error "There is no file to merge"))))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1225
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1226
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1227 ;;; Apply patch
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1228
7709
d88d94461e5d (ediff-patch-buffer): Fix autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
1229 ;;;###autoload
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1230 (defun ediff-patch-buffer (buffer-name &optional startup-hooks)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1231 "Run Ediff by patching BUFFER-NAME."
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1232 (interactive "bBuffer to patch: ")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1233
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1234 (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
1235 (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
1236 (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
1237 default-dir file-name ctl-buf)
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1238 (if file-name-ok
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1239 (setq file-name file-name-ok)
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1240 (ediff-eval-in-buffer buffer-name
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1241 (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
1242 (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
1243 (set-visited-file-name file-name)
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1244 (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
1245 (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
1246 (set-buffer-modified-p nil)
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1247 (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
1248 (setq default-directory default-dir)
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1249 ))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1250
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1251 (setq ctl-buf
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1252 (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
1253
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1254 (if file-name-ok
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1255 ()
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1256 (ediff-eval-in-buffer ctl-buf
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1257 (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
1258 (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
1259 (ediff-eval-in-buffer ediff-buffer-A
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1260 (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
1261 (set-visited-file-name nil)
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1262 (rename-buffer buffer-name)
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1263 (set-buffer-modified-p buf-mod-status))
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1264 (ediff-eval-in-buffer ediff-buffer-B
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1265 (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
1266 (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
1267 (set-visited-file-name nil)
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1268 (rename-buffer (ediff-unique-buffer-name
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1269 (concat buffer-name "_patched") ""))
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1270 (set-buffer-modified-p t))))
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1271 ))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1272
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1273
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1274 (defun ediff-get-patch-buffer (dir)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1275 "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
1276 Else, read patch file into a new buffer."
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1277 (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
1278 (setq ediff-patch-buf
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1279 (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
1280 (setq ediff-patch-buf
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1281 (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
1282
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1283 (setq ediff-patch-diagnostics
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1284 (get-buffer-create "*ediff patch diagnostics*"))
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1285 (ediff-eval-in-buffer ediff-patch-diagnostics
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1286 (insert-buffer ediff-patch-buf)))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1287
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1288
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1289
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1290
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1291
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1292 ;;; Versions Control functions
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1293
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1294 ;;;###autoload
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1295 (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
1296 "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
1297 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
1298 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
1299 ;; 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
1300 (interactive "P")
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1301 (if (stringp file) (find-file file))
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1302 (let (rev1 rev2)
13133
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1303 (setq rev1
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1304 (read-string
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1305 (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
1306 (if (stringp file)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1307 (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
1308 rev2
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1309 (read-string
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1310 (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
1311 (if (stringp file)
0e069b2940ae (ediff-files,ediff-merge-files): better file-name defaults.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 12880
diff changeset
1312 (file-name-nondirectory file) "current buffer"))))
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1313 (ediff-load-version-control)
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1314 (funcall
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1315 (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
1316 rev1 rev2 startup-hooks)
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1317 ))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1318
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1319
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1320 ;; 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
1321 ;; 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
1322 (defun ediff-load-version-control (&optional silent)
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1323 (require 'ediff-vers)
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1324 (or (featurep ediff-version-control-package)
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1325 (if (locate-library (symbol-name ediff-version-control-package))
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1326 (progn
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1327 (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
1328 (require ediff-version-control-package))
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1329 (or silent
12083
2bfc61a5fbe7 don't make the patch buffer RO.
Karl Heuer <kwzh@gnu.org>
parents: 11760
diff changeset
1330 (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
1331 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
1332
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1333
13217
c3f879af05db (ediff-version): is now autoloaded.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 13133
diff changeset
1334 ;;;###autoload
c3f879af05db (ediff-version): is now autoloaded.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 13133
diff changeset
1335 (defun ediff-version ()
c3f879af05db (ediff-version): is now autoloaded.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 13133
diff changeset
1336 "Return string describing the version of Ediff.
c3f879af05db (ediff-version): is now autoloaded.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 13133
diff changeset
1337 When called interactively, displays the version."
c3f879af05db (ediff-version): is now autoloaded.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 13133
diff changeset
1338 (interactive)
c3f879af05db (ediff-version): is now autoloaded.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 13133
diff changeset
1339 (if (interactive-p)
c3f879af05db (ediff-version): is now autoloaded.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 13133
diff changeset
1340 (message (ediff-version))
c3f879af05db (ediff-version): is now autoloaded.
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 13133
diff changeset
1341 (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
1342
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1343
14582
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1344 ;;;###autoload
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1345 (defun ediff-documentation ()
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1346 "Jump to Ediff's Info file."
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1347 (interactive)
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1348 (let ((ctl-window ediff-control-window)
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1349 (ctl-buf ediff-control-buffer))
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1350
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1351 (ediff-skip-unsuitable-frames)
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1352 (condition-case nil
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1353 (progn
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1354 (pop-to-buffer (get-buffer-create "*info*"))
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1355 (info (if ediff-xemacs-p "ediff.info" "ediff"))
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1356 (message "Type `i' to search for a specific topic"))
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1357 (error (beep 1)
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1358 (with-output-to-temp-buffer " *ediff-info*"
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1359 (princ (format "
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1360 The Info file for Ediff does not seem to be installed.
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1361
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1362 This file is part of the distribution of %sEmacs.
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1363 Please contact your system administrator. "
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1364 (if ediff-xemacs-p "X" ""))))
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1365 (if (window-live-p ctl-window)
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1366 (progn
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1367 (select-window ctl-window)
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1368 (set-window-buffer ctl-window ctl-buf)))))))
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1369
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1370
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1371
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1372
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1373 ;;; Local Variables:
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1374 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun)
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1375 ;;; eval: (put 'ediff-eval-in-buffer 'lisp-indent-hook 1)
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1376 ;;; End:
c768f6d7daaa *** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents: 14169
diff changeset
1377
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1378 (provide 'ediff)
11041
17b319a26eea Installed new version from author.
Karl Heuer <kwzh@gnu.org>
parents: 8874
diff changeset
1379 (require 'ediff-util)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1380
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1381 ;;; ediff.el ends here