annotate lisp/ediff.el @ 50798:2d72cdb7e9f8

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