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