annotate lisp/ediff.el @ 9091:557a04cd151b

entered into RCS
author Paul Reilly <pmr@pajato.com>
date Sun, 25 Sep 1994 20:46:44 +0000
parents 716969785d08
children 17b319a26eea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1 ;;; ediff.el --- a visual interface to diff & patch
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2 ;;; Copyright (C) 1994 Free Software Foundation, Inc.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4 ;; Author: Michael Kifer <kifer@cs.sunysb.edu>
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 ;; Created: February 2, 1994
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
6 ;; Version: 1.65e
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
7 ;; Keywords: comparing, merging, patching, version control.
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
9 (defvar ediff-version "1.65e" "The current version of Ediff")
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
10 (defvar ediff-date "September 1, 1994" "Date of last update")
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
11
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 ;; This file is part of GNU Emacs.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 ;; GNU Emacs is free software; you can redistribute it and/or modify
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;; it under the terms of the GNU General Public License as published by
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;; the Free Software Foundation; either version 2, or (at your option)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; any later version.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; GNU Emacs is distributed in the hope that it will be useful,
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22 ;; GNU General Public License for more details.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24 ;; You should have received a copy of the GNU General Public License
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25 ;; along with GNU Emacs; see the file COPYING. If not, write to
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26 ;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 ;;; Commentary:
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30 ;; ----------
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31
7391
c40d16ee57bf entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 7267
diff changeset
32 ;; Never read those diff outputs again!
c40d16ee57bf entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 7267
diff changeset
33 ;; Apply patch selectively, like a pro!
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
35 ;; This package provides a convenient way of simultaneous browsing through
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 ;; the differences between a pair of files or buffers. The two files being
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 ;; compared (file-A and file-B) are shown in separate windows (side by
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 ;; side, one above the another, or in separate frames), and the differences
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 ;; are highlighted as you step through them. You can also copy difference
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 ;; regions from one buffer to another (and recover old differences if you
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 ;; change your mind).
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 ;; 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
44 ;; though both files, the patched and the original one, simultaneously,
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 ;; 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
46 ;; 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
47 ;; Since Ediff lets you copy differences between buffers, you can, in
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 ;; effect, apply patches selectively (i.e., you can copy a difference
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 ;; region from file.orig to file, thereby undoing any particular patch that
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 ;; you don't like).
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
52 ;; This package builds upon the ideas borrowed from emerge.el. It is still
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
53 ;; using half a dozen of functions defined there. Several other Ediff's
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
54 ;; functions are adaptations from emerge.el. Ediff requires, at least,
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
55 ;; Version 5 of emerge.el. This version comes with standard distributions
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
56 ;; of Emacs and Lemacs. Make sure you don't have some stray old copy of
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
57 ;; Emerge on your load path.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
58
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
59 ;; Ediff is complimentary to Emerge. While Emerge is primarily intended
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
60 ;; for merging of files, Ediff is by far superior for browsing through
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
61 ;; files compared via diff and for patching files with patch.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
62 ;; Furthermore, Ediff is more convenient even for merging, when one of the
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
63 ;; files is a designated output. This situation arises while patching
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
64 ;; files or when comparing an old version of a file with a newer version
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
65 ;; (in such cases, it is often desirable to selectively revert some
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
66 ;; portions of the new file to its old state).
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
67
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
68 ;; Ediff also supports version control via vc.el (in the standard
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
69 ;; distribution of Emacs 19) and rcs.el. The latter is a package written by
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
70 ;; Sebastian Kremer <sk@thp.Uni-Koeln.DE>, which is available in
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
71 ;;
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
72 ;; ftp.cs.buffalo.edu:pub/Emacs/rcs.tar.Z
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
73 ;; ftp.uni-koeln.de:/pub/gnu/emacs/rcs.tar.Z
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
74 ;;
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
75 ;; To specify which version control package you are using, set the variable
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
76 ;; ediff-version-control-package, e.g.,
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
77 ;; (setq ediff-version-control-package 'rcs)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
78 ;; The default, is 'vc'.
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
79
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 ;; Window configuration:
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 ;; ----------------------
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 ;; By default, Ediff sets things up in one frame, splitting it between a
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 ;; small control window and the two windows for file-A and file-B. The
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 ;; split between these latter windows can be horizontal or vertical, which
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87 ;; can be changed interactively by hitting 's' while the cursor is in the
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 ;; control window.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 ;; In a multi-frame situation, Ediff would work as follows. When it starts,
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 ;; it will place the control window in the frame that was selected at the
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 ;; time of the invocation. If file-A or file-B is seen in one of the
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 ;; frames, Ediff will leave it there. If a file (A/B) is not visible in any
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 ;; frame, Ediff will arrange that it will share a frame with the control
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 ;; window. (If none of the files is visible, then both will share the
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 ;; control window frame.) The same algorithm works when you hit 'c'
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 ;; (ediff-recenter), 'p' (ediff-previous-difference), 'n', etc.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 ;; Thus, you can compare files in one frame or in different frames.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 ;; The former is done by default, while the latter can be achieved by
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 ;; arranging files A and B to be seen in different frames. Ediff
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 ;; respects these arrangements, automatically adapting itself to
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 ;; the multi-frame mode.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
106 ;; To those who like to go where noone has gone before:
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 ;; Ediff lets the user run multiple sessions at once, i.e., you can invoke
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 ;; Ediff on different functions several times in a row, without exiting
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 ;; the previous Ediff sessions. Different sessions may even operate on the
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 ;; same pair of files. So, in principle, it is possible to do, say,
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 ;; pairwise comparison of three (or more) different files. Each session
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
113 ;; would have its own Ediff Control Panel and all the regarding a
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
114 ;; particular session is local to the associated control panel buffer.
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 ;; You can switch between sessions by suspending one session and then
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
116 ;; switching to another control panel. (Different control panel buffers
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
117 ;; are distinguished by a numerical suffix, e.g., Ediff Control Panel<3>.)
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
118 ;; Thus, if you would like to compare three files pairwise, you can do
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119 ;; this by preparing three different frames, each with its own control
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
120 ;; window. (This would require a very wide screen, and I never claimed
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
121 ;; that such 3-way comparison is very easy to do.)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
122 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
123 ;; If you need to conduct multiple Ediff sessions on the same file, one
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
124 ;; thing should be kept in mind: each time you invoke Ediff on a buffer that
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
125 ;; already participates in another Ediff session, that buffer should not
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
126 ;; have any ASCII Ediff flags in it. (Highlighting with faces is OK.) If
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
127 ;; flags are not removed, difference overlays won't be set correctly
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
128 ;; for the second invocation of Ediff. The simplest way to remove ASCII
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
129 ;; flags from an Ediff buffer is to hit `h' and thus switch to highlighting
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
130 ;; with faces (unhighlighting on a dumb terminal).
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
131
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
132 ;;; Remote and Compressed Files
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
133 ;; ---------------------------
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
134
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
135 ;; Ediff will work with remote, compressed, and encrypted files. Ediff
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
136 ;; supports ange-ftp.el, jka-compr.el, uncompress.el and crypt++.el, but
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
137 ;; it may work with other similar packages as well. This
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
138 ;; means that you can compare files residing on another machine, or you
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
139 ;; can apply a patch to a file on another machine (even the patch itself
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
140 ;; can be a remote file!).
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
141 ;;
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
142 ;; When patching compressed or remote files, Ediff doesn't rename the
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
143 ;; source file into source-file-name.orig (unlike what `patch' would
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
144 ;; usually do). Instead, the source file retains its name and the result
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
145 ;; of applying the patch is placed in a temporary file that has the suffix
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
146 ;; `.patched'. Generally, this applies to files that are handled using
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
147 ;; black magic, such as special file handlers (ange-ftp and some
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
148 ;; compression and encryption packages all use this method).
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
149 ;;
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
150 ;; Regular files are treated by `patch' in the usual manner, i.e., the
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
151 ;; original is renamed into source-name.orig and the result of the patch
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
152 ;; is placed into the file source-name.
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
153
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
154
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
155 ;;; Remarks:
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
156 ;; -------
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
157
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
158 ;; 1. Ediff is heavily dependent on the new features of Emacs 19.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
159 ;; It won't run under Emacs 18 at all.
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
160 ;; 2. If running Lucid Emacs, Ediff requires at least version 19.9.
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
161 ;; 3. The function ediff-revision requires the version of vc.el that comes
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
162 ;; with Emacs 19.22 and later, or rcs.el version 1.67 or later.
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
163
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
164
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
165 ;;; Installation and use:
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
166 ;; --------------------
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
167
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
168 ;; You can invoke Ediff interactively using the following functions:
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
169 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
170 ;; ediff-buffers - compare buffers
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
171 ;; ediff - alias for ediff-files)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
172 ;; ediff-files - compare files
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
173 ;; ediff-patch-file - patch file then compare
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
174 ;; epatch - alias for ediff-patch-file
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
175 ;; ediff-patch-buffer - patch buffer then compare
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
176 ;; epatch-buffer - alias for ediff-patch-buffer
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
177 ;; ediff-revision - compare buffer & version
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
178 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
179 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
180 ;; To use Ediff, put this in your .emacs file:
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
181 ;;
7391
c40d16ee57bf entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 7267
diff changeset
182 ;; (autoload 'ediff-buffers "ediff" "Visual interface to diff" t)
c40d16ee57bf entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 7267
diff changeset
183 ;; (autoload 'ediff "ediff" "Visual interface to diff" t)
c40d16ee57bf entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 7267
diff changeset
184 ;; (autoload 'ediff-files "ediff" "Visual interface to diff" t)
c40d16ee57bf entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 7267
diff changeset
185 ;; (autoload 'epatch "ediff" "Visual interface to patch" t)
c40d16ee57bf entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 7267
diff changeset
186 ;; (autoload 'ediff-patch-file "ediff" "Visual interface to patch" t)
c40d16ee57bf entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 7267
diff changeset
187 ;; (autoload 'ediff-patch-buffer "ediff" "Visual interface to patch" t)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
188 ;; (autoload 'epatch-buffer "ediff" "Visual interface to patch" t)
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
189 ;; (autoload 'ediff-revision "ediff"
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
190 ;; "Interface to diff & version control" t)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
191 ;;
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 ;; If you want Ediff to be loaded from the very beginning, you should have
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
194 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
195 ;; (require 'ediff)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
196 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
197 ;; in your .emacs file. This way it is also easier to figure out changes
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
198 ;; to the default Ediff setting, if such changes become necessary --- see
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
199 ;; Customization.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
200 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
201
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
202 ;;; Compilation
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
203 ;; -----------
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
204 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
205 ;; When you byte-compile Ediff, you will get some warnings about functions
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
206 ;; being undefined. These can be safely ignored.
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
207 ;;
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
208 ;; Important:
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
209 ;; =========
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
210 ;;
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
211 ;; If you are using advice.el (directly or indirectly, via one of the
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
212 ;; other packages), Ediff may not compile properly. In this case, you
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
213 ;; should do:
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
214 ;;
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
215 ;; M-x ad-deactivate-all RET
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
216 ;;
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
217 ;; M-x byte-compile-file RET ediff.el RET
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
218 ;;
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
219 ;; M-x ad-activate-all RET
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
220 ;;
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
221 ;; This precaution will not be needed starting with GNU Emacs 19.23 and
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
222 ;; Lucid Emacs 19.10, due to fixing a bug in advice.el.
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
223
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
224 ;;; Customization:
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
225 ;; -------------
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
226
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
227 ;; Hooks:
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
228 ;; -----
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
229 ;; If you don't like the default setting, you can change it through the
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
230 ;; various variables and hooks. In particular, the following hooks are
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
231 ;; available:
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
232
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
233 ;; ediff-load-hooks
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
234 ;; ediff-before-setup-windows-hooks
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
235 ;; ediff-startup-hooks
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
236 ;; ediff-select-hooks
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
237 ;; ediff-unselect-hooks
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
238 ;; ediff-suspend-hooks
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
239 ;; ediff-quit-hooks
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
240 ;; ediff-prepare-buffer-hooks
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
241
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
242 ;; The hooks in ediff-load-hooks can be used to change defaults after Ediff
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
243 ;; is loaded.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
244 ;; The hooks in ediff-before-setup-windows-hooks, ediff-suspend-hooks, and
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
245 ;; ediff-quit-hooks can be used to save and then restore whatever window
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
246 ;; configuration you want. However, make sure you understand what you are
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
247 ;; doing. Many variables that drive Ediff are local to the different
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
248 ;; Ediff Control Panel buffers. Take a look at ediff-default-suspend-hook and
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
249 ;; ediff-default-quit-hook to see what's involved.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
250 ;; The hooks in ediff-prepare-buffer-hooks are executed for each Ediff buffer
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
251 ;; (A and B) right after these buffers are arranged.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
252 ;;
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
253 ;;
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
254 ;; Selective browsing: Control over stepping through difference regions
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
255 ;; -----------------------------------------------
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
256 ;;
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
257 ;; Sometimes it is convenient to be able to step through only some
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
258 ;; difference regions, those that satisfy certain conditions and to ignore
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
259 ;; all others. The commands `#f' and `#h' let the user specify regular
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
260 ;; expressions to control the way Ediff skips to the next or previous
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
261 ;; difference. Typing `#f' lets one specify a pair of regular expressions,
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
262 ;; regexp-A and regexp-B.
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
263 ;; Ediff will then start stepping only through those difference regions where
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
264 ;; the region in buffer A matches regexp-A and the region in buffer B
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
265 ;; matches regexp-B.
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
266 ;; Similarly, using `#h', one specifies expressions that match difference
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
267 ;; regions to be ignored while stepping through the differences. That is, if
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
268 ;; the buf A part matches regexp-A and the buf B part matches regexp B then
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
269 ;; the region will be ignored by ediff-next-difference and
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
270 ;; ediff-previous-difference commands.
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
271 ;;
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
272 ;; Hitting `#f' and `#h' toggles this feature on/off.
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
273 ;;
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
274 ;; Note that selective browsing affects only ediff-next-difference and
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
275 ;; ediff-previous-difference, i.e., the commands invoked by typing n/SPC
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
276 ;; and p/DEL. You can still jump directly (using `j' or `ga/gb') to any
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
277 ;; numbered difference. Also, it should be understood, that #f and #h do
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
278 ;; not change the position of the point in the buffers. The effect of these
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
279 ;; commands is seen only when the user types `n' or `p', i.e., when
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
280 ;; Ediff is told to jump to the next or previous difference.
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
281 ;;
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
282 ;; Users can supply their own functions that specify how Ediff should do
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
283 ;; selective browsing. To change the default Ediff function, add a function to
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
284 ;; ediff-load-hooks which will do the following assignments:
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
285 ;;
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
286 ;; (fset ediff-hide-regexp-matches 'your-hide-function)
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
287 ;; (fset ediff-focus-on-regexp-matches 'your-focus-function)
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
288 ;;
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
289 ;; Useful hints: To specify a regexp that matches everything, don't simply
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
290 ;; type RET in response to a prompt. Typing RET tells Ediff to accept the
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
291 ;; default value, which may not be what you want. Instead, one should enter
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
292 ;; something like `^' or `$' --- which would match every line.
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
293 ;;
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
294 ;; If the user doesn't remember if selective browsing is in effect and
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
295 ;; which regexps are being used, the status command, `i', will supply
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
296 ;; the requisite information.
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
297 ;;
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
298 ;; In addition to the ability to ignore regions that match regular
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
299 ;; expressions, Ediff can be ordered to start skipping over certain
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
300 ;; `inessential' regions. This is controlled by the variable
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
301 ;;
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
302 ;; ediff-ignore-similar-regions
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
303 ;;
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
304 ;; which, if set to t, will cause Ediff to skip over difference regions
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
305 ;; that has been found similar, i.e., where the only differences are those
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
306 ;; in the white space and newlines.
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
307 ;;
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
308 ;; Note: In order for this feature to work, auto-refining of difference
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
309 ;; regions must be on, since otherwise Ediff won't know if there are no
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
310 ;; fine differences between regions. Under X, auto-refining is a default,
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
311 ;; but it is nixed on a dumb terminal or in an Xterm window. Therefore, in
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
312 ;; a non-windowing environment, the user must explicitly turn
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
313 ;; auto-refining on (e.g., by typing `@').
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
314 ;;
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
315 ;; CAUTION: If many inessential regions appear in a row, Ediff may take a
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
316 ;; long time to jump to the next region because it has to compute fine
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
317 ;; differences of all intermediate regions.
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
318 ;;
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
319 ;;
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
320 ;; Highlighting difference regions
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
321 ;; -------------------------------
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
322 ;; The second group of Ediff variables that could be changed, if you so
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
323 ;; wish, is:
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
324 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
325 ;; ediff-before-flag-eol
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
326 ;; ediff-after-flag-eol
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
327 ;; ediff-before-flag-mol
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
328 ;; ediff-after-flag-mol
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
329 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
330 ;; ediff-current-diff-face-A
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
331 ;; ediff-current-diff-face-B
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
332 ;; ediff-fine-diff-face-A
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
333 ;; ediff-fine-diff-face-B
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
334 ;; ediff-even-diff-face-A
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
335 ;; ediff-even-diff-face-B
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
336 ;; ediff-odd-diff-face-A
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
337 ;; ediff-odd-diff-face-B
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
338 ;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
339 ;; The first four are ASCII strings that mark the beginning and the end of
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
340 ;; the differences found in file-A and file-B. Ediff uses different flags
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
341 ;; to highlight regions that begin/end at the beginning of a line or in a
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
342 ;; middle of a line.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
343
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
344 ;; The rest are the faces used to highlight text on X displays. On X
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
345 ;; displays, Ediff uses ediff-current-diff-face-A and
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
346 ;; ediff-current-diff-face-B to highlight the current difference regions.
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
347 ;; The faces ediff-fine-diff-face-A and ediff-fine-diff-face-B
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
348 ;; are used to show the fine differences between the current differences
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
349 ;; regions in buffer A and B.
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
350 ;; Other (non-current) difference regions are displayed in alternating
7391
c40d16ee57bf entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 7267
diff changeset
351 ;; faces: ediff-even/odd-diff-face-A/B. The odd and the even
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
352 ;; faces are actually identical on monochrome displays, because it is
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
353 ;; rather poor in what you can do on such a display. So, I chose to use
8348
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
354 ;; italics to highlight other differences. Any ideas would be welcome.
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
355 ;; There are two ways to change the default setting for highlighting faces:
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
356 ;; either change the variables, as in
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
357 ;;
8348
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
358 ;; (setq ediff-current-diff-face-A 'bold-italic)
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
359 ;;
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
360 ;; or
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
361 ;;
8348
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
362 ;; (setq ediff-current-diff-face-A
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
363 ;; (copy-face 'bold-italic 'ediff-current-diff-face-A))
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
364 ;;
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
365 ;; or by selectively modifying the defaults:
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
366 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
367 ;; (add-hook 'ediff-load-hooks
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
368 ;; (function (lambda ()
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
369 ;; (set-face-foreground ediff-current-diff-face-B "blue")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
370 ;; (set-face-background ediff-current-diff-face-B "red")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
371 ;; (make-face-italic ediff-current-diff-face-B))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
372 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
373 ;; You may also want to take a look at how the above faces are defined in
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
374 ;; Ediff.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
375 ;;
8348
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
376 ;; Note: it is not recommended to use `internal-get-face' (or `get-face' in
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
377 ;; Lucid) when defining faces for Ediff, since this may cause
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
378 ;; problems when there are several frames with different font sizes.
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
379 ;; Instead, use copy-face or set/make-face-* as shown above.
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
380 ;;
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
381 ;; The last group of variables in this group,
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
382 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
383 ;; ediff-want-faces
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
384 ;; ediff-highlight-all-diffs
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
385 ;; ediff-want-default-menus
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 ;; indicate whether---on a window system---you want differences to be
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
388 ;; marked using ASCII strings (like on a dumb terminal) or using colors and
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
389 ;; highlighting. If ediff-want-faces is t, then highlighting with faces is
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
390 ;; used. Normally, Ediff highlights all differences, but the selected
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
391 ;; difference is highlighted more visibly. You can cycle through various
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
392 ;; modes of highlighting by hitting `h'. By default, Ediff starts in the
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
393 ;; mode where all difference regions are highlighted. If you prefer to
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
394 ;; start in the mode where unselected differences are not highlighted, you
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
395 ;; should set ediff-highlight-all-diffs to nil.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
396 ;; You will still be able to turn on highlighting of all differences by
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
397 ;; hitting `h'.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
398 ;; The variable `ediff-want-default-menus', if true, will cause Ediff to
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
399 ;; set up a pair of menues in the menu bar, so you can invoke it from there.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
400 ;; If you don't like the look of the default menus, set this variable to
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
401 ;; nil and design your own menus.
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
402 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
403 ;; If you plan on changing these variables, they must be set
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
404 ;; BEFORE ediff.el is loaded.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
405 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
406 ;; Note: Ediff lets you switch between the two types of highlighting. That
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
407 ;; is you can switch, interactively, from highlighting using faces to
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
408 ;; highlighting using ASCII flags, and back. Of course, toggling has
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
409 ;; effect only on a window system. On a dumb terminal or in an xterm
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
410 ;; window, the only available option is highlighting with ASCII flags.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
411 ;;
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
412 ;; Refining difference regions
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
413 ;; ---------------------------
8348
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
414 ;; Ediff has variables that control the way fine differences are
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
415 ;; highlighted. This feature lets the user highlight the exact words that
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
416 ;; make the difference regions in buffer A and B different. This process
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
417 ;; ignores spaces, tabs, and newlines.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
418 ;;
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
419 ;; ediff-auto-refine
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
420 ;; ediff-auto-refine-limit
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
421 ;;
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
422 ;; By default, `ediff-auto-refine' is `'on', which means that fine differences
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
423 ;; within regions will be highlighted automatically. On a slow system, this
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
424 ;; feature may be undesirable. In any case, the user can always toggle
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
425 ;; auto-refining on/off/nix by hitting `@'. When auto-refining is off, fine
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
426 ;; differences will be shown only for regions for which these differences
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
427 ;; have been computed and saved before. If auto-refining is nixed, fine
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
428 ;; differences will not be shown at all. Hitting `*' will compute and
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
429 ;; display fine differences for the current difference region regardless of
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
430 ;; whether auto-refining is on, off, or nixed.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
431 ;; If auto-refining is on, the variable `ediff-auto-refine-limit' limits
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
432 ;; the size of the regions to be auto-refined. This variable guards against
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
433 ;; possible slow-down that may be caused by an extraordinary large
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
434 ;; difference region. However, the user can always force refining by
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
435 ;; hitting `*'.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
436 ;;
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
437 ;; ediff-fine-diff-program
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
438 ;; ediff-fine-diff-options
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
439 ;; ediff-forward-word-function
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
440 ;;
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
441 ;; These variables let the user control how fine differences are computed.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
442 ;; `ediff-fine-diff-program' is diff, by default. However, you can use
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
443 ;; any function as long as it produces output consistent with diff.
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
444 ;; `ediff-forward-word-function' is a lisp function that determines how the
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
445 ;; current difference region is split into words. (Fine diferences are
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
446 ;; computed by first splitting the current difference region into words and
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
447 ;; then passing this along to `ediff-fine-diff-program'. For the default
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
448 ;; wordify function, `ediff-forward-word', a word is a string consisting of
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
449 ;; letters, `-', or `_', or a string consisting of symbols that are neither
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
450 ;; space, nor a letter.)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
451 ;;
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
452 ;; Patch and diff programs
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
453 ;; -----------------------
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
454 ;; The next group of variables determines the programs to be used for
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
455 ;; applying patches and for computing the main difference regions (not the
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
456 ;; fine difference regions):
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
457 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
458 ;; ediff-patch-program
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
459 ;; ediff-patch-options
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
460 ;; ediff-diff-program
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
461 ;; ediff-diff-options
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
462 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
463 ;; These specify the functions that produce differences and do patching.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
464 ;; The *-options variables specify which options to pass to these programs.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
465 ;; It is unlikely that you would want to change these. One possible
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
466 ;; exception is when you may want to generate differences with context
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
467 ;; lines in order to send a patch file through email. Then, you might want
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
468 ;; to set ediff-diff-options to '-c'. Sometimes, you may also want to tell
7391
c40d16ee57bf entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 7267
diff changeset
469 ;; diff to ignore spaces and such. Use the option '-w' for that. Diff
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
470 ;; has several other useful options (type 'man diff' to find out).
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
471 ;;
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
472 ;; The output from diff is found in *ediff-diff* buffer, which you can save.
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
473 ;; However, using Ediff for producing a diff output makes sense only if you
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
474 ;; also intend to use Ediff to browse through the diff'ed files before
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
475 ;; sending the patch. This is because diff.el, which also comes with
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
476 ;; Emacs, is much faster in yielding the output of diff (Ediff is a big
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
477 ;; gun, if used for this simple purpose).
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
478 ;;
8348
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
479 ;; Mode line
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
480 ;; ---------
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
481 ;;
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
482 ;; When Ediff is running, the mode line of Ediff Control Panel buffer
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
483 ;; displays the current difference being displayed and the total number of
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
484 ;; difference regions in the two files.
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
485 ;;
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
486 ;; The mode line of the buffers being compared displays the type of the
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
487 ;; buffer (`A:' or `B:') and (usually) the file name. Ediff is trying to be
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
488 ;; intelligent in choosing mode line buffer identification. In particular,
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
489 ;; it works well with uniquify.el and mode-line.el packages (which improve
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
490 ;; on the default way in which Emacs displays buffer identification).
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
491 ;; If you don't like the way Ediff identifies its buffers, there is always
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
492 ;; ediff-prepare-buffer-hooks, which can be used to modify the mode line.
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
493 ;;
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
494 ;; Miscellaneous
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
495 ;; -------------
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
496 ;; The last set of variables that can be modified is
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
497 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
498 ;; ediff-split-window-function
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
499 ;; ediff-use-last-dir
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
500 ;; ediff-no-help-in-control-buffer
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
501 ;; ediff-toggle-read-only-function
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
502 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
503 ;; ediff-split-window-function controls the way you want the window be
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
504 ;; split between file-A and file-B. It defaults to vertical split, but you
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
505 ;; can set it to 'split-window-horizontally, if you want. Ediff lets you
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
506 ;; toggle the way windows are split, so you can try different settings
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
507 ;; interactively. Note: if file-A and file-B are in different frames,
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
508 ;; windows are not split, regardless of the value
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
509 ;; ediff-split-window-function. Instead, other windows on these frames are
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
510 ;; deleted and Ediff starts displaying file-A and file-B using these two
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
511 ;; frames, one file per frame. You can then switch to one-frame mode
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
512 ;; simply by hiding the file-A/B buffer that is displayed on a frame other
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
513 ;; than the control-window frame.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
514 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
515 ;; Note that if Ediff sees that the two buffers it compares are residing in
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
516 ;; separate frames, it assumes that the user wants them to be so displayed
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
517 ;; and stops splitting windows. Instead, it will arrange each buffer to
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
518 ;; occupy its own frame (possibly shared with Ediff's help window).
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
519 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
520 ;; The variable ediff-use-last-dir controls the way Ediff presents the
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
521 ;; default directory when it prompts the user for files to compare. If nil,
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
522 ;; Ediff will use the default directory of the current buffer when it
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
523 ;; prompts the user for file names. Otherwise, it will use the
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
524 ;; directories it had previously used for file-A and file-B.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
525 ;;
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
526 ;; The variable ediff-no-help-in-control-buffer, if set to t, makes C-h
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
527 ;; behave like the DEL key, i.e., it will move you back to the previous
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
528 ;; difference rather than invoking help. This is useful when, in an xterm
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
529 ;; window or on a dumb terminal, the Backspace key is bound to C-h and is
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
530 ;; positioned more conveniently than the DEL key.
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
531 ;;
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
532 ;; The variable ediff-toggle-read-only-function can be used to change the
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
533 ;; way Ediff toggles the read-only property in its buffers.
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
534 ;; By default, Ediff uses toggle-read-only. For files under version
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
535 ;; control, Ediff first tries to check the files out.
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
536
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
537
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
538 ;;; Commands
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
539 ;; --------
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
540
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
541 ;; All Ediff commands are displayed in a help window, unless you hit '?' to
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
542 ;; shrink it to just one line. You can redisplay the help window by hitting
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
543 ;; '?' again.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
544 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
545 ;; Many Ediff commands take numeric prefix arguments. For instance, if you
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
546 ;; hit a number, N, and then 'j' (ediff-jump-to-difference), Ediff will
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
547 ;; take you to Nth difference. Hitting a number, N, and then 'ab'
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
548 ;; (ediff-diff-to-diff) will copy Nth difference from buffer A to buffer B.
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
549 ;; Hitting 'ba' does copying in the other direction.
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
550 ;; Likewise, a number, N, followed by 'ra' will restore the Nth difference
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
551 ;; region in buffer A (if it was previously saved as a result of copying
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
552 ;; from B to A).
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
553 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
554 ;; Without the prefix argument, all commands operate on the current
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
555 ;; difference region.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
556 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
557 ;; The total number of differences and the current difference number are
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
558 ;; always displayed in the mode line of the control window.
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
559 ;;
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
560 ;; If, after making changes to buffers A and B, you decide to save them, it
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
561 ;; is recommended to use `ediff-save-buffer', which is bound to `wa' and
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
562 ;; `wb' (`wa will save buffer A and `wb' saves buffer B).
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
563 ;;
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
564 ;; Typing `wf' will also save the diff output in a file.
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
565
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
566 ;;; Display Modes
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
567 ;; -------------
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
568
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
569 ;; Ediff can display files in one frame, stacked side-by-side or one on top
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
570 ;; of another; or it can display the files in different frames. When you
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
571 ;; start Ediff, it assumes a 1-frame mode. You can toggle the side-by-side
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
572 ;; and one-on-top-of-another displays by simply hitting 's'.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
573 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
574 ;; Ediff switches to the multi-frame mode when:
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
575 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
576 ;; 1. file-A and file-B are in different frames (you have to put them into
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
577 ;; different frames manually); or
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
578 ;; 2. Ediff Control Panel is visible in one frame and one other file (A
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
579 ;; or B) is visible in another frame. If, say, fileA is visible in 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
580 ;; different frame than Ediff Control Panel, fileB doesn't have to be
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
581 ;; visible. If it is, Ediff will continue displaying fileB in the frame
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
582 ;; where it was visible before. If it isn't then Ediff will arrange for
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
583 ;; fileB to share a frame with Ediff Control Panel.
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
584 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
585 ;; If all three buffers are in separate frames, Ediff will switch to a
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
586 ;; 3-frame mode. If Ediff buffers are currently visible only in two
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
587 ;; frames, Ediff will work in a 2-frame mode. In this mode, one of the
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
588 ;; frames will be shared by Ediff Control Panel and file-A or file-B
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
589 ;; (whichever is appropriate).
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
590
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
591
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
592 ;;; Bugs:
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
593 ;; ----
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
594
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
595 ;; 1. The undo command doesn't restore deleted regions well. That is, if
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
596 ;; you delete all characters in a difference region and then invoke
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
597 ;; `undo', the reinserted text will most likely be reinserted outside of
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
598 ;; what Ediff thinks is the current difference region. (This problem
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
599 ;; doesn't seem to exist with Lucid Emacs.)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
600 ;;
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
601 ;; 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
602 ;; you can hit '!' to recompute the differences.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
603
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
604 ;; 2. Emacs 19.xx, where xx < 23, has several bugs related to overlays and
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
605 ;; faces. Somethimes, these may cause highlighting of the refinements or
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
606 ;; of the unselected differences to disappear. Hitting `!' will bring them
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
607 ;; back. In version 19.23 and later, these problems no longer occur.
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
608
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
609 ;; 3. On a monochrome display, the repertoire of faces with which to
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
610 ;; highlight fine differences is limited. By default, Ediff is using
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
611 ;; underlining. However, if the region is already underlied by some other
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
612 ;; overlays, there is no simple way to temporarily remove that residual
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
613 ;; underlining. This problem occurs when a buffer is highlighted with
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
614 ;; hilit19.el or font-lock.el packages. If this residual highlighting gets
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
615 ;; in the way, you can do the following. Both font-lock.el and hilit19.el
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
616 ;; provide commands for unhighlighting buffers. You can either place these
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
617 ;; commands in `ediff-prepare-buffer-hooks' (which will unhighlight every
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
618 ;; 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
619 ;; and on any buffer.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
620
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
621 ;; 4. In Lucid Emacs (statically linked with Motif libraries), emerge.el
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
622 ;; and hence ediff.el won't start, unless you set (setq scrollbar-width 0).
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
623 ;; This is a Motif-related bug, I was told.
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
624
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
625
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
626 ;;; Change Log:
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
627 ;; ----------
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
628
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
629 ;; Thu Feb 3, 1994
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
630
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
631 ;; Added ediff-read-file-name, which is a stub that takes care of Lemacs
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
632 ;; versions of Emerge. (Thanks to Alastair Burt <burt@dfki.uni-kl.de>.)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
633 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
634 ;; Fixed a bug in ediff-setup-windows that caused control window to
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
635 ;; appear in a wrong place when split-window-keep-point is nil
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
636 ;; (Thanks to Kevin Broadey <KevinB@bartley.demon.co.uk>.)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
637 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
638 ;; Added mechanism for using faces instead of before/after flags. This
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
639 ;; looks much better on an X display, especially on a color one.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
640 ;; (Thanks to Boris Goldowsky <boris@cs.rochester.edu> for the code
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
641 ;; that led to ediff-highlight-diff.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
642 ;; Also, thanks to Kevin Esler <esler@ch.hp.com> for suggestions
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
643 ;; regarding highlighting differences on X displays.)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
644 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
645 ;; Added functions to apply patches.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
646 ;; (Thanks to Kevin Broadey <KevinB@bartley.demon.co.uk> for this
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
647 ;; suggestion.)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
648
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
649 ;; Fri Feb 4, 1994
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
650
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
651 ;; Added mechanism for toggling vertical/horizontal window split.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
652 ;; (Inspired by a suggestion from Allan Gottlieb
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
653 ;; <gottlieb@allan.ultra.nyu.edu> -- thanks.)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
654 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
655 ;; Added mechanism for toggling between highlighting using faces and
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
656 ;; highlighting using ASCII flags.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
657 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
658 ;; Fixed a problem with undo. Now, Ediff has smartened up and doesn't
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
659 ;; keep undo info on ASCII flags inserted in buffer-A and buffer-B.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
660 ;; So, if you edit the files while browsing through them, undo behaves
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
661 ;; as you would expect, i.e., faces/flags don't get in the way.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
662
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
663 ;; Sun Feb 6, 1994
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
664
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
665 ;; Added horizontal scrolling. Added ediff-position-region to ensure
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
666 ;; that difference regions in buffer-A and buffer-B are aligned with
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
667 ;; each other. Disabled ediff-toggle-split when buffers are displayed
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
668 ;; in different frames.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
669
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
670 ;; Mon Feb 7, 1994
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
671
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
672 ;; Added toggle-window help (Suggested by Boris Goldowsky
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
673 ;; <boris@cs.rochester.edu>.)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
674 ;; Added functions to copy differences from one buffer to another and to
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
675 ;; recover old differences.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
676 ;; Added prefix arguments to ediff-next-difference and
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
677 ;; ediff-previous-difference.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
678
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
679 ;; Tue Feb 8, 1994
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
680
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
681 ;; Replaced text properties with overlays. Fixed ediff-setup-windows.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
682 ;; Added ediff-save-buffer to local-write-file-hooks to prevent user
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
683 ;; from saving corrupted states. (Thanks to <boris@cs.rochester.edu>
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
684 ;; for suggestion.) Instead, Ediff now has a pair of functions for
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
685 ;; safe saving of buffers.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
686 ;; Changed ediff-read-file-name to be more intuitive on ediff-files.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
687 ;; Added ediff-prepare-buffer-hooks. (Thanks to Kevin Esler
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
688 ;; <esler@ch.hp.com> for the idea.)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
689
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
690 ;; Wed Feb 9, 1994
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
691
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
692 ;; Cleanups in ediff-patch-file. Protected ediff-copy-diff against
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
693 ;; a bug that Emacs has in kill-region.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
694
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
695 ;; Thu Feb 10, 1994
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
696
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
697 ;; Added support for Lemacs. (Thanks to Alastair Burt
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
698 ;; <burt@dfki.uni-kl.de> for coercing Ediff into working under Lemacs.)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
699 ;; Added ediff-kill-buffer-carefully and other suggestions by Boris
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
700 ;; Goldowsky <boris@cs.rochester.edu>.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
701 ;; Refined the protection against interference with highlighting caused
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
702 ;; by Hilit19. Added the variable ediff-third-party-highlighting.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
703 ;; Added mechanisn for unhighlighting regions highlighted with Hilit19
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
704 ;; before hightlighting them with Ediff's overlays. (And for
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
705 ;; rehighlighting them with Hilit19, when the current difference moves on.)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
706
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
707 ;; Sun Feb 13, 1994
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
708
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
709 ;; Added ediff-place-flags-in-buffer and ediff-remote-exit, which are
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
710 ;; modifications of Emerge's similar functions. The difference is that
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
711 ;; in Ediff they make ediff-before-flag and ediff-after-flag into
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
712 ;; read-only regions, so the user can't change them by mistake.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
713 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
714 ;; Adopted a suggestion by Boris Goldowsky <boris@cs.rochester.edu>
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
715 ;; that led to a more elegant treatment of faces.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
716 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
717 ;; Added protection against interference with Font-Lock highlighting
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
718 ;; similar to that of Hilit19's protection.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
719
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
720 ;; Tue Feb 15, 1994
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
721
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
722 ;; Deleted spurious (auto-save-mode 1) in ediff-control-buffer, which
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
723 ;; was causing this buffer to be auto-saved for no good reason.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
724 ;; Added read-only protection to ediff-before/after-flags in Lemacs.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
725 ;; (Thanks to Alastair Burt <burt@dfki.uni-kl.de> for help in testing.)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
726
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
727 ;; Wed Feb 16, 1994
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
728
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
729 ;; Further fixes in the Lemacs part. Changed highlighted region in
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
730 ;; ediff-highlight-diff so that an extra character will be highlighted
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
731 ;; only if a difference is empty (thereby allowing the user to see where an
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
732 ;; insertion or a deletion has taken place).
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
733 ;;
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
734 ;; Simplified interaction with other highlighting packages by giving
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
735 ;; Ediff overlays the highest priority. (Taking a cue from
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
736 ;; ediff-highlight-diff-lemacs written by Alastair Burt
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
737 ;; <burt@dfki.uni-kl.de>.) Zapped ediff-third-party-highlighting
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
738 ;; variable and hooks that were previously used to
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
739 ;; unhighlight/rehighlight buffers when hilit19/font-lock are on.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
740
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
741 ;; Fri Feb 18, 1994
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
742
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
743 ;; Added a bit more sophistication to ediff-read-file-name. Now,
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
744 ;; ediff-files remembers both, the file-A and the file-B directories.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
745 ;; They are offered as defaults when ediff-use-last-dir is set to t.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
746
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
747 ;; Fri Feb 22, 1994
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
748
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
749 ;; Added ediff-before-change-guard to remove ASCII highlighting when
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
750 ;; the user attempts to change buffer-A/B. This is needed because
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
751 ;; otherwise the undo info may become screwed up in those buffers.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
752 ;; Hitting 'h' (ediff-toggle-hilit) on a dumb terminal will toggle
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
753 ;; between ASCII highlighting and no highlighting.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
754
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
755 ;; Fri Feb 24, 1994
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
756
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
757 ;; Fixed problems with multiple Ediff sessions running simultaneously.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
758
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
759 ;; Tue Mar 1, 1994
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
760
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
761 ;; Added vc-ediff, the Ediff interface to vc.el. (Thanks to Eric
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
762 ;; Freudenthal <freudent@jan.ultra.nyu.edu> for contributing this
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
763 ;; function.)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
764
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
765 ;; Sun Mar 6, 1994
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
766
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
767 ;; Added rcs-ediff, an Ediff interface to RCS via rcs.el. (Thanks to
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
768 ;; Alastair Burt <burt@dfki.uni-kl.de>.)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
769 ;; Some minor improvements.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
770
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
771 ;; Tue March 15, 1994
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
772
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
773 ;; Fixed a buglet in defining ediff-current-diff-face-A/B.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
774 ;; (Thanks to Job Ganzevoort <Job.Ganzevoort@cwi.nl>.)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
775
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
776 ;; Tue March 22, 1994
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
777
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
778 ;; Fixed a bug with ediffing narrowed buffers, reported by Kevin
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
779 ;; Broadey <KevinB@bartley.demon.co.uk>.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
780 ;; Made Ediff to work with files that have incomplete last line.
7391
c40d16ee57bf entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 7267
diff changeset
781 ;; Made Ediff execute diff and patch using Bourne Shell, which
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
782 ;; should eliminate problems with $prompt that some people had.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
783
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
784 ;; Thu March 24, 1994
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
785
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
786 ;; Achieved quadratic speedup in the size of the file by replacing the
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
787 ;; slow goto-line by forward-line. Ediff is now *much* faster than
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
788 ;; Emerge on large files. Converted demarkation of difference regions
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
789 ;; from markers to overlays. This will later allow us to highlight all
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
790 ;; diffs, not just the current one.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
791
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
792 ;; Wed March 30, 1994
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
793
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
794 ;; Under X, Ediff now highlights all differences in dim colors and the
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
795 ;; current difference in bright colors. Improved Lucid Emacs support.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
796
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
797 ;; Thu March 31, 1994
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
798
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
799 ;; Changed toggle hilit to cycle through 3 states: highlighting all
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
800 ;; diffs, highlighting only the current diff, and highlighting using
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
801 ;; ASCII flags.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
802 ;; Added support for difference regions that are not full lines.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
803
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
804 ;; Fri April 1, 1994
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
805
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
806 ;; Fixed bugs related to writing buffers A and B.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
807 ;; Added commands 'ga', 'gb' to jump directly to the closest diff in
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
808 ;; buffer A and B, respectively.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
809
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
810 ;; Fri April 11, 1994
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
811
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
812 ;; Added `ediff-recompute-diffs', a function that lets the user recompute
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
813 ;; difference regions after extensive editing done to buffers A and B
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
814 ;; (bound to `!').
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
815
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
816 ;; Wed April 13, 1994
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
817
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
818 ;; Added the new feature: refining the current difference region.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
819 ;; This would highlight the precise differences between the regions in
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
820 ;; buffer A and B. (A way to implement this was suggested by Boris
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
821 ;; Goldowsky <boris@cs.rochester.edu>.)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
822 ;;
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
823 ;; Fixed Ediff to be immune to several different versions of rcs.el
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
824 ;; that are currently in distribution.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
825
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
826 ;; Thu April 14, 1994
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
827
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
828 ;; Ediff now respects X resources for the faces it uses. It no longer
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
829 ;; barks when the colormap has no colors it is using; or when face
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
830 ;; fonts can't be italicized, etc.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
831
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
832 ;; Fri April 15, 1994
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
833
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
834 ;; Changed `ediff-setup-windows' to minimize the need to delete and
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
835 ;; create windows. Now jumps faster from diff to diff.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
836
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
837 ;; Sat April 16, 1994
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
838
8348
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
839 ;; Added Ediff to the File menu on the menu bar (FSF's version).
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
840
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
841 ;; Mon April 18, 1994
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
842
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
843 ;; Fixed to work with OS/2's PM-Emacs.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
844
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
845 ;; Thu April 21, 1994
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
846
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
847 ;; Lemacs' menus added (thanks to Alastair Burt for the help).
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
848
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
849 ;; Wed April 28, 1994
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
850
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
851 ;; Fixed ediff-leave-window-config (thanks to Norbert Kiesel
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
852 ;; <norbert@i3.informatik.rwth-aachen.de>), ediff-shell and
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
853 ;; ediff-protect-metachars (thanks to Richard Stanton
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
854 ;; <stanton@haas.berkeley.edu>). Made access to difference
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
855 ;; overlays structure-independent, making it less bug-prone.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
856 ;; Patched ediff-read-file-name to work more intuitively with directory
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
857 ;; names (thanks to Kevin Broadey <KevinB@bartley.demon.co.uk>).
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
858
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
859 ;; Mon May 2, 1994
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
860
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
861 ;; Added `ediff-frame-has-menubar' to guard against the possibility that
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
862 ;; the current frame has no menu bar.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
863
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
864 ;; Fri May 6, 1994
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
865
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
866 ;; Fixed buglet in vc-ediff (thanks to Ray Nickson <nickson@cs.uq.oz.au>).
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
867
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
868 ;; Wed May 18, 1994
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
869
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
870 ;; Modified ediff-read-file-name to not put long file names in the
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
871 ;; default prompt area, as suggested by KevinB@bartley.demon.co.uk.
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
872 ;; Applied patch supplied by burt@dfki.uni-kl.de, fixing a problem with
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
873 ;; ediff-diff-to-diff in Lemacs.
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
874
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
875 ;; Tue May 31, 1994
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
876
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
877 ;; Added ediff-forward-word-function (as suggested by Job Ganzevoort
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
878 ;; <Job.Ganzevoort@cwi.nl>). Modified ediff-default-quit-hook so it
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
879 ;; will clean things up in a more satisfactory way.
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
880
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
881 ;; Thu Jun 2, 1994
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
882
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
883 ;; Added `ediff-toggle-regexp-match', which allows the user to step
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
884 ;; through only those difference regions that match some regexp; or,
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
885 ;; vice versa, to skip over regions that match a regexp. (This feature
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
886 ;; was suggested by Andy Scott <ascott@pcocd2.intel.com>.)
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
887 ;; Added ediff-eval-in-buffer, which is a modified emerge-eval-in-buffer.
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
888 ;; The function ediff-status-info, bound to `i', now replaces and extends
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
889 ;; ediff-file-names and ediff-line-numbers, which were bound to `f'
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
890 ;; and `i', respectively.
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
891
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 ;; Wed Jun 8, 1994
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
893
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 ;; Made `ediff-frame-has-menubar' into a function; copied
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
895 ;; `emerge-defvar-local' and turned it into `ediff-defvar-local'
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
896 ;; This is supposed to make the same ediff.elc file work for both Emacs
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
897 ;; and Lucid Emacs, at least, if compiled under Lucid Emacs. (Thanks
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
898 ;; to Eric Eide <eeide@asylum.cs.utah.edu>.)
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
899
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
900 ;; Wed Jun 10, 1994
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
901
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
902 ;; Improved `ediff-read-file-name' and `ediff-buffers' so they are now
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
903 ;; providing more intuitive defaults. Modified `ediff-read-file-name'
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
904 ;; so it won't cause problems under OS/2.
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
905
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
906 ;; Fri Jun 24, 1994
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
907
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
908 ;; Modified ediff-find-file, ediff-files-internal, and made
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
909 ;; emerge-verify-file-buffer into ediff-verify-file-buffer so that
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
910 ;; Ediff will work correctly with remote and compressed
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
911 ;; files. (Suggested by Sandy Rutherford <sandy@ibm550.sissa.it>.)
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
912
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
913 ;; Fri Jun 28, 1994
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
914
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
915 ;; Fixed ediff-patch-files to work with remote and compressed files.
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
916
8348
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
917 ;; Wed July 20, 1994
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
918
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
919 ;; Changed menu bar items per RMS's suggestion. Changed odd/even faces
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
920 ;; in Lemacs to italic. Changed ediff-*-face-* variables so that they
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
921 ;; will contain names of faces instead of the face internal
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
922 ;; representation. (Copy-face works better with face names than with
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
923 ;; face internal representation. With face internal representation, if
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
924 ;; a face vector mentions a font explicitly, copy-face may attempt to
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
925 ;; copy this font, which would cause an error if the font has a wrong
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
926 ;; size for one of the existing frames.) Improved the way
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
927 ;; mode-line-buffer-identification is set in ediff-setup so that Ediff
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
928 ;; will accommodate the way buffers are identified in mode-line.el and
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
929 ;; uniquify.el.
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
930
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
931 ;; Fri August 5, 1994
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
932
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
933 ;; Ediff can now automatically skip over regions that differ only in
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
934 ;; the white space and line breaks. This is controled with the variable
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
935 ;; `ediff-ignore-similar-regions' and can be toggled on/off by typing
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
936 ;; `##'.
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
937
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
938 ;; Mon August 8, 1994
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
939
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
940 ;; If ediff-save-buffer is invoked with `wf', it'll save the diff
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
941 ;; output in a file.
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
942
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
943 ;; Wed August 24, 1994
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
944
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
945 ;; Fixed ediff-toggle-read-only and ediff-patch-file so that they will
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
946 ;; check out version-controled files before modifying them. This will
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
947 ;; permit checking the modified versions back in. In earlier
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
948 ;; versions, such modifications could be lost, unless the user takes
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
949 ;; special care of preserving them.
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
950
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
951 ;; Tue August 30, 1994
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
952
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
953 ;; Added ediff-submit-report.
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
954 ;; Introduced ediff-revision as a uniform way of calling vc.el and
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
955 ;; rcs.el. This is controled by ediff-version-control-package
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
956 ;; variable. Functions vc-ediff, rcs-ediff are replaced by their
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
957 ;; internal versions.
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
958 ;; Added ediff-find-file-name-handler function to smooth out the
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
959 ;; transition from Emacs 19.22/Lucid 19.9 to 19.23/19/10
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
960
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
961 ;; Thus September 1, 1994
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
962
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
963 ;; Made ediff-overlay-put and ediff-move-overlay into bona fide
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
964 ;; functions (rather than fset symbols). These now check if overlay's
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
965 ;; buffer is alive. If not, overlay is deleted. This overcomes some of
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
966 ;; the problems with Lemacs.
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
967
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
968
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
969 ;;; Acknowledgements:
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
970
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
971 ;; Special thanks to Alastair Burt <burt@dfki.uni-kl.de>, Kevin Esler
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
972 ;; <esler@ch.hp.com>, Kevin Broadey <KevinB@bartley.demon.co.uk>,
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
973 ;; Harald Boegeholz <hwb@machnix.mathematik.uni-stuttgart.de>,
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
974 ;; Robert Estes <estes@ece.ucdavis.edu>, Eric Eide <eeide@asylum.cs.utah.edu>,
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
975 ;; Eric Freudenthal <freudent@jan.ultra.nyu.edu>, Job Ganzevoort
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
976 ;; <Job.Ganzevoort@cwi.nl>, Boris Goldowsky <boris@cs.rochester.edu>,
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
977 ;; Allan Gottlieb <gottlieb@allan.ultra.nyu.edu>, Xiaoli Huang
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
978 ;; <hxl@epic.com>, irvine@lks.csi.com, jaffe@chipmunk.cita.utoronto.ca,
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
979 ;; David Karr, <dkarr@nmo.gtegsc.com>, Norbert Kiesel
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
980 ;; <norbert@i3.informatik.rwth-aachen.de>, Heinz Knutzen
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
981 ;; <hk@informatik.uni-kiel.d400.de>, Martin Maechler
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
982 ;; <maechler@stat.math.ethz.ch>, Richard Mlynarik <mly@adoc.xerox.com>,
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
983 ;; Eyvind Ness <Eyvind.Ness@hrp.no>, Ray Nickson <nickson@cs.uq.oz.au>,
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
984 ;; Sandy Rutherford <sandy@ibm550.sissa.it>, Andy Scott
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
985 ;; <ascott@pcocd2.intel.com>, Richard Stallman <rms@gnu.ai.mit.edu>,
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
986 ;; Richard Stanton, <stanton@haas.berkeley.edu>, Peter Stout
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
987 ;; <Peter_Stout@cs.cmu.edu> for contributing ideas, patches, and bug reports.
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
988 ;;
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
989 ;; Thanks also to many others who felt obliged to drop a thanks note.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
990
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
991
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
992
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
993 ;;; Code:
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
994
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
995 (require 'emerge) ;; Ediff uses some functions defined in emerge.el
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
996
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
997
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
998 ;;; Macros
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
999 (defmacro ediff-if-lucid ()
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1000 (` (string-match "Lucid" emacs-version)))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1001
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1002 (defmacro ediff-odd-p (arg)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1003 (` (eq (logand (, arg) 1) 1)))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1004
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1005 (defmacro ediff-buffer-live-p (buf)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1006 (` (and (, buf) (get-buffer (, buf)) (buffer-name (get-buffer (, buf))))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1007
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1008 (defmacro ediff-get-buffer (arg)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1009 (` (cond ((eq (, arg) 'A) ediff-A-buffer)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1010 ((eq (, arg) 'B) ediff-B-buffer)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1011 )
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1012 ))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1013
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1014 (defmacro ediff-char-to-buftype (arg)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1015 (` (cond ((eq (, arg) ?a) 'A)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1016 ((eq (, arg) ?b) 'B)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1017 )
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1018 ))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1019
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1020 (defmacro ediff-get-difference (n)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1021 (` (aref ediff-difference-vector (, n))))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1022
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1023 ;; tell if it has been previously found that the region doesn't
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1024 ;; contain diffs other than the white space and newlines
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1025 ;; The argument, N, is the diff region number used by Ediff to index the
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1026 ;; diff vector. It is 1 less than the number seen by the user.
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1027 (defmacro ediff-no-fine-diffs (n)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1028 (` (aref (ediff-get-difference n) 3)))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1029
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1030 (defmacro ediff-get-diff-overlay-from-vector (vec buf-type)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1031 (` (aref (, vec)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1032 (cond ((eq (, buf-type) 'A) 0)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1033 ((eq (, buf-type) 'B) 1)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1034 )
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1035 )))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1036
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1037 (defmacro ediff-get-diff-overlay (n buf-type)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1038 (` (ediff-get-diff-overlay-from-vector
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1039 (ediff-get-difference (, n))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1040 (, buf-type))))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1041
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1042 (defmacro ediff-get-fine-diff-vector-from-vec (current-diff-vec)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1043 (` (aref (, current-diff-vec) 2)))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1044
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1045 (defmacro ediff-set-fine-diff-vector (n fine-vec)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1046 (` (aset (ediff-get-difference (, n)) 2 (, fine-vec))))
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1047
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1048 ;; if flag is t, puts a mark on diff region saying that
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1049 ;; the differences are in white space only. If flag is nil,
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1050 ;; the region is marked as essential (i.e., differences are
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1051 ;; not just in the white space and newlines.)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1052 (defmacro ediff-mark-diff-as-space-only (n flag)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1053 (` (aset (ediff-get-difference (, n)) 3 (, flag))))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1054
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1055 (defmacro ediff-get-fine-diff-vector (n)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1056 (` (ediff-get-fine-diff-vector-from-vec (ediff-get-difference (, n)))))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1057
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1058
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
1059 (defmacro ediff-defvar-local (var value doc)
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
1060 "Defines SYMBOL as an advertised local variable.
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
1061 Performs a defvar, then executes `make-variable-buffer-local' on
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
1062 the variable. Also sets the `preserved' (Emacs) or `permanent-local' (Lucid)
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
1063 property, so that `kill-all-local-variables' (called by major-mode setting
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
1064 commands) won't destroy Ediff control variables.
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
1065
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
1066 This is a merge of `emerge-defvar-local' for Emacs and Lucid Emacs. It is
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
1067 needed to make the same ediff.elc work under both Emacsen."
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
1068 (` (progn
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
1069 (defvar (, var) (, value) (, doc))
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
1070 (make-variable-buffer-local '(, var))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1071 (put '(, var)
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1072 (if (ediff-if-lucid) 'permanent-local 'preserved)
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
1073 t))))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1074
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
1075 (defmacro ediff-eval-in-buffer (buffer &rest forms)
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
1076 "Macro to switch to BUFFER, evaluate FORMS, returns to original buffer.
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
1077 Differs from `save-excursion' in that it doesn't save the point and mark.
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
1078 This is essentially `emerge-eval-in-buffer' with the test for live buffers."
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
1079 (` (let ((StartBuffer (current-buffer)))
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
1080 (if (ediff-buffer-live-p (, buffer))
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
1081 (unwind-protect
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
1082 (progn
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
1083 (set-buffer (, buffer))
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
1084 (,@ forms))
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
1085 (set-buffer StartBuffer))
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
1086 (beep 1)
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
1087 (message "You seem to have killed an essential Ediff buffer---quit!"))
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
1088 )))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1089
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1090
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1091 ;;; Functions
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1092
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1093 (defun ediff-mode ()
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1094 "Ediff mode is used by the Ediff file-difference package.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1095 It is entered only through one of the following commands:
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1096 `ediff'
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1097 `ediff-files'
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1098 `ediff-buffers'
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1099 `epatch'
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1100 `ediff-patch-file'
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1101 `ediff-patch-buffer'
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1102 `epatch-buffer'
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1103 `ediff-revision'
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1104
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1105 Commands:
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1106 \\{ediff-mode-map}"
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1107 (interactive)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1108 (kill-all-local-variables)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1109 (setq major-mode 'ediff-mode)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1110 (setq mode-name "Ediff"))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1111
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1112 (defun ediff-version ()
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1113 "Return string describing the version of Ediff.
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1114 When called interactively, displays the version."
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1115 (interactive)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1116 (if (interactive-p)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1117 (message (ediff-version))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1118 (format "Ediff %s of %s" ediff-version ediff-date)))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1119
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1120
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1121 ;; Hook variables
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1122
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1123 (defvar ediff-before-setup-windows-hooks nil
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1124 "*Hooks to run before Ediff sets its own window config.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1125 This can be used to save the previous window config, which can be restored
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1126 on ediff-quit or ediff-suspend.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1127 (defvar ediff-startup-hooks nil
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1128 "*Hooks to run in the control buffer after Ediff has been set up.")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1129 (defvar ediff-select-hooks nil
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1130 "*Hooks to run after a difference has been selected.")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1131 (defvar ediff-unselect-hooks nil
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1132 "*Hooks to run after a difference has been unselected.")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1133 (defvar ediff-prepare-buffer-hooks nil
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1134 "*Hooks called after buffers A and B are set up.")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1135 (defvar ediff-load-hooks nil
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1136 "*Hook run after Ediff is loaded. Can be used to change defaults.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1137
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1138 (defvar ediff-suspend-hooks (list 'ediff-default-suspend-hook)
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1139 "*Hooks to run in the Ediff control buffer when Ediff is suspended.")
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1140 (defvar ediff-quit-hooks (list 'ediff-default-quit-hook)
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1141 "*Hooks to run in the Ediff control buffer after finishing Ediff.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1142
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1143 (make-variable-buffer-local 'local-write-file-hooks)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1144 (make-variable-buffer-local 'before-change-function)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1145
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1146 ;; Help messages
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1147
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1148 (defconst ediff-help-message-long
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1149 " Moving around | Toggling features | Miscellaneous
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1150 =======================|===========================|===========================
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1151 p,DEL -previous diff | s -vert/horiz split | ab/ba -copy diff A->B/B->A
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1152 n,SPC -next diff | h -hiliting | ra/rb -restore diff in A/B
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1153 j -jump to diff | @ -auto-refining | * -refine diff
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1154 ga/gb -to point in A/B |---------------------------| ! -recompute diffs
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1155 c -recenter | ## -skip whitespace |---------------------------
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1156 v/V -scroll up/down | #f/#h -focus/hide regions | wa/wb -save buf A/B
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1157 </> -scroll lft/rght | A/B -read-only buf A/B | wf -save diff output
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1158 =======================|===========================|===========================
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1159 | bug -submit bug report |
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1160 i -status info | ? -toggle help window | z/q -suspend/quit Ediff"
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1161 )
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1162
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1163 (defconst ediff-help-message-short
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1164 " ? - toggle help window")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1165
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1166 (defvar ediff-help-message ediff-help-message-long
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1167 "*The actual help message.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1168
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1169 ;; diff stuff.
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1170 (defvar ediff-diff-program "diff"
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1171 "*Name of the program that compares two files.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1172 (defvar ediff-diff-options ""
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
1173 "*Options to pass to `ediff-diff-program'.
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
1174 If diff\(1\) is used as `ediff-diff-program', then the most useful options are
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
1175 `-w', to ignore space, and `-i', to ignore case of letters.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1176
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
1177 ;; Fine differences
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
1178 (defvar ediff-forward-word-function 'ediff-forward-word
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
1179 "*Function to call to move to the next word.
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
1180 Used for splitting difference regions into individual words.")
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1181
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1182 (defvar ediff-fine-diff-program "diff"
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1183 "*Name of the program that compares the current diff regions for fine differences.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1184
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1185 This program should produce output in the format of diff. One could
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1186 possibly use `spiff' here if appropriate options are set.")
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1187
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1188 (defvar ediff-fine-diff-options ""
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
1189 "*Options to pass to `ediff-fine-diff-program'.
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
1190 If diff\(1\) is used as `ediff-diff-program', then the most useful options are
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
1191 `-w', to ignore space, and `-i', to ignore case of letters.")
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1192
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
1193 (defvar ediff-whitespace " \n\t\C-j"
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1194 "*White space. Used to split strings into words.")
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1195
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1196 (defvar ediff-word-1 "a-zA-Z---_`'.?!:"
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1197 "*Characters matching this regexp constitute words of type 1.
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1198
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1199 Ediff is using a very simple schema for splitting text into words, which is
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1200 used to determine fine differences between regions. There are two types of
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1201 words. One consists entirely out of characters in `ediff-word-1' and
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1202 another out of characters matching `ediff-word-1'.")
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1203
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
1204 (defvar ediff-word-2 "^a-zA-Z---_`'.?!: \t\n\C-j"
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1205 "*Characters matching this regexp constitute words of type 2.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1206 See `ediff-word-1' for more details.")
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
1207
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
1208 ;; Selective browsing
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
1209
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1210 (ediff-defvar-local ediff-skip-diff-region-function 'ediff-show-all-diffs
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1211 "Function that determines the next/previous diff region to show.
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1212 Should return t for regions to be ignored and nil otherwise.
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1213 This function gets a region number as an argument. The region number
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1214 is the one used internally by Ediff. It is 1 less than the number seen
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1215 by the user.")
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1216
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1217 (ediff-defvar-local ediff-regexp-focus-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
1218 "Regexp that determines buf A regions to focus on when skipping to diff.")
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1219 (ediff-defvar-local ediff-regexp-focus-B ""
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1220 "Regexp that determines buf B regions to focus on when skipping to diff.")
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
1221
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1222 (ediff-defvar-local ediff-regexp-hide-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
1223 "Regexp that determines buf A regions to ignore when skipping to diff.")
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1224 (ediff-defvar-local ediff-regexp-hide-B ""
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1225 "Regexp that determines buf B regions to ignore when skipping to diff.")
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1226
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1227
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1228 ;; Support for patches
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1229
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1230 (defvar ediff-patch-program "patch"
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1231 "*Name of the program that applies patches.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1232 (defvar ediff-patch-options ""
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1233 "*Options to pass to ediff-patch-program.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1234
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1235 (defvar ediff-shell (cond ((eq system-type 'emx) "cmd") ;; OS/2
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1236 (t "sh")) ;; unix
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1237 "*The shell used to run diff and patch. If user's .profile or
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1238 .cshrc files are set up correctly, any shell will do. However, some people
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1239 set $prompt or other things incorrectly, which leads to undesirable output
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1240 messages. These may cause Ediff to fail. In such a case, set ediff-shell
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1241 to a shell that you are not using or, better, fix your shell's startup file.")
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1242
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1243 (defvar ediff-diff-ok-lines-regexp
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1244 "^\\([0-9,]+[acd][0-9,]+$\\|[<>] \\|---\\|Warning:\\)"
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1245 "Regexp that matches normal output lines from `ediff-diff-program'.
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1246 This is mostly lifted from Emerge, except that Ediff also considers the
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1247 'Missing newline' message to be 'normal output.'
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1248 Lines that do not match are assumed to be error messages.")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1249
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1250 (defvar ediff-fine-diff-ok-lines-regexp
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1251 "^\\([0-9,]+[acd][0-9,]+$\\|[<>] \\|---\\|Warning:\\)"
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1252 "Regexp that matches normal output lines from `ediff-fine-diff-program'.
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1253 This is mostly lifted from Emerge, except that Ediff also considers the
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1254 'Missing newline' message to be 'normal output.'
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1255 Lines that do not match are assumed to be error messages.")
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1256
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1257 (defvar ediff-match-diff-line (let ((x "\\([0-9]+\\)\\(\\|,\\([0-9]+\\)\\)"))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1258 (concat "^" x "\\([acd]\\)" x "$"))
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1259 "Pattern to match lines produced by diff that describe differences.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1260
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1261 (defvar ediff-patch-buf nil
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1262 "The buffer of the patch file.")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1263 (defvar ediff-patch-diagnostics nil
7391
c40d16ee57bf entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 7267
diff changeset
1264 "The buffer where patch would display its diagnostics.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1265
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1266
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1267
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1268 ;; Copying difference regions between buffers.
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
1269 (ediff-defvar-local ediff-killed-diffs-alist nil
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1270 "A list of killed diffs.
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1271 A diff is saved here if it is replaced by a diff
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1272 from another buffer. This alist has the form:
7639
67b7d1ea7b2e Doc fix.
Richard M. Stallman <rms@gnu.org>
parents: 7496
diff changeset
1273 \((num (A . diff) (B . diff)) ...),
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1274 where A or B parts may be missing.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1275
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1276
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1277 ;; Highlighting
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1278 (defvar ediff-before-flag-bol
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1279 ;"vvvvvvvvvvvvvvvv---- ediff ----vvvvvvvvvvvvvvv\n"
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1280 ">>--->>>\n"
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1281 "*Flag placed above the highlighted block of differences.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1282 Must end with newline. Must be set before Ediff is loaded.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1283 (defvar ediff-after-flag-bol
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1284 ;"^^^^^^^^^^^^^^^^---- ediff ----^^^^^^^^^^^^^^^\n"
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1285 "<<<---<<\n"
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1286 "*Flag placed below the highlighted block of differences.
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1287 Must end with newline. Must be set before Ediff is loaded.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1288
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1289 (defvar ediff-before-flag-mol ">>--->>>"
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1290 "*Like ediff-before-flag, used when a difference starts in mid-line.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1291 (defvar ediff-after-flag-mol "<<<---<<"
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1292 "*Like ediff-after-flag, used when a difference starts in mid-line.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1293
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
1294 (ediff-defvar-local ediff-before-flag-A nil
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1295 "This is the actual ASCII before-flag in effect in buffer A.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1296 It is either `ediff-before-flag-mol' or `ediff-before-flag-bol' depending
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1297 on whether the selected difference region starts in the middle of a line
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1298 or at the beginning of a line.")
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
1299 (ediff-defvar-local ediff-after-flag-A nil
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1300 "This is the actual ASCII after-flag in effect in buffer A.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1301 It is either `ediff-before-flag-mol' or `ediff-before-flag-bol' depending
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1302 on whether the selected difference region starts in the middle of a line
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1303 or at the beginning of a line.")
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
1304 (ediff-defvar-local ediff-before-flag-B nil
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1305 "This is the actual ASCII before-flag in effect in buffer B.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1306 It is either `ediff-before-flag-mol' or `ediff-before-flag-bol' depending
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1307 on whether the selected difference region starts in the middle of a line
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1308 or at the beginning of a line.")
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
1309 (ediff-defvar-local ediff-after-flag-B nil
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1310 "This is the actual ASCII after-flag in effect in buffer B.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1311 It is either `ediff-before-flag-mol' or `ediff-before-flag-bol' depending
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1312 on whether the selected difference region starts in the middle of a line
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1313 or at the beginning of a line.")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1314
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1315
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
1316 (ediff-defvar-local ediff-want-faces t
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1317 "If t, differences are highlighted using faces on a window system.
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1318 If nil, they are highlighted using ASCII flags, ediff-before-flag
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1319 and ediff-after-flag. On a non-window system, differences are always
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1320 highlighted using ASCII flags.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1321
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1322 This variable can be set either in .emacs or toggled interactively, using
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1323 ediff-toggle-hilit.")
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1324
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
1325 (ediff-defvar-local ediff-want-default-menus t
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1326 "If t, Ediff will set up menus in the menu bar.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1327 This variable must be set before Ediff is loaded. If you don't like the
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1328 look of the default menus, set this variable to nil and make your own
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1329 menus.")
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1330
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1331 (ediff-defvar-local ediff-auto-refine (if window-system 'on 'nix)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1332 "If `'on', Ediff auto-highlights fine diffs for the current diff region.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1333 If `off', auto-highlighting is not used. If `'nix', no fine diffs are shown
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1334 at all, unless the user force-refines the region by hitting `*'.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1335
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1336 This variable can be set either in .emacs or toggled interactively, using
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1337 ediff-toggle-hilit.")
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1338
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1339 (ediff-defvar-local ediff-ignore-similar-regions nil
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1340 "*If t, skip over difference regions that differ only in the white space and line breaks.")
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1341
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
1342 (ediff-defvar-local ediff-auto-refine-limit 700
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1343 "Auto-refine only those regions that are smaller than this number of bytes.")
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1344
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
1345 (ediff-defvar-local ediff-highlight-all-diffs t
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1346 "If nil, only the selected differences are highlighted.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1347 This variable can be set either in .emacs or toggled interactively, using
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1348 ediff-toggle-hilit.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1349
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
1350 (ediff-defvar-local ediff-highlighting-style nil
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1351 "A var local to each control panel buffer.
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1352 Indicates highlighting style in effect for this buffer: `face', `ascii',
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1353 nil -- temporarily unhighlighted, `off' -- turned off \(on a dumb
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1354 terminal only\).")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1355
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1356
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1357
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1358 ;; Variables that control each Ediff session. They are local to the
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1359 ;; control buffer.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1360
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1361 ;; Mode variables
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
1362 (ediff-defvar-local ediff-A-buffer nil
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1363 "The buffer in which the A variant is stored.")
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
1364 (ediff-defvar-local ediff-B-buffer nil
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1365 "The buffer in which the B variant is stored.")
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
1366 (ediff-defvar-local ediff-control-buffer nil
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1367 "The control buffer of ediff. ")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1368
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
1369 ;(ediff-defvar-local ediff-control-buffer-suffix nil
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1370 ; "The suffix of the control buffer name. ")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1371
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
1372 (ediff-defvar-local ediff-control-window nil
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1373 "The control window.")
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
1374 (ediff-defvar-local ediff-window-config-saved ""
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1375 "Ediff's window configuration.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1376 Used to minimize the need to rearrange windows.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1377
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1378
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
1379 (ediff-defvar-local ediff-A-buffer-values nil
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1380 "Keeps working values of ediff-saved-variables for ediff-A-buffer.")
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1381 (ediff-defvar-local ediff-B-buffer-values nil
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1382 "Keeps working values of ediff-saved-variables for ediff-B-buffer.")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1383
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
1384 (ediff-defvar-local ediff-A-buffer-values-setup nil
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1385 "Remembers ediff-saved-variables for ediff-A-buffer as they were at setup.")
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
1386 (ediff-defvar-local ediff-B-buffer-values-setup nil
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1387 "Remembers ediff-saved-variables for ediff-B-buffer as they were at setup.")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1388
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
1389 (ediff-defvar-local ediff-difference-vector nil
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1390 "Vector of differences between the variants.
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1391 Each difference is represented by a vector of two overlays. The first
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1392 overlays the difference section in the A buffer and the second overlays the
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1393 diff in the B buffer. If a difference section is empty, the corresponding
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1394 overlay's endpoints coincide. ")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1395
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
1396 (ediff-defvar-local ediff-current-difference -1
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1397 "The difference that is currently selected.")
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
1398 (ediff-defvar-local ediff-number-of-differences nil
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1399 "Number of differences found.")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1400
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
1401 (ediff-defvar-local ediff-diff-buffer nil
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1402 "Buffer containing the output of diff, which is used by Ediff to step
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1403 through files.")
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1404 (ediff-defvar-local ediff-fine-diff-buffer nil
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1405 "Buffer used for diff-style fine differences between regions.")
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
1406 (ediff-defvar-local ediff-tmp-buffer nil
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1407 "Temporary buffer used for computing fine differences.")
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
1408 (ediff-defvar-local ediff-error-buffer nil
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1409 "Buffer containing the output of diff when diff returns errors.")
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1410
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
1411 (ediff-defvar-local ediff-this-buffer-control-sessions nil
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1412 "List of ediff control panels associated with each buffer A/B.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1413
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1414 (defvar ediff-disturbed-overlays nil
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1415 "List of difference overlays disturbed by working with the current diff.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1416
8348
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1417 (defvar ediff-shaded-overlay-priority 100
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1418 "Priority of non-selected overlays.")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1419
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1420
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1421 (if (ediff-if-lucid)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1422 (progn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1423 (fset 'ediff-overlayp (symbol-function 'extentp))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1424 (fset 'ediff-make-overlay (symbol-function 'make-extent))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1425 (fset 'ediff-delete-overlay (symbol-function 'delete-extent))
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1426 ;;(fset 'ediff-overlay-put (symbol-function 'set-extent-property))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1427 ;;(fset 'ediff-move-overlay (symbol-function 'set-extent-endpoints))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1428 (fset 'ediff-overlay-buffer (symbol-function 'extent-buffer))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1429 (fset 'ediff-overlay-start (symbol-function 'extent-start-position))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1430 (fset 'ediff-overlay-end (symbol-function 'extent-end-position))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1431 (fset 'ediff-overlay-get (symbol-function 'extent-property)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1432 (fset 'ediff-overlayp (symbol-function 'overlayp))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1433 (fset 'ediff-make-overlay (symbol-function 'make-overlay))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1434 (fset 'ediff-delete-overlay (symbol-function 'delete-overlay))
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1435 ;;(fset 'ediff-overlay-put (symbol-function 'overlay-put))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1436 ;;(fset 'ediff-move-overlay (symbol-function 'move-overlay))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1437 (fset 'ediff-overlay-buffer (symbol-function 'overlay-buffer))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1438 (fset 'ediff-overlay-start (symbol-function 'overlay-start))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1439 (fset 'ediff-overlay-end (symbol-function 'overlay-end))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1440 (fset 'ediff-overlay-get (symbol-function 'overlay-get)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1441
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1442 (if window-system
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1443 (if (ediff-if-lucid)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1444 (progn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1445 (fset 'ediff-select-frame (symbol-function 'select-screen))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1446 (fset 'ediff-window-frame (symbol-function 'window-screen))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1447 (fset 'ediff-display-color-p (symbol-function 'x-color-display-p))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1448 (fset 'ediff-valid-color-p (symbol-function 'x-valid-color-name-p))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1449 (fset 'ediff-get-face (symbol-function 'get-face)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1450 (fset 'ediff-window-frame (symbol-function 'window-frame))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1451 (fset 'ediff-select-frame (symbol-function 'select-frame))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1452 (fset 'ediff-display-color-p (symbol-function 'x-display-color-p))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1453
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1454 ;; This is a temporary fix for OS/2 users
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1455 ;; pm-win.el in PM-Emacs should be fixed.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1456 (if (eq window-system 'pm)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1457 (fset 'ediff-valid-color-p
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1458 (function (lambda (color) (assoc color pm-color-alist))))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1459 (fset 'ediff-valid-color-p (symbol-function 'x-color-defined-p))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1460 )
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1461
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1462 (fset 'ediff-get-face (symbol-function 'internal-get-face)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1463 ;; not a window system
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1464 (fset 'ediff-window-frame (function (lambda (wind) (if wind 1 nil)) ))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1465 (fset 'ediff-select-frame (symbol-function 'identity))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1466 (fset 'ediff-make-current-diff-overlay (function (lambda (type) nil)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1467 (fset 'ediff-unhighlight-diffs-totally (function (lambda () nil))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1468
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1469
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1470 (if (not window-system)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1471 ()
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1472 (defun ediff-set-face (ground face color)
8348
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1473 "Sets face foreground/background."
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1474 (if (ediff-valid-color-p color)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1475 (if (eq ground 'foreground)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1476 (set-face-foreground face color)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1477 (set-face-background face color))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1478 (cond ((memq face
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1479 '(ediff-current-diff-face-A ediff-current-diff-face-B))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1480 (copy-face 'highlight face))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1481 ((memq face
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1482 '(ediff-fine-diff-face-A ediff-fine-diff-face-B))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1483 (copy-face 'secondary-selection face)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1484 (set-face-underline-p face t))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1485 ((memq face
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1486 '(ediff-odd-diff-face-A ediff-odd-diff-face-B
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1487 ediff-even-diff-face-A ediff-even-diff-face-B))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1488 (copy-face 'secondary-selection face)))))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1489
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1490 (defvar ediff-current-diff-face-A
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1491 (progn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1492 (make-face 'ediff-current-diff-face-A)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1493 (or (face-differs-from-default-p 'ediff-current-diff-face-A)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1494 (cond ((ediff-display-color-p)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1495 (ediff-set-face
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1496 'foreground 'ediff-current-diff-face-A "firebrick")
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1497 (ediff-set-face
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1498 'background 'ediff-current-diff-face-A "pale green"))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1499 (t
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1500 (if (ediff-if-lucid)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1501 (copy-face 'modeline 'ediff-current-diff-face-A)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1502 (copy-face 'highlight 'ediff-current-diff-face-A))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1503 )))
8348
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1504 'ediff-current-diff-face-A)
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1505 ;;(ediff-get-face 'ediff-current-diff-face-A))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1506 "Face for highlighting the selected difference in buffer A.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1507
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1508 (defvar ediff-current-diff-face-B
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1509 (progn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1510 (make-face 'ediff-current-diff-face-B)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1511 (or (face-differs-from-default-p 'ediff-current-diff-face-B)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1512 (cond ((ediff-display-color-p)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1513 (ediff-set-face
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1514 'foreground 'ediff-current-diff-face-B "DarkOrchid")
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1515 (ediff-set-face
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1516 'background 'ediff-current-diff-face-B "Yellow"))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1517 (t
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1518 (if (ediff-if-lucid)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1519 (copy-face 'modeline 'ediff-current-diff-face-B)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1520 (copy-face 'highlight 'ediff-current-diff-face-B))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1521 )))
8348
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1522 'ediff-current-diff-face-B)
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1523 ;;(ediff-get-face 'ediff-current-diff-face-B))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1524 "Face for highlighting the selected difference in buffer B.")
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1525
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1526 (defvar ediff-fine-diff-face-A
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1527 (progn
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1528 (make-face 'ediff-fine-diff-face-A)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1529 (or (face-differs-from-default-p 'ediff-fine-diff-face-A)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1530 (cond ((ediff-display-color-p)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1531 (ediff-set-face 'foreground 'ediff-fine-diff-face-A
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1532 "Navy")
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1533 (ediff-set-face 'background 'ediff-fine-diff-face-A
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1534 "sky blue"))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1535 (t (set-face-underline-p 'ediff-fine-diff-face-A t))))
8348
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1536 'ediff-fine-diff-face-A)
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1537 ;;(ediff-get-face 'ediff-fine-diff-face-A))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1538 "Face for highlighting the refinement of the selected diff in buffer A.")
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1539
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1540 (defvar ediff-fine-diff-face-B
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1541 (progn
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1542 (make-face 'ediff-fine-diff-face-B)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1543 (or (face-differs-from-default-p 'ediff-fine-diff-face-B)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1544 (cond ((ediff-display-color-p)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1545 (ediff-set-face 'foreground 'ediff-fine-diff-face-B "Black")
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1546 (ediff-set-face 'background 'ediff-fine-diff-face-B "cyan"))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1547 (t (set-face-underline-p 'ediff-fine-diff-face-B t))))
8348
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1548 'ediff-fine-diff-face-B)
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1549 ;;(ediff-get-face 'ediff-fine-diff-face-B))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1550 "Face for highlighting the refinement of the selected diff in buffer B.")
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1551
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1552
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1553 (defvar ediff-even-diff-face-A
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1554 (progn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1555 (make-face 'ediff-even-diff-face-A)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1556 (or (face-differs-from-default-p 'ediff-even-diff-face-A)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1557 (cond ((ediff-display-color-p)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1558 (ediff-set-face
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1559 'foreground 'ediff-even-diff-face-A "black")
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1560 (ediff-set-face
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1561 'background 'ediff-even-diff-face-A "light grey"))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1562 (t
8348
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1563 (copy-face 'italic 'ediff-even-diff-face-A))))
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1564 'ediff-even-diff-face-A)
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1565 ;;(ediff-get-face 'ediff-even-diff-face-A))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1566 "Face used to highlight even-numbered differences in buffer A.")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1567
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1568 (defvar ediff-even-diff-face-B
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1569 (progn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1570 (make-face 'ediff-even-diff-face-B)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1571 (or (face-differs-from-default-p 'ediff-even-diff-face-B)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1572 (cond ((ediff-display-color-p)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1573 (ediff-set-face
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1574 'foreground 'ediff-even-diff-face-B "White")
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1575 (ediff-set-face
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1576 'background 'ediff-even-diff-face-B "Gray"))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1577 (t
8348
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1578 (copy-face 'italic 'ediff-even-diff-face-B))))
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1579 'ediff-even-diff-face-B)
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1580 ;;(ediff-get-face 'ediff-even-diff-face-B))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1581 "Face used to highlight even-numbered differences in buffer B.")
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1582
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1583 (defvar ediff-odd-diff-face-A
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1584 (progn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1585 (make-face 'ediff-odd-diff-face-A)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1586 (or (face-differs-from-default-p 'ediff-odd-diff-face-A)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1587 (cond ((ediff-display-color-p)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1588 (ediff-set-face
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1589 'foreground 'ediff-odd-diff-face-A "White")
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1590 (ediff-set-face
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1591 'background 'ediff-odd-diff-face-A "Gray"))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1592 (t
8348
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1593 (copy-face 'italic 'ediff-odd-diff-face-A))))
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1594 'ediff-odd-diff-face-A)
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1595 ;;(ediff-get-face 'ediff-odd-diff-face-A))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1596 "Face used to highlight odd-numbered differences in buffer A.")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1597
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1598 (defvar ediff-odd-diff-face-B
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1599 (progn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1600 (make-face 'ediff-odd-diff-face-B)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1601 (or (face-differs-from-default-p 'ediff-odd-diff-face-B)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1602 (cond ((ediff-display-color-p)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1603 (ediff-set-face
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1604 'foreground 'ediff-odd-diff-face-B "Black")
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1605 (ediff-set-face
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1606 'background 'ediff-odd-diff-face-B "light grey"))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1607 (t
8348
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1608 (copy-face 'italic 'ediff-odd-diff-face-B))))
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1609 'ediff-odd-diff-face-B)
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1610 ;;(ediff-get-face 'ediff-odd-diff-face-B))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1611 "Face used to highlight odd-numbered differences in buffer B.")
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1612
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1613 ;; Create *-var faces. These are the actual faces used to highlight
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1614 ;; odd-numbered difference regions.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1615 ;; They are used as follows: when highlighting is turned on,
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1616 ;; ediff-odd/even-diff-face-A/B are copied
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1617 ;; into ediff-odd/even-diff-face-A/B-var, and all odd/even overlays become
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1618 ;; highlighted. When highlighting is turned off, then the face 'default is
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1619 ;; copied into ediff-odd/even-diff-face-A/B-var, thereby unhighlighting all
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1620 ;; difference regions.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1621 (make-face 'ediff-even-diff-face-A-var)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1622 (make-face 'ediff-even-diff-face-B-var)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1623 (make-face 'ediff-odd-diff-face-A-var)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1624 (make-face 'ediff-odd-diff-face-B-var)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1625
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1626 ;; initialize *-var faces
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1627 (defun ediff-init-var-faces ()
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1628 (copy-face (if (and ediff-want-faces ediff-highlight-all-diffs)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1629 ediff-even-diff-face-A 'default)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1630 'ediff-even-diff-face-A-var)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1631 (copy-face (if (and ediff-want-faces ediff-highlight-all-diffs)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1632 ediff-even-diff-face-B 'default)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1633 'ediff-even-diff-face-B-var)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1634 (copy-face (if (and ediff-want-faces ediff-highlight-all-diffs)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1635 ediff-odd-diff-face-A 'default)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1636 'ediff-odd-diff-face-A-var)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1637 (copy-face (if (and ediff-want-faces ediff-highlight-all-diffs)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1638 ediff-odd-diff-face-B 'default)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1639 'ediff-odd-diff-face-B-var))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1640
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1641
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1642 ;;; Overlays
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1643
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
1644 (ediff-defvar-local ediff-current-diff-overlay-A nil
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1645 "Overlay specifying the current difference region in 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
1646 (ediff-defvar-local ediff-current-diff-overlay-B nil
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1647 "Overlay specifying the current difference region in buffer B.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1648
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1649 (defun ediff-make-current-diff-overlay (type)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1650 (let ((overlay (if (eq type 'A)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1651 'ediff-current-diff-overlay-A
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1652 'ediff-current-diff-overlay-B))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1653 (buffer (ediff-get-buffer type))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1654 (face (if (eq type 'A)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1655 (face-name ediff-current-diff-face-A)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1656 (face-name ediff-current-diff-face-B))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1657 (set overlay (ediff-make-overlay (point-max) (point-max) buffer))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1658 (ediff-overlay-put (eval overlay) 'face face)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1659 (ediff-overlay-put (eval overlay) 'ediff ediff-control-buffer)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1660 ))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1661
8348
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1662 ;; Compute priority of ediff overlay.
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1663 (defun ediff-highest-priority (start end buffer)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1664 (let ((pos (max 1 (1- start)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1665 ovr-list)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1666 (if (ediff-if-lucid)
8348
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1667 (1+ ediff-shaded-overlay-priority)
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
1668 (ediff-eval-in-buffer
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1669 buffer
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1670 (while (< pos (min (point-max) (1+ end)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1671 (setq ovr-list (append (overlays-at pos) ovr-list))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1672 (setq pos (next-overlay-change pos)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1673 (1+ (eval
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1674 (cons '+
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1675 (mapcar (function
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1676 (lambda (ovr)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1677 (if ovr
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1678 (or (ediff-overlay-get ovr 'priority) 0)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1679 0)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1680 ovr-list)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1681 )))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1682 ))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1683
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1684 ) ; end of window-system-only code.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1685
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1686
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1687 ;; Ediff toggle read-only stuff
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1688 (defvar ediff-toggle-read-only-function nil
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1689 "*Specifies the function to be used to toggle read-only.
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1690 If nil, Ediff tries to deduce the function from the binding of C-x C-q.
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1691 Normally, this is the `toggle-read-only' function, but, if version
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1692 control is used, it could be `vc-toggle-read-only' or `rcs-toggle-read-only'.")
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1693
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1694 (ediff-defvar-local ediff-local-checkout-flag nil
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1695 "If t, indicates that buffer has been already checked out.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1696
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1697
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1698
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1699 ;;; Misc
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1700
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1701 (defvar ediff-split-window-function 'split-window-vertically
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1702 "*The function to split the main window between buffer-A and buffer-B.
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1703 You can set it to be split horizontally instead of the
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1704 default vertical split by setting this variable to
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1705 'split-window-horizontally. You can also have your own function for fancy
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1706 splits. This variable has no effect when buffer-A and buffer-B are shown in
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1707 different frames. In this case, Ediff will use those frames to display
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1708 these buffers.")
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1709
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1710
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1711 (defconst ediff-saved-variables
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1712 '(;;buffer-read-only
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1713 buffer-auto-save-file-name)
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1714 "Buffer-local variables saved and restored during an Ediff session.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1715
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1716 ;;(defconst ediff-working-values '(nil nil)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1717 (defconst ediff-working-values '(nil)
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1718 "Values to be assigned to `ediff-saved-variables' during diff.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1719
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1720 (defvar ediff-use-last-dir nil
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1721 "*If t, Ediff uses previous directory as default when reading file name.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1722
7457
315fb6386b54 (ediff-no-help-in-control-buffer): Renamed from
Karl Heuer <kwzh@gnu.org>
parents: 7424
diff changeset
1723 (defvar ediff-no-help-in-control-buffer nil
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
1724 "*Non-nil means C-h should not invoke Emacs help in control buffer.
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
1725 Instead, C-h jumps to previous difference.")
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1726
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1727 (defvar ediff-version-control-package 'vc
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1728 "Version control package used.
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1729 Currently, Ediff supports vc.el and rcs.el.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1730
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1731 (defvar ediff-temp-file-prefix
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
1732 (let ((env (or (getenv "TMPDIR")
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
1733 (getenv "TMP")
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
1734 (getenv "TEMP")))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1735 d)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1736 (setq d (if (and env (> (length env) 0))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1737 env
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1738 "/tmp"))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1739 (if (= (aref d (1- (length d))) ?/)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1740 (setq d (substring d 0 -1)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1741 (concat d "/ediff"))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1742 "*Prefix to put on Ediff temporary file names.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1743 Do not start with `~/' or `~user-name/'.")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1744
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1745 (defvar ediff-temp-file-mode 384 ; u=rw only
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1746 "*Mode for Ediff temporary files.")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1747
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
1748 (ediff-defvar-local ediff-temp-file-A nil
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1749 "Temporary file used for refining difference regions in buffer B.")
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1750 (ediff-defvar-local ediff-temp-file-B nil
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1751 "Temporary file used for refining difference regions in buffer B.")
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1752
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1753 (defvar ediff-last-dir-A nil
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1754 "Last directory used by an Ediff command for file-A.")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1755 (defvar ediff-last-dir-B nil
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1756 "Last directory used by an Ediff command for file-B.")
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1757 (defvar ediff-last-dir-patch nil
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1758 "Last directory used by an Ediff command for file to patch.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1759
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1760 ;; Build keymaps
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1761
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1762 (defvar ediff-mode-map nil
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1763 "Local keymap used in Ediff mode.")
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1764
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
1765 (defun ediff-frame-has-menubar ()
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
1766 (if (ediff-if-lucid)
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
1767 current-menubar
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
1768 (< 0 (cdr (assq 'menu-bar-lines (frame-parameters (selected-frame)))))
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
1769 ))
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
1770
7495
266bf374a7bf Move menu bar defines to top level
Richard M. Stallman <rms@gnu.org>
parents: 7457
diff changeset
1771 ;;; This is split in three parts to avoid
266bf374a7bf Move menu bar defines to top level
Richard M. Stallman <rms@gnu.org>
parents: 7457
diff changeset
1772 ;;; making a line in loaddefs.el that is too long for patch.
266bf374a7bf Move menu bar defines to top level
Richard M. Stallman <rms@gnu.org>
parents: 7457
diff changeset
1773 ;;; Note that autoload.el currently looks for cookies
266bf374a7bf Move menu bar defines to top level
Richard M. Stallman <rms@gnu.org>
parents: 7457
diff changeset
1774 ;;; only at top level in the file.
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1775 ;;; So I moved these to top level. But the conditionals on
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
1776 ;;; purify-flag make these no-ops when you load ediff.
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
1777 ;;; They only do something in loaddefs.el.
7495
266bf374a7bf Move menu bar defines to top level
Richard M. Stallman <rms@gnu.org>
parents: 7457
diff changeset
1778 ;;;###autoload
8524
ad46c69956cd Undo change in condition for defining the menu bar items.
Richard M. Stallman <rms@gnu.org>
parents: 8503
diff changeset
1779 (if purify-flag
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1780 (progn
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1781 (defvar menu-bar-epatch-menu (make-sparse-keymap "Epatch"))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1782 (fset 'menu-bar-epatch-menu (symbol-value 'menu-bar-epatch-menu))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1783 (defvar menu-bar-ediff-menu (make-sparse-keymap "Ediff"))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1784 (fset 'menu-bar-ediff-menu (symbol-value 'menu-bar-ediff-menu))))
7495
266bf374a7bf Move menu bar defines to top level
Richard M. Stallman <rms@gnu.org>
parents: 7457
diff changeset
1785
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
1786
7495
266bf374a7bf Move menu bar defines to top level
Richard M. Stallman <rms@gnu.org>
parents: 7457
diff changeset
1787 ;;;###autoload
8524
ad46c69956cd Undo change in condition for defining the menu bar items.
Richard M. Stallman <rms@gnu.org>
parents: 8503
diff changeset
1788 (if purify-flag
8348
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1789 (progn
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1790 (define-key menu-bar-ediff-menu [ediff-revision]
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1791 '("File with a version ..." . ediff-revision))
8348
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1792 (define-key menu-bar-ediff-menu [ediff-buffers]
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1793 '("Buffers ..." . ediff-buffers))
8348
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1794 (define-key menu-bar-ediff-menu [ediff-files]
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1795 '("Files ..." . ediff-files))))
7495
266bf374a7bf Move menu bar defines to top level
Richard M. Stallman <rms@gnu.org>
parents: 7457
diff changeset
1796
266bf374a7bf Move menu bar defines to top level
Richard M. Stallman <rms@gnu.org>
parents: 7457
diff changeset
1797 ;;;###autoload
8524
ad46c69956cd Undo change in condition for defining the menu bar items.
Richard M. Stallman <rms@gnu.org>
parents: 8503
diff changeset
1798 (if purify-flag
8348
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1799 (progn
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1800 (define-key menu-bar-epatch-menu [ediff-patch-buffer]
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1801 '("To a Buffer ..." . ediff-patch-buffer))
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1802 (define-key menu-bar-epatch-menu [ediff-patch-file]
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1803 '("To a File ..." . ediff-patch-file))))
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1804
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1805
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1806 (if (and window-system ediff-want-default-menus (ediff-frame-has-menubar))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1807 (cond ((ediff-if-lucid)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1808 (defvar ediff-menu
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1809 '(""
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1810 ["Files ..." ediff-files t]
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1811 ["Buffers ..." ediff-buffers t]
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1812 ["File with a version ..." ediff-revision t]))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1813 (defvar epatch-menu
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1814 '(""
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1815 ["To a file ..." ediff-patch-file t]
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1816 ["To a buffer ..." ediff-patch-buffer t]))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1817 (add-menu '("File") "Compare"
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1818 ediff-menu
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1819 "New Screen")
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1820 (add-menu '("File") "Apply Patch"
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1821 epatch-menu
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1822 "New Screen")
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1823 ;; Display a solid horizontal line
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1824 (add-menu-item '("File") "---" nil nil "New Screen"))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1825 (t ;; FSF Emacs
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1826 (define-key menu-bar-file-menu [epatch]
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1827 '("Apply Patch" . menu-bar-epatch-menu))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1828 (define-key menu-bar-file-menu [ediff]
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1829 '("Compare" . menu-bar-ediff-menu)))))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1830
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1831
8348
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
1832
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1833 (defun ediff-setup-keymap ()
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1834 "Set up the keymap used in the control buffer of Ediff."
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1835 (setq ediff-mode-map (make-sparse-keymap))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1836 (suppress-keymap ediff-mode-map)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1837
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1838 (define-key ediff-mode-map "p" 'ediff-previous-difference)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1839 (define-key ediff-mode-map "\C-?" 'ediff-previous-difference)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1840 (define-key ediff-mode-map "\C-h" (if ediff-no-help-in-control-buffer
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1841 'ediff-previous-difference nil))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1842 (define-key ediff-mode-map "n" 'ediff-next-difference)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1843 (define-key ediff-mode-map " " 'ediff-next-difference)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1844 (define-key ediff-mode-map "j" 'ediff-jump-to-difference)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1845 (define-key ediff-mode-map "g" nil)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1846 (define-key ediff-mode-map "ga" 'ediff-jump-to-difference-at-point)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1847 (define-key ediff-mode-map "gb" 'ediff-jump-to-difference-at-point)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1848 (define-key ediff-mode-map "q" 'ediff-quit)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1849 (define-key ediff-mode-map "z" 'ediff-suspend)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1850 (define-key ediff-mode-map "c" 'ediff-recenter)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1851 (define-key ediff-mode-map "s" 'ediff-toggle-split)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1852 (define-key ediff-mode-map "h" 'ediff-toggle-hilit)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1853 (define-key ediff-mode-map "@" 'ediff-toggle-autorefine)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1854 (define-key ediff-mode-map "v" 'ediff-scroll-up)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1855 (define-key ediff-mode-map "\C-v" 'ediff-scroll-up)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1856 (define-key ediff-mode-map "^" 'ediff-scroll-down)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1857 (define-key ediff-mode-map "\M-v" 'ediff-scroll-down)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1858 (define-key ediff-mode-map "V" 'ediff-scroll-down)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1859 (define-key ediff-mode-map "<" 'ediff-scroll-left)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1860 (define-key ediff-mode-map ">" 'ediff-scroll-right)
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
1861 (define-key ediff-mode-map "i" 'ediff-status-info)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1862 (define-key ediff-mode-map "?" 'ediff-toggle-help)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1863 (define-key ediff-mode-map "!" 'ediff-recompute-diffs)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1864 (define-key ediff-mode-map "*" 'ediff-make-fine-diffs)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1865 (define-key ediff-mode-map "a" nil)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1866 (define-key ediff-mode-map "ab" 'ediff-diff-to-diff)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1867 (define-key ediff-mode-map "b" nil)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1868 (define-key ediff-mode-map "ba" 'ediff-diff-to-diff)
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1869 (define-key ediff-mode-map "bug" 'ediff-submit-report)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1870 (define-key ediff-mode-map "r" nil)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1871 (define-key ediff-mode-map "ra" 'ediff-restore-diff)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1872 (define-key ediff-mode-map "rb" 'ediff-restore-diff)
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
1873 (define-key ediff-mode-map "#" nil)
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1874 (define-key ediff-mode-map "#h" 'ediff-toggle-regexp-match)
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
1875 (define-key ediff-mode-map "#f" 'ediff-toggle-regexp-match)
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1876 (define-key ediff-mode-map "##" 'ediff-toggle-skip-similar)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1877 (define-key ediff-mode-map "o" nil)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1878 (define-key ediff-mode-map "A" 'ediff-toggle-read-only)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1879 (define-key ediff-mode-map "B" 'ediff-toggle-read-only)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1880 (define-key ediff-mode-map "w" nil)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1881 (define-key ediff-mode-map "wa" 'ediff-save-buffer)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1882 (define-key ediff-mode-map "wb" 'ediff-save-buffer)
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1883 (define-key ediff-mode-map "wf" 'ediff-save-buffer)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1884 (define-key ediff-mode-map "k" nil)
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1885 (define-key ediff-mode-map "kkk" 'ediff-reload-keymap) ;; for debugging
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1886 ;; Allow ediff-mode-map to be referenced indirectly
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1887 (fset 'ediff-mode-map ediff-mode-map))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1888
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1889
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1890 ;;; Setup functions
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1891
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
1892 (defun ediff-find-file (file-var buffer &optional last-dir hooks-var)
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1893 "Visit FILE and arrange its buffer to Ediff's liking.
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
1894 FILE is actually a variables symbol that must contain a true file name.
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1895 BUFFER is a variable symbol, which will get the buffer object into which
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
1896 FILE is read. LAST-DIR is the directory variable symbol where FILE's
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
1897 directory name should be returned. HOOKS is a variable symbol that will be
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
1898 assigned the hook to be executed after `ediff-strartup' is finished.
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
1899 `ediff-find-file' arranges that the temp files it might create will be
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
1900 deleted.
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
1901 Arguments: (file buffer &optional last-dir hooks)"
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1902 (let* ((file (eval file-var))
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1903 (file-magic (ediff-find-file-name-handler file)))
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1904 (if (not (file-readable-p file))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1905 (error "File `%s' does not exist or is not readable" file))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1906
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
1907 ;; Record the directory of the file
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1908 (if last-dir
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
1909 (set last-dir (expand-file-name (file-name-directory file))))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1910
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
1911 ;; Setup the buffer
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
1912 (set buffer (find-file-noselect file))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1913
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
1914 (ediff-eval-in-buffer
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
1915 (eval buffer)
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
1916 (widen) ;; Make sure the entire file is seen
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
1917 (cond (file-magic ;; file has handler, such as jka-compr-handler or
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
1918 ;; ange-ftp-hook-function--arrange for temp file
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1919 (ediff-verify-file-buffer 'magic)
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1920 (setq file (ediff-make-temp-file))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1921 (set hooks-var (cons (` (lambda () (delete-file (, file))))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1922 (eval hooks-var))))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1923 ;; file processed via auto-mode-alist, a la uncompress.el
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1924 ((not (equal (file-truename file)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
1925 (file-truename (buffer-file-name))))
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
1926 (setq file (ediff-make-temp-file))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1927 (set hooks-var (cons (` (lambda () (delete-file (, file))))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1928 (eval hooks-var))))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1929 (t ;; plain file---just check that the file matches the buffer
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
1930 (ediff-verify-file-buffer))))
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
1931 (set file-var file)))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1932
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1933 (defun ediff-files-internal (file-A file-B &optional startup-hooks)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1934 (let (buffer-A buffer-B)
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1935 (message "Reading file %s ... " file-A)(sit-for 0)
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1936 (ediff-find-file 'file-A 'buffer-A 'ediff-last-dir-A 'startup-hooks)
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1937 (message "Reading file %s ... " file-B)(sit-for 0)
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1938 (ediff-find-file 'file-B 'buffer-B 'ediff-last-dir-B 'startup-hooks)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1939 (ediff-setup buffer-A file-A buffer-B file-B startup-hooks)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1940
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1941 (defun ediff-get-patch-buffer (dir)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1942 "Obtain patch buffer. If patch is already in a buffer---use it.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1943 Else, read patch file into a new buffer."
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1944 (if (y-or-n-p "Is the patch file already in a buffer? ")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1945 (setq ediff-patch-buf
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1946 (get-buffer (read-buffer "Patch buffer name: " nil t))) ;must match
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1947 (setq ediff-patch-buf
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
1948 (find-file-noselect (read-file-name "Patch file name: " dir))))
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1949
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1950 ;; secure the patch buffer against accidental changes
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
1951 (ediff-eval-in-buffer
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1952 ediff-patch-buf
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1953 (setq buffer-read-only t))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1954
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1955 (setq ediff-patch-diagnostics
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1956 (get-buffer-create "*ediff patch diagnostics*"))
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1957 (ediff-eval-in-buffer
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1958 ediff-patch-diagnostics
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1959 (insert-buffer ediff-patch-buf))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1960 )
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1961
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1962 ;; Start up Ediff on two files
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1963 (defun ediff-setup (buffer-A file-A buffer-B file-B startup-hooks)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1964 (setq file-A (expand-file-name file-A))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1965 (setq file-B (expand-file-name file-B))
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1966 (let* ((control-buffer-name
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
1967 (emerge-unique-buffer-name "Ediff Control Panel" ""))
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
1968 (control-buffer (ediff-eval-in-buffer
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1969 buffer-A
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1970 (get-buffer-create control-buffer-name))))
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
1971 (ediff-eval-in-buffer
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1972 control-buffer
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1973 (ediff-mode) ;; in control buffer only
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
1974 (setq buffer-read-only nil) ;; in control buffer only
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1975 (setq ediff-A-buffer buffer-A)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1976 (setq ediff-B-buffer buffer-B)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1977 (setq ediff-control-buffer control-buffer)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1978 ; (setq ediff-control-buffer-suffix
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1979 ; (if (string-match "<[0-9]*>" control-buffer-name)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1980 ; (substring control-buffer-name
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1981 ; (match-beginning 0) (match-end 0))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1982 ; "<1>"))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1983 (setq ediff-error-buffer (get-buffer-create (emerge-unique-buffer-name
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1984 "*ediff-errors" "*")))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1985 (ediff-remember-buffer-characteristics t) ;; remember at setup
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1986
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1987 (ediff-set-keys)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
1988 (setq ediff-difference-vector (ediff-setup-diff-regions file-A file-B))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1989 (setq ediff-number-of-differences (length ediff-difference-vector))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1990 (setq ediff-current-difference -1)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1991 (ediff-make-current-diff-overlay 'A)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1992 (ediff-make-current-diff-overlay 'B)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1993 (if window-system
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1994 (ediff-init-var-faces))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1995 (run-hooks 'ediff-before-setup-windows-hooks)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1996 (ediff-setup-windows buffer-A buffer-B control-buffer t)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1997
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
1998 ;; all these must be inside ediff-eval-in-buffer control-buffer,
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
1999 ;; since these vars are local to control-buffer
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2000 ;; These won't run if there are errors in diff
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
2001 (ediff-eval-in-buffer
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2002 ediff-A-buffer
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2003 (add-hook 'local-write-file-hooks 'ediff-block-write-file)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2004 (setq before-change-function 'ediff-before-change-guard)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2005 ;; add control-buffer to the list of sessions
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2006 (or (memq control-buffer ediff-this-buffer-control-sessions)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2007 (setq ediff-this-buffer-control-sessions
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2008 (cons control-buffer ediff-this-buffer-control-sessions)))
8348
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
2009 (setq mode-line-buffer-identification
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
2010 (cons "A: "
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
2011 (if (string-match "\\(^ \\|^[^ \t]*: \\)"
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
2012 (car mode-line-buffer-identification))
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
2013 (cons (substring (car mode-line-buffer-identification)
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
2014 (match-end 0))
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
2015 (cdr mode-line-buffer-identification))
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
2016 mode-line-buffer-identification)))
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
2017 (run-hooks 'ediff-prepare-buffer-hooks))
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
2018 (ediff-eval-in-buffer
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2019 ediff-B-buffer
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2020 (add-hook 'local-write-file-hooks 'ediff-block-write-file)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2021 (setq before-change-function 'ediff-before-change-guard)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2022 ;; add control-buffer to the list of sessions
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2023 (or (memq control-buffer ediff-this-buffer-control-sessions)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2024 (setq ediff-this-buffer-control-sessions
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2025 (cons control-buffer ediff-this-buffer-control-sessions)))
8348
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
2026 (setq mode-line-buffer-identification
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
2027 (cons "B: "
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
2028 (if (string-match "\\(^ \\|^[^ \t]*: \\)"
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
2029 (car mode-line-buffer-identification))
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
2030 (cons (substring (car mode-line-buffer-identification)
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
2031 (match-end 0))
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
2032 (cdr mode-line-buffer-identification))
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
2033 mode-line-buffer-identification)))
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
2034 (run-hooks 'ediff-prepare-buffer-hooks))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2035
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
2036 (ediff-eval-in-buffer control-buffer
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2037 (run-hooks 'startup-hooks 'ediff-startup-hooks)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2038 (setq buffer-read-only t)))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2039
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2040 ;; Generate the difference vector and overlays for the two files
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2041 ;; With optional arg `refine', create refining difference regions
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2042 (defun ediff-setup-diff-regions (file-A file-B
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2043 &optional use-old refine-region
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2044 diff-program diff-options
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2045 diff-ok-lines-regexp)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2046
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2047 (setq diff-program (or diff-program ediff-diff-program)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2048 diff-options (or diff-options ediff-diff-options)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2049 diff-ok-lines-regexp
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2050 (or diff-ok-lines-regexp ediff-diff-ok-lines-regexp))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2051
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2052 (or use-old (setq ediff-diff-buffer
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2053 (get-buffer-create
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2054 (emerge-unique-buffer-name "*ediff-diff" "*"))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2055 ediff-fine-diff-buffer
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2056 (get-buffer-create
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2057 (emerge-unique-buffer-name "*ediff-fine-diff" "*"))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2058 ))
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
2059 (ediff-eval-in-buffer
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2060 (if refine-region ediff-fine-diff-buffer ediff-diff-buffer)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2061 (erase-buffer)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2062 ;; shell-command tends to display old shell command buffers even when it
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2063 ;; puts output in another buffer---probably an Emacs bug.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2064 (ediff-kill-buffer-carefully "*Shell Command Output*")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2065 (let ((shell-file-name ediff-shell))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2066 (if refine-region
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2067 (message "Refining difference region %d ..." (1+ refine-region))
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2068 (message "Computing differences ...")(sit-for 0))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2069 (shell-command
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2070 (format "%s %s %s %s"
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2071 diff-program diff-options
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2072 (ediff-protect-metachars file-A)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2073 (ediff-protect-metachars file-B))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2074 t)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2075 ))
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2076
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2077
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2078 (if refine-region
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2079 (progn
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2080 (ediff-prepare-error-list diff-ok-lines-regexp ediff-fine-diff-buffer)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2081 (message "Refining difference region %d ... Done." (1+ refine-region))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2082 (ediff-convert-diffs-to-overlays-refine
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2083 ediff-A-buffer ediff-B-buffer
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2084 (ediff-extract-diffs ediff-fine-diff-buffer)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2085 refine-region))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2086 (ediff-prepare-error-list diff-ok-lines-regexp ediff-diff-buffer)
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2087 (message "Computing differences ... Done.")(sit-for 0)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2088 (ediff-convert-diffs-to-overlays
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2089 ediff-A-buffer ediff-B-buffer
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2090 (ediff-extract-diffs ediff-diff-buffer
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2091 ediff-A-buffer ediff-B-buffer))))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2092
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2093
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2094 (defun ediff-prepare-error-list (ok-regexp diff-buff)
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
2095 (ediff-eval-in-buffer
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2096 ediff-error-buffer
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2097 (erase-buffer)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2098 (insert-buffer diff-buff)
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2099 (delete-matching-lines ok-regexp)))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2100
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2101 ;;; Function to start Ediff by patching a file
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2102
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2103 ;;;###autoload
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
2104 (defun ediff-patch-file (source-filename &optional startup-hooks)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2105 "Run Ediff by patching FILE-TP-PATCH."
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
2106 (interactive
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
2107 (list (ediff-read-file-name "File to patch"
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2108 (if ediff-use-last-dir
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
2109 ediff-last-dir-patch
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2110 default-directory)
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
2111 nil)))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2112
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
2113 (ediff-get-patch-buffer (file-name-directory source-filename))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2114 (let* ((backup-extension
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2115 ;; if the user specified a -b option, extract the backup
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
2116 ;; extension from there; else use `.orig'
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
2117 (substring ediff-patch-options
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2118 (if (string-match "-b[ \t]+" ediff-patch-options)
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2119 (match-end 0) 0)
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2120 (if (string-match "-b[ \t]+[^ \t]+" ediff-patch-options)
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2121 (match-end 0) 0)))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2122 (backup-extension (if (string= backup-extension "")
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2123 "orig" backup-extension))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2124 (shell-file-name ediff-shell)
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2125 ;; ediff-find-file may use a temp file to do the patch
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2126 ;; so, we save source-filename and true-source-filename as a var
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2127 ;; that initially is source-filename but may be changed to a temp
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2128 ;; file for the purpose of patching.
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2129 (true-source-filename source-filename)
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2130 (target-filename source-filename)
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2131 target-buf buf-to-patch file-name-magic-p)
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
2132
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
2133 ;; Make a temp file, if source-filename has a magic file handler (or if
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2134 ;; it is handled via auto-mode-alist and similar magic).
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2135 ;; Check if there is a buffer visiting source-filename and if they are in
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2136 ;; synch; arrange for the deletion of temp file.
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2137 (ediff-find-file 'true-source-filename 'buf-to-patch
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2138 'ediff-last-dir-patch 'startup-hooks)
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2139
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
2140 ;; Check if source file name has triggered black magic, such as file name
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2141 ;; handlers or auto mode alist, and make a note of it.
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2142 (setq file-name-magic-p (not (equal (file-truename true-source-filename)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2143 (file-truename source-filename))))
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2144
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2145 ;; Checkout orig file, if necessary so that the patched file could be
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2146 ;; checked back in.
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2147 (ediff-toggle-read-only buf-to-patch)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2148
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
2149 (ediff-eval-in-buffer
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
2150 ediff-patch-diagnostics
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2151 (message "Applying patch ... ")(sit-for 0)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2152 ;; always pass patch the -f option, so it won't ask any questions
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2153 (shell-command-on-region
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2154 (point-min) (point-max)
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
2155 (format "%s -f %s %s"
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
2156 ediff-patch-program ediff-patch-options
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2157 (expand-file-name true-source-filename))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2158 t))
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2159 (message "Applying patch ... Done.")(sit-for 0)
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2160 (switch-to-buffer ediff-patch-diagnostics)
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
2161 (sit-for 0) ;; synchronize
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
2162
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
2163 (or (file-exists-p (concat true-source-filename "." backup-extension))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2164 (error "Patch failed or didn't modify the original file."))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2165
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
2166 ;; If black magic is involved, apply patch to a temp copy of the
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
2167 ;; file. Otherwise, apply patch to the orig copy.
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
2168 ;; If patch is applied to temp copy, we name the result
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
2169 ;; ***.patched. The orig file name isn't changed, and the temp copy of
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
2170 ;; the original is later deleted.
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
2171 ;; Without magic, the original file is renamed (usually into
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
2172 ;; old-name.orig) and the result of patching will have the
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
2173 ;; same name as the original.
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
2174 (if (not file-name-magic-p)
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
2175 (ediff-eval-in-buffer
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
2176 buf-to-patch
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2177 (set-visited-file-name (concat source-filename "." backup-extension))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2178 (set-buffer-modified-p nil))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2179 (setq target-filename (concat true-source-filename ".patched"))
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
2180 (rename-file true-source-filename target-filename t)
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2181
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
2182 ;; arrange that the temp copy of orig will be deleted
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
2183 (rename-file (concat true-source-filename "." backup-extension)
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2184 true-source-filename t))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2185
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
2186 ;; make orig buffer read-only
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2187 (setq startup-hooks
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2188 (cons 'ediff-toggle-read-only-patch-orig startup-hooks))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2189
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
2190 ;; set up a buf for the patched file
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2191 (ediff-eval-in-buffer
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2192 (setq target-buf (find-file-noselect target-filename))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2193 ;; files to be patched are always checked out first
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2194 (setq ediff-local-checkout-flag 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
2195
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
2196 (ediff-buffers buf-to-patch target-buf startup-hooks)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2197
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
2198 (bury-buffer ediff-patch-diagnostics)
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
2199 (message "Patch diagnostics available in buffer %s."
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
2200 (buffer-name ediff-patch-diagnostics))))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2201
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2202 (defalias 'epatch 'ediff-patch-file)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2203 (defalias 'epatch-buffer 'ediff-patch-buffer)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2204
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2205 ;;; Function to start Ediff on files
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2206
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2207 ;;;###autoload
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2208 (defun ediff-files (file-A file-B &optional startup-hooks)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2209 "Run Ediff on a pair files, FILE-A and FILE-B."
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2210 (interactive
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2211 (let (f)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2212 (list (setq f (ediff-read-file-name "File A to compare"
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2213 (if ediff-use-last-dir
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2214 ediff-last-dir-A
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2215 default-directory)
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
2216 nil))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2217 (ediff-read-file-name "File B to compare"
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2218 (if ediff-use-last-dir
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2219 ediff-last-dir-B nil)
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
2220 f)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2221 )))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2222 (ediff-files-internal file-A
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2223 (if (file-directory-p file-B)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2224 (expand-file-name
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2225 (file-name-nondirectory file-A) file-B)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2226 file-B)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2227 startup-hooks))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2228
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2229
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2230 (defalias 'ediff 'ediff-files)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2231
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2232
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2233 ;;; Function to start Ediff on buffers
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2234
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2235 ;;;###autoload
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2236 (defun ediff-buffers (buffer-A buffer-B &optional startup-hooks)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2237 "Run Ediff on a pair of buffers, BUFFER-A and BUFFER-B."
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2238 (interactive
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
2239 (list (read-buffer "Buffer A to compare: " (current-buffer) t)
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2240 (read-buffer "Buffer B to compare: "
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
2241 (progn
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
2242 ;; realign buffers so that two visible bufs will be
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
2243 ;; at the top
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
2244 (save-window-excursion (other-window 1))
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
2245 (other-buffer (current-buffer) t))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2246 t)))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2247 (if (not (ediff-buffer-live-p buffer-A))
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
2248 (error "Buffer %S doesn't exist." buffer-A))
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
2249 (if (not (ediff-buffer-live-p buffer-B))
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
2250 (error "Buffer %S doesn't exist." buffer-B))
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
2251
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2252 (let (file-A file-B)
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2253 (ediff-eval-in-buffer
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2254 buffer-A
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2255 (setq file-A (ediff-make-temp-file)))
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2256 (ediff-eval-in-buffer
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2257 buffer-B
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2258 (setq file-B (ediff-make-temp-file)))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2259 (ediff-setup (get-buffer buffer-A) file-A
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2260 (get-buffer buffer-B) file-B
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2261 (cons (` (lambda ()
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2262 (delete-file (, file-A))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2263 (delete-file (, file-B))))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2264 startup-hooks)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2265 )))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2266
7709
d88d94461e5d (ediff-patch-buffer): Fix autoload cookie.
Richard M. Stallman <rms@gnu.org>
parents: 7639
diff changeset
2267 ;;;###autoload
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2268 (defun ediff-patch-buffer (buffer-name &optional startup-hooks)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2269 "Run Ediff by patching BUFFER-NAME."
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2270 (interactive "bBuffer to patch: ")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2271
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2272 (let* ((file-buffer (get-buffer buffer-name))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2273 (file-name (if file-buffer (buffer-file-name file-buffer))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2274 (if (not file-name)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2275 (error "Buffer %s doesn't exist or doesn't visit any file. Why patch?"
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2276 file-name))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2277
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2278 (ediff-patch-file file-name startup-hooks)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2279
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2280
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2281 ;;; Versions Control functions
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2282
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2283 ;;;###autoload
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2284 (defun ediff-revision (revision)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2285 "Call `vc.el' or `rcs.el' depending on `ediff-version-control-package'.
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2286 This function is introduced to provide a uniform interface to version
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2287 control packages from Ediff."
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2288 (interactive "sVersion to Ediff with (default is the latest version): ")
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2289 (funcall
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2290 (intern (format "%S-ediff-internal" ediff-version-control-package))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2291 revision))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2292
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2293 (defun vc-ediff-internal (rev)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2294 ;; Note: this function will work only with Emacs 19.22 and higher.
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2295 "Run Ediff on version REV of the current buffer in another window.
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2296 If the current buffer is named `F', the version is named `F.~REV~'.
7391
c40d16ee57bf entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 7267
diff changeset
2297 If `F.~REV~' already exists, it is used instead of being re-created."
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2298 (or (featurep 'vc)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2299 (if (locate-library "vc") ;; if vc.el is available
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2300 (require 'vc-hooks)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2301 (error "The vc.el package is apparently not installed")))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2302 (define-key vc-prefix-map "=" 'ediff-revision)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2303 (let ((newvers (current-buffer)))
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2304 (vc-version-other-window rev)
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2305 ;; current-buffer is supposed to contain the old version
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2306 ;; in another window
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2307 (ediff-buffers newvers (current-buffer))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2308 ))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2309
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2310 (defun rcs-ediff-view-revision (&optional rev)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2311 "View previous RCS revision of current file.
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2312 With prefix argument, prompts for a revision name."
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2313 (interactive (list (if current-prefix-arg
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2314 (read-string "Revision: "))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2315 (let* ((filename (buffer-file-name (current-buffer)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2316 (switches (append '("-p")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2317 (if rev (list (concat "-r" rev)) nil)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2318 (buff (concat (file-name-nondirectory filename) ".~" rev "~")))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2319 (message "Working...")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2320 (setq filename (expand-file-name filename))
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2321 (with-output-to-temp-buffer buff
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2322 (let ((output-buffer (ediff-rcs-get-output-buffer filename buff)))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2323 (delete-windows-on output-buffer)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2324 (save-excursion
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2325 (set-buffer output-buffer)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2326 (apply 'call-process "co" nil t nil
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2327 ;; -q: quiet (no diagnostics)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2328 (append switches rcs-default-co-switches
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2329 (list "-q" filename)))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2330 (message "")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2331 buff)))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2332
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2333 (defun ediff-rcs-get-output-buffer (file name)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2334 ;; Get a buffer for RCS output for FILE, make it writable and clean it up.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2335 ;; Optional NAME is name to use instead of `*RCS-output*'.
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2336 ;; This is a modified version from rcs.el v1.1. I use it here to make
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2337 ;; Ediff immune to changes in rcs.el
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2338 (let* ((default-major-mode 'fundamental-mode);; no frills!
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2339 (buf (get-buffer-create name)))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2340 (save-excursion
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2341 (set-buffer buf)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2342 (setq buffer-read-only nil
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2343 default-directory (file-name-directory (expand-file-name file)))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2344 (erase-buffer))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2345 buf))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2346
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2347 (defun rcs-ediff-internal (rev)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2348 "Run Ediff on the current buffer, comparing it with previous RCS revision."
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2349 (or (featurep 'rcs)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2350 (if (locate-library "rcs")
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2351 (require 'rcs)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2352 (error "The rcs.el package is apparently not installed")))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2353 (global-set-key "\C-cD" 'ediff-revision)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2354 (let ((newvers (current-buffer))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2355 (oldvers (rcs-ediff-view-revision rev)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2356 (ediff-buffers newvers oldvers)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2357 ))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2358
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2359
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2360
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2361
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2362 ;; Select the lowest window on the frame.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2363 (defun ediff-select-lowest-window ()
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2364 (let* ((lowest-window (selected-window))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2365 (bottom-edge (car (cdr (cdr (cdr (window-edges))))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2366 (last-window (previous-window))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2367 (window-search t))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2368 (while window-search
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2369 (let* ((this-window (next-window))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2370 (next-bottom-edge (car (cdr (cdr (cdr
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2371 (window-edges this-window)))))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2372 (if (< bottom-edge next-bottom-edge)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2373 (progn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2374 (setq bottom-edge next-bottom-edge)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2375 (setq lowest-window this-window)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2376
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2377 (select-window this-window)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2378 (if (eq last-window this-window)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2379 (progn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2380 (select-window lowest-window)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2381 (setq window-search nil)))))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2382
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2383 ;;; Common setup routines
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2384
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2385 ;; Set up the window configuration. If POS is given, set the points to
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2386 ;; the beginnings of the buffers.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2387 (defun ediff-setup-windows (buffer-A buffer-B control-buffer &optional pos)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2388 ;; Make sure we are not in the minibuffer window when we try to delete
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2389 ;; all other windows.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2390 (if (eq (selected-window) (minibuffer-window))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2391 (other-window 1))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2392 (or (ediff-leave-window-config control-buffer)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2393 (progn
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2394 (delete-other-windows)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2395 (switch-to-buffer control-buffer)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2396 (ediff-refresh-mode-line)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2397
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2398 (ediff-arrange-buffer buffer-A buffer-B (current-buffer) pos)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2399 (ediff-arrange-buffer buffer-B buffer-A (current-buffer) pos)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2400 ;; ediff-arrange-buffer always leaves in ctl buffer
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2401 ;; setup ctl wind if it is not set.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2402 (ediff-setup-control-window)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2403
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2404 ;; If diff reports errors, show them then quit.
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
2405 (if (/= 0 (ediff-eval-in-buffer ediff-error-buffer (buffer-size)))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2406 (let ((diff-output-buf ediff-diff-buffer))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2407 (switch-to-buffer ediff-error-buffer)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2408 (ediff-kill-buffer-carefully control-buffer)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2409 (error "Errors found in diff output. Diff output buffer is %s"
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2410 diff-output-buf))))))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2411
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2412
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2413 ;; Arranges goal-buf on the screen.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2414 (defun ediff-arrange-buffer (goal-buf other-buf ctl-buf &optional pos)
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2415 (let* ((ctl-wind (ediff-get-visible-buffer-window ctl-buf))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2416 (goal-wind (ediff-get-visible-buffer-window goal-buf))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2417 (other-wind (ediff-get-visible-buffer-window other-buf))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2418 (ctl-frame (ediff-window-frame ctl-wind))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2419 (goal-frame (if goal-wind (ediff-window-frame goal-wind)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2420 (other-frame (if other-wind (ediff-window-frame other-wind)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2421 (ctl-frame-shared (or (eq ctl-frame goal-frame)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2422 (eq ctl-frame other-frame))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2423
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2424 (cond ((and goal-frame
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2425 (not (eq goal-wind other-wind)))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2426 ;; goal buffer is visible and we are not comparing file
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2427 ;; against itself (by mistake).
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2428 ;; Note: goal-frame != ctl-frame, as we deleted other
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2429 ;; windows on ctl-frame.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2430 (ediff-select-frame goal-frame)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2431 (select-window goal-wind)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2432 (delete-other-windows))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2433
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2434 ;; goal-buf invisible, ctl-frame has only ctl-buf
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2435 ;; then put goal-buf on ctl-frame
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2436 ((null ctl-frame-shared)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2437 (ediff-select-frame ctl-frame)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2438 (split-window-vertically)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2439 (ediff-select-lowest-window)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2440 (setq ctl-wind (selected-window))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2441 (switch-to-buffer ctl-buf)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2442 (ediff-setup-control-window)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2443 (other-window 1)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2444 (switch-to-buffer goal-buf)) ; goal-buf set
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2445 ;; goal-buf invisible, ctl-frame has ctl-buf and other-buf
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2446 ;; So, put everything in one frame
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2447 (other-frame ;; share with the other buf
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2448 (ediff-select-frame ctl-frame)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2449 (select-window other-wind)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2450 (funcall ediff-split-window-function)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2451 (other-window 1)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2452 (switch-to-buffer goal-buf))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2453 (t ;; debug
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2454 (error "Funny window combination (Ediff bug?)")))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2455
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2456 (if pos
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2457 (goto-char (point-min)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2458
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2459 (ediff-select-frame ctl-frame)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2460 (select-window ctl-wind)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2461 (switch-to-buffer ctl-buf)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2462
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2463 ;; This function assumes that we are in the window where control buffer is
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2464 ;; to reside.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2465 (defun ediff-setup-control-window ()
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2466 "Set up window for control buffer."
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2467 (let ((window-min-height 2))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2468 (erase-buffer)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2469 (insert ediff-help-message)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2470 (shrink-window-if-larger-than-buffer)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2471 (setq ediff-control-window (selected-window))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2472 (setq ediff-window-config-saved
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2473 (format "%S%S%S%S"
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2474 ediff-control-window
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2475 (ediff-get-visible-buffer-window ediff-A-buffer)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2476 (ediff-get-visible-buffer-window ediff-B-buffer)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2477 ediff-split-window-function))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2478 (goto-char (point-min))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2479 (skip-chars-forward ediff-whitespace)))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2480
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2481 (defun ediff-leave-window-config (control-buf)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2482 (and (eq control-buf (current-buffer))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2483 (/= (buffer-size) 0)
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2484 (ediff-eval-in-buffer
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2485 control-buf
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2486 (string= ediff-window-config-saved
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2487 (format "%S%S%S%S"
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2488 (ediff-get-visible-buffer-window ediff-control-buffer)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2489 (ediff-get-visible-buffer-window ediff-A-buffer)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2490 (ediff-get-visible-buffer-window ediff-B-buffer)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2491 ediff-split-window-function)))))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2492
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2493
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2494 ;; Set up the keymap in the control buffer
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2495 (defun ediff-set-keys ()
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2496 "Set up Ediff keymap, if necessary."
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2497 (if (null ediff-mode-map)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2498 (ediff-setup-keymap))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2499 (use-local-map ediff-mode-map))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2500
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2501 ;; Reload Ediff keymap. For debugging only.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2502 (defun ediff-reload-keymap ()
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2503 (interactive)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2504 (setq ediff-mode-map nil)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2505 (ediff-set-keys))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2506
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2507 (defun ediff-before-change-guard (start end)
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
2508 "If buffer is highlighted with ASCII flags, remove highlighting.
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
2509 Arguments, START and END are not used, but are provided
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
2510 because this is required by `before-change-function'."
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2511 (let (rehighlight-key)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2512 (save-window-excursion
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2513 (mapcar
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2514 (function
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2515 (lambda (buf)
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
2516 (ediff-eval-in-buffer
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
2517 buf
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
2518 (if (eq ediff-highlighting-style 'ascii)
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
2519 (progn
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
2520 (ediff-unselect-and-select-difference
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
2521 ediff-current-difference
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
2522 'unselect-only 'no-recenter)
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
2523 (setq rehighlight-key
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
2524 (substitute-command-keys "\\[ediff-recenter]"))
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
2525 )))))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2526 ediff-this-buffer-control-sessions)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2527 (if rehighlight-key
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2528 (error
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2529 "ASCII flags removed. You can edit now. Hit %S to rehighlight."
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2530 rehighlight-key))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2531 )))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2532
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2533 (defun ediff-recompute-diffs ()
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2534 "Recompute difference regions in buffers A and B."
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2535 (interactive)
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
2536 (let ((point-A (ediff-eval-in-buffer ediff-A-buffer (point)))
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
2537 (point-B (ediff-eval-in-buffer ediff-B-buffer (point)))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2538 file-A file-B)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2539 (ediff-unselect-and-select-difference -1)
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
2540 (ediff-eval-in-buffer
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2541 ediff-A-buffer
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2542 (setq file-A (ediff-make-temp-file)))
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2543 (ediff-eval-in-buffer
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2544 ediff-B-buffer
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2545 (setq file-B (ediff-make-temp-file)))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2546 (ediff-clear-diff-vector ediff-difference-vector 'fine-diffs-also)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2547 (setq ediff-killed-diffs-alist nil) ; saved kills will no longer be valid
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2548 ; after recompute
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2549 (setq ediff-difference-vector
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2550 (ediff-setup-diff-regions file-A file-B 'use-old))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2551 (setq ediff-number-of-differences (length ediff-difference-vector))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2552 (delete-file file-A)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2553 (delete-file file-B)
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2554 (ediff-eval-in-buffer ediff-A-buffer (goto-char point-A))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2555 (ediff-jump-to-difference (ediff-diff-at-point 'A))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2556 (beep 1)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2557 (if (y-or-n-p
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
2558 "Ediff is at last posn in buff A. Stay (or goto last posn in B)? ")
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2559 ()
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
2560 (ediff-eval-in-buffer ediff-B-buffer (goto-char point-B))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2561 (ediff-jump-to-difference (ediff-diff-at-point 'B)))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2562 (message "")
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2563 ))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2564
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2565 (defun ediff-remember-buffer-characteristics (&optional arg)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2566 "Record certain properties of the buffers being compared.
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
2567 Must be called in the control buffer. Saves `read-only', `modified',
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
2568 and `auto-save' properties in buffer local variables. Turns off
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
2569 `auto-save-mode'. These properties are restored via a call to
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
2570 `ediff-restore-buffer-characteristics'."
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2571
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2572 ;; remember and alter buffer characteristics
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2573 (set (if arg 'ediff-A-buffer-values-setup 'ediff-A-buffer-values)
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
2574 (ediff-eval-in-buffer
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2575 ediff-A-buffer
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2576 (prog1
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2577 (emerge-save-variables ediff-saved-variables)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2578 (emerge-restore-variables ediff-saved-variables
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2579 ediff-working-values))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2580 (set (if arg 'ediff-B-buffer-values-setup 'ediff-B-buffer-values)
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
2581 (ediff-eval-in-buffer
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2582 ediff-B-buffer
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2583 (prog1
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2584 (emerge-save-variables ediff-saved-variables)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2585 (emerge-restore-variables ediff-saved-variables
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2586 ediff-working-values)))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2587
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2588 (defun ediff-restore-buffer-characteristics (&optional arg)
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
2589 "Restores properties saved by `ediff-remember-buffer-characteristics'."
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2590 (let ((A-values (if arg ediff-A-buffer-values-setup ediff-A-buffer-values))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2591 (B-values (if arg ediff-B-buffer-values-setup ediff-B-buffer-values)))
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
2592
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
2593 (ediff-eval-in-buffer ediff-A-buffer
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
2594 (emerge-restore-variables ediff-saved-variables
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
2595 A-values))
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
2596 (ediff-eval-in-buffer ediff-B-buffer
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
2597 (emerge-restore-variables ediff-saved-variables
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
2598 B-values))))
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
2599
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
2600
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
2601 ;; If optional A-buffer and B-buffer are given, then construct a vector of
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2602 ;; diff using point values. Otherwise, use line offsets.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2603 (defun ediff-extract-diffs (diff-buffer &optional A-buffer B-buffer)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2604 (let (diff-list
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2605 (a-prev 1) ;; this is needed to set the first diff line correctly
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2606 (b-prev 1))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2607
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2608 (if (and A-buffer B-buffer)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2609 (progn ;; reset point in buffers A and B
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2610 (ediff-eval-in-buffer
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2611 A-buffer
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2612 (goto-char (point-min)))
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
2613 (ediff-eval-in-buffer
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2614 B-buffer
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2615 (goto-char (point-min)))))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2616
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
2617 (ediff-eval-in-buffer
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2618 diff-buffer
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2619 (goto-char (point-min))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2620 (while (re-search-forward ediff-match-diff-line nil t)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2621 (let* ((a-begin (string-to-int (buffer-substring (match-beginning 1)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2622 (match-end 1))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2623 (a-end (let ((b (match-beginning 3))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2624 (e (match-end 3)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2625 (if b
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2626 (string-to-int (buffer-substring b e))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2627 a-begin)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2628 (diff-type (buffer-substring (match-beginning 4) (match-end 4)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2629 (b-begin (string-to-int (buffer-substring (match-beginning 5)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2630 (match-end 5))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2631 (b-end (let ((b (match-beginning 7))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2632 (e (match-end 7)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2633 (if b
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2634 (string-to-int (buffer-substring b e))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2635 b-begin)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2636 a-begin-pt a-end-pt b-begin-pt b-end-pt)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2637 ;; fix the beginning and end numbers, because diff is somewhat
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2638 ;; strange about how it numbers lines
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2639 (if (string-equal diff-type "a")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2640 (setq b-end (1+ b-end)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2641 a-begin (1+ a-begin)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2642 a-end a-begin)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2643 (if (string-equal diff-type "d")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2644 (setq a-end (1+ a-end)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2645 b-begin (1+ b-begin)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2646 b-end b-begin)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2647 ;; (string-equal diff-type "c")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2648 (setq a-end (1+ a-end)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2649 b-end (1+ b-end))))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2650 (if (and A-buffer B-buffer)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2651 (progn ;; computing main diff vector
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2652 ;; convert to relative line numbers
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
2653 (ediff-eval-in-buffer
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2654 A-buffer
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2655 (forward-line (- a-begin a-prev))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2656 (setq a-begin-pt (point))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2657 (forward-line (- a-end a-begin))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2658 (setq a-end-pt (point)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2659 a-prev a-end))
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
2660 (ediff-eval-in-buffer
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2661 B-buffer
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2662 (forward-line (- b-begin b-prev))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2663 (setq b-begin-pt (point))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2664 (forward-line (- b-end b-begin))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2665 (setq b-end-pt (point)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2666 b-prev b-end))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2667 (setq diff-list
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2668 (nconc diff-list (list (vector a-begin-pt a-end-pt
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2669 b-begin-pt b-end-pt)))))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2670 ;; computing refinement vector
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2671 (setq diff-list
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2672 (nconc diff-list (list (vector (- a-begin a-prev)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2673 (- a-end a-begin)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2674 (- b-begin b-prev)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2675 (- b-end b-begin))))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2676 a-prev a-end
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2677 b-prev b-end))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2678
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
2679 ))) ;; end ediff-eval-in-buffer
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2680 diff-list
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2681 ))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2682
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2683 (defun ediff-convert-diffs-to-overlays (A-buffer B-buffer diff-list)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2684 (let* ((current-diff -1)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2685 (total-diffs (length diff-list))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2686 ; (control-buffer-suffix ediff-control-buffer-suffix)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2687 diff-overlay-list list-element
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2688 a-begin a-end b-begin b-end
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2689 a-overlay b-overlay)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2690
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2691 (while diff-list
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2692 (setq current-diff (1+ current-diff)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2693 list-element (car diff-list)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2694 a-begin (aref list-element 0)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2695 a-end (aref list-element 1)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2696 b-begin (aref list-element 2)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2697 b-end (aref list-element 3))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2698
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2699 ;; Put overlays at appropriate places in buffers
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2700 (setq a-overlay (ediff-make-overlay a-begin a-end A-buffer))
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
2701 ;; Priorities of overlays should be equal in all ediff control
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
2702 ;; panels buffers. Otherwise it won't work due to Emacs
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2703 ;; bug---insert-in-front-hooks will be called
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2704 ;; only on behalf of the buffer with higher priority.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2705 (ediff-overlay-put a-overlay 'priority ediff-shaded-overlay-priority)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2706 (ediff-overlay-put a-overlay 'ediff-diff-num current-diff)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2707 (ediff-overlay-put a-overlay
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2708 'insert-in-front-hooks '(ediff-insert-in-front))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2709 ; (ediff-overlay-put a-overlay
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2710 ; 'ediff-control-buffer control-buffer-suffix)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2711 (ediff-overlay-put a-overlay
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2712 'face (if (ediff-odd-p current-diff) ;; odd diff
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2713 'ediff-odd-diff-face-A-var
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2714 'ediff-even-diff-face-A-var))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2715
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2716 (setq b-overlay (ediff-make-overlay b-begin b-end B-buffer))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2717 (ediff-overlay-put b-overlay 'priority ediff-shaded-overlay-priority)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2718 (ediff-overlay-put b-overlay 'ediff-diff-num current-diff)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2719 (ediff-overlay-put b-overlay
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2720 'insert-in-front-hooks '(ediff-insert-in-front))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2721 ; (ediff-overlay-put b-overlay
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2722 ; 'ediff-control-buffer control-buffer-suffix)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2723 (ediff-overlay-put b-overlay
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2724 'face (if (ediff-odd-p current-diff) ;; odd diff
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2725 'ediff-odd-diff-face-B-var
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2726 'ediff-even-diff-face-B-var))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2727
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2728 (if (ediff-if-lucid) ;; chars inserted at end will be inside extent
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2729 (progn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2730 (ediff-overlay-put a-overlay
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2731 'ediff-marker
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2732 (move-marker (make-marker) a-begin A-buffer))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2733 (ediff-overlay-put b-overlay
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2734 'ediff-marker
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2735 (move-marker (make-marker) b-begin B-buffer))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2736 (ediff-overlay-put a-overlay 'end-open nil)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2737 (ediff-overlay-put b-overlay 'end-open nil)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2738
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2739 ;; record all overlays for this difference
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2740 (setq diff-overlay-list
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2741 (nconc diff-overlay-list
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2742 (list (vector a-overlay b-overlay nil nil)))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2743 diff-list
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2744 (cdr diff-list))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2745 (message "Processing diff region %d of %d"
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2746 current-diff total-diffs)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2747 ) ;; while
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2748 ;; this is just to avoid confusing the user with diff num < total-diffs
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2749 (message "Processing diff region %d of %d"
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2750 (1+ current-diff) total-diffs)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2751 ;; convert the list of difference information into a vector for
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2752 ;; fast access
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2753 (apply 'vector diff-overlay-list)))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2754
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2755
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2756
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2757 ;;; Commands
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2758
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2759 (defun ediff-recenter (&optional no-rehighlight)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2760 "Bring the highlighted region of all buffers A and B into view.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2761 Reestablish the default three-window display."
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2762 (interactive)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2763 (setq ediff-disturbed-overlays nil) ;; clear after use
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2764 (let (buffer-read-only)
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
2765 (if (and (ediff-buffer-live-p ediff-A-buffer)
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
2766 (ediff-buffer-live-p ediff-B-buffer))
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
2767 (ediff-setup-windows
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
2768 ediff-A-buffer ediff-B-buffer ediff-control-buffer)))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2769 ;; Redisplay whatever buffers are showing, if there is a selected difference
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
2770 (if (and (ediff-buffer-live-p ediff-A-buffer)
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
2771 (ediff-buffer-live-p ediff-B-buffer)
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
2772 (>= ediff-current-difference 0)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2773 (< ediff-current-difference ediff-number-of-differences))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2774 (let* ( ;; context must be saved before switching to windows A/B
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2775 (buffer-A ediff-A-buffer)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2776 (buffer-B ediff-B-buffer)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2777 (wind (selected-window))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2778 (control-buf ediff-control-buffer)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2779 (before-flag-shift-A (if (eq ediff-highlighting-style 'ascii)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2780 (1- (length ediff-before-flag-A))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2781 0))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2782 (after-flag-shift-A (if (eq ediff-highlighting-style 'ascii)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2783 (1- (length ediff-after-flag-A))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2784 0))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2785 (before-flag-shift-B (if (eq ediff-highlighting-style 'ascii)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2786 (1- (length ediff-before-flag-B))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2787 0))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2788 (after-flag-shift-B (if (eq ediff-highlighting-style 'ascii)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2789 (1- (length ediff-after-flag-B))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2790 0))
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2791 (window-A (ediff-get-visible-buffer-window buffer-A))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2792 (window-B (ediff-get-visible-buffer-window buffer-B)))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2793
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2794 (or no-rehighlight
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2795 (ediff-operate-on-flags 'insert))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2796
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2797 (if window-A (progn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2798 (select-window window-A)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2799 (ediff-position-region
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2800 (- (ediff-get-diff-posn 'A 'beg nil control-buf)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2801 before-flag-shift-A)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2802 (+ (ediff-get-diff-posn 'A 'end nil control-buf)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2803 after-flag-shift-A)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2804 (ediff-get-diff-posn 'A 'beg nil control-buf))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2805 (if window-B (progn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2806 (select-window window-B)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2807 (ediff-position-region
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2808 (- (ediff-get-diff-posn 'B 'beg nil control-buf)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2809 before-flag-shift-B)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2810 (+ (ediff-get-diff-posn 'B 'end nil control-buf)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2811 after-flag-shift-B)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2812 (ediff-get-diff-posn 'B 'beg nil control-buf))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2813 (select-window wind))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2814
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2815 (defun ediff-toggle-split ()
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2816 "Toggle vertical/horizontal window split.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2817 Does nothing if file-A and file-B are in different frames."
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2818 (interactive)
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2819 (let* ((wind-A (ediff-get-visible-buffer-window ediff-A-buffer))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2820 (wind-B (ediff-get-visible-buffer-window ediff-B-buffer))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2821 (frame-A (if wind-A (ediff-window-frame wind-A)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2822 (frame-B (if wind-B (ediff-window-frame wind-B))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2823 (if (eq frame-A frame-B)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2824 (setq ediff-split-window-function
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2825 (if (eq ediff-split-window-function 'split-window-vertically)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2826 'split-window-horizontally
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2827 'split-window-vertically))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2828 (message "No splitting: Buffers A and B are in different frames."))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2829 (ediff-recenter 'no-rehighlight)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2830
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2831 (defun ediff-toggle-hilit ()
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2832 "Switch between highlighting using ASCII flags and highlighting using faces.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2833 On a dumb terminal, switches between ASCII highlighting and no highlighting."
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2834 (interactive)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2835 (if (not window-system)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2836 (if (eq ediff-highlighting-style 'ascii)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2837 (progn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2838 (message "ASCII highlighting flags removed.")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2839 (ediff-unselect-and-select-difference ediff-current-difference
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2840 'unselect-only)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2841 (setq ediff-highlighting-style 'off))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2842 (ediff-unselect-and-select-difference ediff-current-difference
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2843 'select-only))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2844 (ediff-unselect-and-select-difference ediff-current-difference
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2845 'unselect-only)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2846 ;; cycle through highlighting
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2847 (cond ((and ediff-want-faces ediff-highlight-all-diffs)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2848 (message "Unhighlighting unselected difference regions.")
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2849 (setq ediff-highlight-all-diffs nil))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2850 (ediff-want-faces
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2851 (message "Highlighting with ASCII flags.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2852 (setq ediff-want-faces nil))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2853 (t
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2854 (message "Re-highlighting all difference regions.")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2855 (setq ediff-want-faces t
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2856 ediff-highlight-all-diffs t)))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2857
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2858 (if (and ediff-want-faces ediff-highlight-all-diffs)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2859 (if (not (face-differs-from-default-p 'ediff-odd-diff-face-A-var))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2860 (progn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2861 (copy-face ediff-odd-diff-face-A 'ediff-odd-diff-face-A-var)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2862 (copy-face ediff-odd-diff-face-B 'ediff-odd-diff-face-B-var)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2863 (copy-face ediff-even-diff-face-A 'ediff-even-diff-face-A-var)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2864 (copy-face ediff-even-diff-face-B 'ediff-even-diff-face-B-var)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2865 (copy-face 'default 'ediff-odd-diff-face-A-var)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2866 (copy-face 'default 'ediff-odd-diff-face-B-var)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2867 (copy-face 'default 'ediff-even-diff-face-A-var)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2868 (copy-face 'default 'ediff-even-diff-face-B-var))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2869
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2870 (ediff-unselect-and-select-difference
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2871 ediff-current-difference 'select-only))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2872 (ediff-operate-on-flags 'insert)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2873 )
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2874
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2875 (defun ediff-toggle-autorefine ()
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2876 "Toggle auto-refine mode."
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2877 (interactive)
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2878 (cond ((eq ediff-auto-refine 'nix)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2879 (setq ediff-auto-refine 'on)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2880 (ediff-make-fine-diffs ediff-current-difference 'noforce)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2881 (message "Auto-refining is ON."))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2882 ((eq ediff-auto-refine 'on)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2883 (message "Auto-refining is OFF.")
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2884 (setq ediff-auto-refine 'off))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2885 (t
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2886 (ediff-set-fine-diff-properties ediff-current-difference 'default)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2887 (message "Refinements are HIDDEN.")
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2888 (setq ediff-auto-refine 'nix))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
2889 ))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2890
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2891 (defun ediff-toggle-help ()
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2892 "Toggle short/long help message."
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2893 (interactive)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2894 (let (buffer-read-only)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2895 (erase-buffer)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2896 (if (string= ediff-help-message ediff-help-message-long)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2897 (setq ediff-help-message ediff-help-message-short)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2898 (setq ediff-help-message ediff-help-message-long)))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2899 (setq ediff-window-config-saved "") ;; force redisplay
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2900 (ediff-recenter 'no-rehighlight))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2901
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2902
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2903 (defun ediff-toggle-read-only-patch-orig ()
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2904 "Used as a startup hook to set `.orig' patch file read-only."
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2905 (ediff-toggle-read-only ediff-A-buffer))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2906
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2907 (defun ediff-toggle-read-only (&optional buff)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2908 "Toggles read-only in buffers A and B.
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2909 If buffer is under version control and locked, check it out first."
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2910 (interactive)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2911 ;; Optional argument, BUF, is passed only in a startup hook.
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2912 (or buff (ediff-recenter))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2913
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
2914 (ediff-eval-in-buffer
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2915 (or buff (if (eq last-command-char ?A) ediff-A-buffer ediff-B-buffer))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2916 (let* ((file (buffer-file-name (current-buffer)))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2917 (file-writable (and file (file-writable-p file)))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2918 (toggle-ro-cmd (cond (ediff-toggle-read-only-function)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2919 (ediff-local-checkout-flag
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2920 (if (and file (not file-writable))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2921 (progn
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2922 (beep 1)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2923 (message "Warning: file %s is read-only."
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2924 (abbreviate-file-name file))))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2925 'toggle-read-only)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2926 (file-writable 'toggle-read-only)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2927 (t (key-binding "\C-x\C-q")))))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2928 (if (and toggle-ro-cmd
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2929 (string-match "toggle-read-only" (symbol-name toggle-ro-cmd)))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2930 (save-window-excursion
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2931 (setq ediff-local-checkout-flag t)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2932 (or buff
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2933 (select-window
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2934 (ediff-get-visible-buffer-window (current-buffer))))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2935 (command-execute toggle-ro-cmd))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2936 (error "Don't know how to toggle read-only in buffer %S"
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2937 (current-buffer))))))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2938
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2939
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2940
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2941 ;;; Window scrolling operations
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2942
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
2943 ;; Perform some operation on the two file windows (if they are showing).
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2944 ;; Catches all errors on the operation in the A and B windows.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2945 ;; Usually, errors come from scrolling off the
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2946 ;; beginning or end of the buffer, and this gives nice nice error messages.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2947 (defun ediff-operate-on-windows (operation arg)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2948 (let* ((buffer-A ediff-A-buffer)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2949 (buffer-B ediff-B-buffer)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2950 (wind (selected-window))
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2951 (window-A (ediff-get-visible-buffer-window buffer-A))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2952 (window-B (ediff-get-visible-buffer-window buffer-B)))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2953 (if window-A (progn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2954 (select-window window-A)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2955 (condition-case nil
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2956 (funcall operation arg)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2957 (error))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2958 (if window-B (progn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2959 (select-window window-B)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2960 (condition-case nil
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2961 (funcall operation arg)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2962 (error))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2963 (select-window wind)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2964 ))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2965
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2966 (defun ediff-scroll-up (&optional arg)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2967 "Scroll up buffers A and B, if they are in windows.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2968 With optional argument ARG, scroll ARG lines; otherwise scroll by nearly
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2969 the height of window-A."
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2970 (interactive "P")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2971 (ediff-operate-on-windows
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2972 'scroll-up
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2973 ;; calculate argument to scroll-up
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2974 ;; if there is an explicit argument
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2975 (if (and arg (not (equal arg '-)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2976 ;; use it
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2977 (prefix-numeric-value arg)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2978 ;; if not, see if we can determine a default amount (the window height)
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2979 (let* ((window-A (ediff-get-visible-buffer-window ediff-A-buffer))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
2980 (window-B (ediff-get-visible-buffer-window ediff-B-buffer))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2981 default-amount)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2982 (if (or (null window-A) (null window-B))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2983 (setq default-amount 0)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2984 (setq default-amount
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2985 (- (min (window-height window-A) (window-height window-B))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2986 1 next-screen-context-lines)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2987 ;; the window was found
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2988 (if arg
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2989 ;; C-u as argument means half of default amount
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2990 (/ default-amount 2)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2991 ;; no argument means default amount
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2992 default-amount)))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2993
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2994 (defun ediff-scroll-down (&optional arg)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2995 "Scroll down buffers A and B, if they are in windows.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2996 With optional argument ARG, scroll ARG lines; otherwise scroll by nearly
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2997 the height of window-A."
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2998 (interactive "P")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
2999 (ediff-operate-on-windows
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3000 'scroll-down
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3001 ;; calculate argument to scroll-down
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3002 ;; if there is an explicit argument
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3003 (if (and arg (not (equal arg '-)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3004 ;; use it
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3005 (prefix-numeric-value arg)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3006 ;; if not, see if we can determine a default amount (the window height)
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
3007 (let* ((window-A (ediff-get-visible-buffer-window ediff-A-buffer))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
3008 (window-B (ediff-get-visible-buffer-window ediff-B-buffer))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3009 default-amount)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3010 (if (or (null window-A) (null window-B))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3011 (setq default-amount 0)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3012 (setq default-amount
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3013 (- (min (window-height window-A) (window-height window-B))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3014 1 next-screen-context-lines)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3015 ;; the window was found
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3016 (if arg
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3017 ;; C-u as argument means half of default amount
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3018 (/ default-amount 2)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3019 ;; no argument means default amount
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3020 default-amount)))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3021
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3022 (defun ediff-scroll-left (&optional arg)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3023 "Scroll left buffer-A and buffer-B, if they are in windows.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3024 If an argument is given, that is how many columns are scrolled, else nearly
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3025 the width of the A and B windows."
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3026 (interactive "P")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3027 (ediff-operate-on-windows
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3028 'scroll-left
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3029 ;; calculate argument to scroll-left
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3030 ;; if there is an explicit argument
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3031 (if (and arg (not (equal arg '-)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3032 ;; use it
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3033 (prefix-numeric-value arg)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3034 ;; if not, see if we can determine a default amount
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3035 ;; (half the window width)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3036 (if (null ediff-control-window)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3037 ;; no control window, use nil
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3038 nil
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3039 (let ((default-amount
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3040 (- (/ (window-width ediff-control-window) 2) 3)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3041 ;; the window was found
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3042 (if arg
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3043 ;; C-u as argument means half of default amount
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3044 (/ default-amount 2)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3045 ;; no argument means default amount
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3046 default-amount))))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3047
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3048 (defun ediff-scroll-right (&optional arg)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3049 "Scroll right buffer-A and buffer-B, if they are in windows.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3050 If an argument is given, that is how many columns are scrolled, else nearly
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3051 the width of the A and B windows."
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3052 (interactive "P")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3053 (ediff-operate-on-windows
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3054 'scroll-right
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3055 ;; calculate argument to scroll-right
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3056 ;; if there is an explicit argument
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3057 (if (and arg (not (equal arg '-)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3058 ;; use it
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3059 (prefix-numeric-value arg)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3060 ;; if not, see if we can determine a default amount
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3061 ;; (half the window width)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3062 (if (null ediff-control-window)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3063 ;; no control window, use nil
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3064 nil
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3065 (let ((default-amount
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3066 (- (/ (window-width ediff-control-window) 2) 3)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3067 ;; the window was found
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3068 (if arg
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3069 ;; C-u as argument means half of default amount
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3070 (/ default-amount 2)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3071 ;; no argument means default amount
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3072 default-amount))))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3073
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3074 (defun ediff-position-region (beg end pos)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3075 "This is a variation on `emerge-position-region'.
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3076 The difference is that it always tries to align difference regions in
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3077 buffer-A and buffer-B, so that it will be easier to compare them."
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3078 (set-window-start (selected-window) beg)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3079 (if (pos-visible-in-window-p end)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3080 ;; Determine the number of lines that the region occupies
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3081 (let ((lines 0))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3082 (while (> end (progn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3083 (move-to-window-line lines)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3084 (point)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3085 (setq lines (1+ lines)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3086 ;; And position the beginning on the right line
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3087 (goto-char beg)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3088 (recenter (/ (1+ (max (- (1- (window-height (selected-window)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3089 lines)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3090 1)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3091 )
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3092 2))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3093 (goto-char pos)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3094 )
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3095
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3096
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3097 (defun ediff-next-difference (&optional arg)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3098 "Advance to the next difference.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3099 With a prefix argument, go back that many differences."
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3100 (interactive "P")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3101 (if (< ediff-current-difference ediff-number-of-differences)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3102 (let ((n (min ediff-number-of-differences
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3103 (+ ediff-current-difference (if arg arg 1))))
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
3104 buffer-read-only)
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3105
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3106 (while (and (< n ediff-number-of-differences)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3107 (funcall ediff-skip-diff-region-function n))
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
3108 (setq n (1+ n)))
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3109
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3110 (ediff-unselect-and-select-difference n)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3111 ;; possibly skip inessential difference regions
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3112 (while (and ediff-ignore-similar-regions
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3113 (< n ediff-number-of-differences)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3114 (ediff-no-fine-diffs n))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3115 (setq n (1+ n))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3116 (ediff-unselect-and-select-difference n))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3117 ) ;; let
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3118 (error "At end of the difference list.")))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3119
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3120 (defun ediff-previous-difference (&optional arg)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3121 "Go to the previous difference.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3122 With a prefix argument, go back that many differences."
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3123 (interactive "P")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3124 (if (> ediff-current-difference -1)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3125 (let ((n (max -1 (- ediff-current-difference (if arg arg 1))))
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
3126 buffer-read-only)
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3127
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3128 (while (and (funcall ediff-skip-diff-region-function n)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3129 (> n -1))
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
3130 (setq n (1- n)))
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3131 (ediff-unselect-and-select-difference n)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3132 ;; possibly skip inessential difference regions
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3133 (while (and ediff-ignore-similar-regions
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3134 (> n -1)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3135 (ediff-no-fine-diffs n))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3136 (setq n (1- n))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3137 (ediff-unselect-and-select-difference n))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3138 ) ;; let
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3139 (error "At beginning of the difference list.")))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3140
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3141 (defun ediff-jump-to-difference (difference-number)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3142 "Go to the difference specified as a prefix argument."
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3143 (interactive "p")
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
3144 (let (buffer-read-only)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3145 (setq difference-number (1- difference-number))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3146 (if (and (>= difference-number -1)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3147 (< difference-number (1+ ediff-number-of-differences)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3148 (ediff-unselect-and-select-difference difference-number)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3149 (error "Bad difference number"))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3150
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3151 (defun ediff-jump-to-difference-at-point ()
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3152 "Go to the difference closest to the point in buffer A or B.
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3153 If this command is invoked via `\\[ediff-jump-to-difference-at-point]'
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
3154 then the point in buffer B is used.
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
3155 Otherwise, buffer A's point is used."
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3156 (interactive)
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
3157 (let ((buf-type (ediff-char-to-buftype last-command-char))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
3158 buffer-read-only)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3159 (ediff-jump-to-difference (ediff-diff-at-point buf-type))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3160
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3161
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3162 ;; find region "most related to the current point position
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3163
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3164 (defun ediff-diff-at-point (buf-type)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3165 (let ((buffer (ediff-get-buffer buf-type))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3166 (ctl-buffer ediff-control-buffer)
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3167 (max-dif-num (1- ediff-number-of-differences))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3168 (diff-no -1)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3169 (prev-beg 0)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3170 (prev-end 0)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3171 (beg 0)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3172 (end 0))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3173
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
3174 (ediff-eval-in-buffer
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3175 buffer
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3176 (while (and (or (< (point) prev-beg) (> (point) beg))
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
3177 (< diff-no max-dif-num))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3178 (setq diff-no (1+ diff-no))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3179 (setq prev-beg beg
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3180 prev-end end)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3181 (setq beg (ediff-get-diff-posn buf-type 'beg diff-no ctl-buffer)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3182 end (ediff-get-diff-posn buf-type 'end diff-no ctl-buffer))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3183 )
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3184
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3185 (if (< (abs (- (point) prev-end))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3186 (abs (- (point) beg)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3187 diff-no
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3188 (1+ diff-no)) ;; jump-to-diff works with diff nums higher by 1
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3189 )))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3190
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3191 ;;; Copying diffs.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3192
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3193 (defun ediff-diff-to-diff (arg)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3194 "Copy buffer-A'th diff to buffer B.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3195 If numerical prefix argument, copy this diff specified in the arg.
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
3196 Otherwise, copy the difference given by `ediff-current-difference'."
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3197 (interactive "P")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3198 (if arg
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3199 (ediff-jump-to-difference arg))
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
3200 (let* ((key1 (aref (this-command-keys) 0))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3201 (key2 (aref (this-command-keys) 1))
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
3202 (char1 (if (ediff-if-lucid) (event-key key1) key1))
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
3203 (char2 (if (ediff-if-lucid) (event-key key2) key2)))
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
3204 (ediff-copy-diff ediff-current-difference
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
3205 (ediff-char-to-buftype char1)
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
3206 (ediff-char-to-buftype char2))
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
3207 (ediff-recenter 'no-rehighlight)))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3208
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3209
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3210 (defun ediff-copy-diff (n from-buf-type to-buf-type)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3211 "Copy diff N from FROM-BUF-TYPE \(given as 'A or 'B\) to TO-BUF-TYPE."
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3212 (let* ((to-buf (ediff-get-buffer to-buf-type))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3213 (from-buf (ediff-get-buffer from-buf-type))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3214 (ctrl-buf ediff-control-buffer)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3215 reg-to-copy reg-to-delete
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3216 reg-to-delete-beg reg-to-delete-end)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3217
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3218 (ediff-operate-on-flags 'remove)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3219 (setq reg-to-delete-beg
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3220 (ediff-get-diff-posn to-buf-type 'beg n ctrl-buf))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3221 (setq reg-to-delete-end
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3222 (ediff-get-diff-posn to-buf-type 'end n ctrl-buf))
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
3223 (setq reg-to-copy (ediff-eval-in-buffer
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3224 from-buf
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3225 (buffer-substring (ediff-get-diff-posn
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3226 from-buf-type 'beg n ctrl-buf)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3227 (ediff-get-diff-posn
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3228 from-buf-type 'end n ctrl-buf))))
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
3229 (setq reg-to-delete (ediff-eval-in-buffer
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3230 to-buf
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3231 (buffer-substring reg-to-delete-beg
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3232 reg-to-delete-end)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3233 (setq ediff-disturbed-overlays nil) ;; clear before use
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3234
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3235 (if (string= reg-to-delete reg-to-copy)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3236 (progn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3237 (ding)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3238 (message
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3239 "Diff regions %d are identical in buffers %S and %S. Nothing copied."
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3240 (1+ n) from-buf-type to-buf-type))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3241
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3242 ;; seems ok to copy
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3243 (if (ediff-test-save-region n to-buf-type)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3244 (condition-case conds
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
3245 (progn
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
3246 (ediff-eval-in-buffer
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3247 to-buf
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3248 ;; to prevent flags from interfering if buffer is writable
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
3249 (let ((inhibit-read-only (null buffer-read-only))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
3250 before-change-function)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3251 (goto-char reg-to-delete-end)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3252 (insert-before-markers reg-to-copy)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3253 (if (ediff-if-lucid)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3254 (progn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3255 (ediff-collect-extents-lucid reg-to-delete-beg)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3256 (if (> reg-to-delete-end reg-to-delete-beg)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3257 (progn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3258 (kill-region reg-to-delete-beg
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3259 reg-to-delete-end)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3260 (if (string= reg-to-copy "")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3261 (ediff-adjust-disturbed-extents-lucid
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3262 reg-to-delete-beg)))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3263 (if (> reg-to-delete-end reg-to-delete-beg)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3264 (kill-region reg-to-delete-beg reg-to-delete-end)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3265 (ediff-move-disturbed-overlays reg-to-delete-beg)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3266 ))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3267 (ediff-save-diff-region n to-buf-type reg-to-delete))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3268 (error (message "%s %s"
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3269 (car conds)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3270 (mapconcat 'prin1-to-string (cdr conds) " "))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3271 (beep 1))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3272 )
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3273 (ediff-operate-on-flags 'insert)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3274 ))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3275
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3276 (defun ediff-save-diff-region (n buf-type reg)
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
3277 "Save Nth diff of buffer BUF-TYPE \(`A' or `B'\).
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
3278 That is to say, the Nth diff on the `ediff-killed-diffs-alist'. REG
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3279 is the region to save. It is redundant here, but is passed anyway, for
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
3280 convenience."
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3281
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3282 (let* ((n-th-diff-saved (assoc n ediff-killed-diffs-alist))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3283 (this-buf-n-th-diff-saved (assoc buf-type (cdr n-th-diff-saved))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3284
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3285 (if this-buf-n-th-diff-saved
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3286 ;; either nothing saved for n-th diff and buffer or we OK'ed
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3287 ;; overriding
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3288 (setcdr this-buf-n-th-diff-saved reg)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3289 (if n-th-diff-saved ;; n-th diff saved, but for another buffer
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3290 (nconc n-th-diff-saved (list (cons buf-type reg)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3291 (setq ediff-killed-diffs-alist ;; create record for n-th diff
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3292 (cons (list n (cons buf-type reg))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3293 ediff-killed-diffs-alist))))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3294 (message "Saved diff region #%d for buffer %S. To recover hit 'r%s'."
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3295 (1+ n) buf-type
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3296 (downcase (symbol-name buf-type)))))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3297
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3298 (defun ediff-test-save-region (n buf-type)
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
3299 "Test if saving Nth difference region of buffer BUF-TYPE is possible."
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3300 (let* ((n-th-diff-saved (assoc n ediff-killed-diffs-alist))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3301 (this-buf-n-th-diff-saved (assoc buf-type (cdr n-th-diff-saved))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3302
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3303 (if this-buf-n-th-diff-saved
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3304 (if (yes-or-no-p
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3305 (format
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3306 "You've previously copied diff region %d to buffer %S. Confirm."
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3307 (1+ n) buf-type))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3308 t
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3309 (error "Quit."))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3310 t)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3311
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3312 (defun ediff-pop-diff (n buf-type)
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
3313 "Pop last killed Nth diff region from buffer BUF-TYPE."
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3314 (let* ((n-th-record (assoc n ediff-killed-diffs-alist))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3315 (saved-rec (assoc buf-type (cdr n-th-record)))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3316 (buf (ediff-get-buffer buf-type))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3317 saved-diff reg-beg reg-end recovered)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3318
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3319 (if (cdr saved-rec)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3320 (setq saved-diff (cdr saved-rec))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3321 (if (> ediff-number-of-differences 0)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3322 (error "Nothing saved for diff %d in buffer %S." (1+ n) buf-type)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3323 (error "No differences found.")))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3324
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3325 (ediff-operate-on-flags 'remove)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3326
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3327 (setq reg-beg (ediff-get-diff-posn buf-type 'beg n ediff-control-buffer))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3328 (setq reg-end (ediff-get-diff-posn buf-type 'end n ediff-control-buffer))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3329 (setq ediff-disturbed-overlays nil) ;; clear before use
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3330
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3331 (condition-case conds
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
3332 (ediff-eval-in-buffer
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3333 buf
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3334 (let ((inhibit-read-only (null buffer-read-only))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3335 (before-change-function nil))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3336 (goto-char reg-end)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3337 (insert-before-markers saved-diff)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3338
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3339 (if (ediff-if-lucid)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3340 (progn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3341 (ediff-collect-extents-lucid reg-beg)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3342 (if (> reg-end reg-beg)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3343 (progn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3344 (kill-region reg-beg reg-end)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3345 (if (string= saved-diff "")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3346 (ediff-adjust-disturbed-extents-lucid reg-beg)))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3347 (if (> reg-end reg-beg)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3348 (kill-region reg-beg reg-end)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3349 (ediff-move-disturbed-overlays reg-beg)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3350
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3351 (setq recovered t)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3352 ))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3353 (error (message "%s %s"
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3354 (car conds)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3355 (mapconcat 'prin1-to-string (cdr conds) " "))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3356 (beep 1)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3357
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3358 (ediff-operate-on-flags 'insert)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3359 (if recovered
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3360 (progn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3361 (setq n-th-record (delq saved-rec n-th-record))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3362 (message "Restored diff region %d in buffer %S." (1+ n) buf-type)))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3363 ))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3364
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3365 (defun ediff-restore-diff (arg)
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
3366 "Restore ARGth diff from `ediff-killed-diffs-alist'.
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
3367 ARG is a prefix argument. If ARG is nil, restore current-difference."
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3368 (interactive "P")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3369 (if arg
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3370 (ediff-jump-to-difference arg))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3371 (ediff-pop-diff ediff-current-difference
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3372 (ediff-char-to-buftype last-command-char))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3373 (ediff-recenter 'no-rehighlight))
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
3374
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
3375 (defun ediff-toggle-regexp-match ()
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3376 "Toggle focus on difference regions that match a regexp or hide those diffs."
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
3377 (interactive)
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
3378 (let (regexp-A regexp-B)
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
3379 (cond
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
3380 ((or (and (eq ediff-skip-diff-region-function 'ediff-focus-on-regexp-matches)
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
3381 (eq last-command-char ?f))
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
3382 (and (eq ediff-skip-diff-region-function 'ediff-hide-regexp-matches)
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
3383 (eq last-command-char ?h)))
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3384 (message "Selective browsing by regexp turned off.")
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
3385 (setq ediff-skip-diff-region-function 'ediff-show-all-diffs))
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
3386 ((eq last-command-char ?h)
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
3387 (setq ediff-skip-diff-region-function 'ediff-hide-regexp-matches
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
3388 regexp-A
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
3389 (read-string
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
3390 (format
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
3391 "Ignore A-regions matching this regexp (default \"%s\"): "
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
3392 (regexp-quote ediff-regexp-hide-A)))
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
3393 regexp-B
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
3394 (read-string
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
3395 (format
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
3396 "Ignore B-regions matching this regexp (default \"%s\"): "
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
3397 (regexp-quote ediff-regexp-hide-B))))
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
3398 (message "Hide difference regions matching regexp.")
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
3399 (or (string= regexp-A "") (setq ediff-regexp-hide-A regexp-A))
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
3400 (or (string= regexp-B "") (setq ediff-regexp-hide-B regexp-B)))
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
3401 ((eq last-command-char ?f)
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
3402 (setq ediff-skip-diff-region-function 'ediff-focus-on-regexp-matches
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
3403 regexp-A
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
3404 (read-string
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
3405 (format
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
3406 "Focus on A-regions matching this regexp (default \"%s\"): "
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
3407 (regexp-quote ediff-regexp-focus-A)))
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
3408 regexp-B
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
3409 (read-string
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
3410 (format
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
3411 "Focus on B-regions matching this regexp (default \"%s\"): "
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
3412 (regexp-quote ediff-regexp-focus-B))))
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
3413 (message "Focus on difference regions matching regexp.")
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
3414 (or (string= regexp-A "") (setq ediff-regexp-focus-A regexp-A))
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
3415 (or (string= regexp-B "") (setq ediff-regexp-focus-B regexp-B))))))
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3416
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3417 (defun ediff-toggle-skip-similar ()
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3418 (interactive)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3419 (setq ediff-ignore-similar-regions (not ediff-ignore-similar-regions))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3420 (if ediff-ignore-similar-regions
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3421 (message "Skipping over regions that differ only in white space & line breaks.")
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3422 (message "Skipping over white-space differences turned off.")))
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
3423
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
3424 (defun ediff-show-all-diffs (n)
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
3425 "Don't skip difference regions."
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
3426 nil)
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3427
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
3428 (defun ediff-focus-on-regexp-matches (n)
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
3429 "Focus on diffs that match regexp `ediff-regexp-focus-A/B'.
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
3430 Regions to be ignored according to this function are those where
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
3431 buf A region doesn't match `ediff-regexp-focus-A' and buf B region
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
3432 doesn't match `ediff-regexp-focus-B'.
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3433 This function returns nil if the region number N (specified as
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3434 an argument) is not to be ignored and t if region N is to be ignored.
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3435
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3436 N is a region number used by Ediff internally. It is 1 less
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3437 the number seen by the user."
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
3438 (if (and (>= n 0) (< n ediff-number-of-differences))
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
3439 (let* ((ctl-buf ediff-control-buffer)
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3440 (regex-A ediff-regexp-focus-A)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3441 (regex-B ediff-regexp-focus-B)
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3442 (reg-A-match (ediff-eval-in-buffer
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
3443 ediff-A-buffer
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
3444 (goto-char (ediff-get-diff-posn 'A 'beg n ctl-buf))
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
3445 (re-search-forward
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3446 regex-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
3447 (ediff-get-diff-posn 'A 'end n ctl-buf)
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
3448 t)))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3449 (reg-B-match (ediff-eval-in-buffer
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
3450 ediff-B-buffer
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
3451 (goto-char (ediff-get-diff-posn 'B 'beg n ctl-buf))
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
3452 (re-search-forward
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3453 regex-B
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3454 (ediff-get-diff-posn 'B 'end n ctl-buf)
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
3455 t))))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3456 (not (and reg-A-match reg-B-match)))))
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
3457
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
3458 (defun ediff-hide-regexp-matches (n)
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
3459 "Hide diffs that match regexp `ediff-regexp-hide-A/B'.
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
3460 Regions to be ignored are those where buf A region matches
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
3461 `ediff-regexp-hide-A' and buf B region matches `ediff-regexp-hide-B'.
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3462 This function returns nil if the region number N (specified as
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3463 an argument) is not to be ignored and t if region N is to be ignored.
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3464
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3465 N is a region number used by Ediff internally. It is 1 less
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3466 the number seen by the user."
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
3467 (if (and (>= n 0) (< n ediff-number-of-differences))
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
3468 (let* ((ctl-buf ediff-control-buffer)
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3469 (regex-A ediff-regexp-hide-A)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3470 (regex-B ediff-regexp-hide-B)
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3471 (reg-A-match (ediff-eval-in-buffer
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
3472 ediff-A-buffer
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
3473 (goto-char (ediff-get-diff-posn 'A 'beg n ctl-buf))
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
3474 (re-search-forward
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3475 regex-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
3476 (ediff-get-diff-posn 'A 'end n ctl-buf)
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
3477 t)))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3478 (reg-B-match (ediff-eval-in-buffer
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
3479 ediff-B-buffer
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
3480 (goto-char (ediff-get-diff-posn 'B 'beg n ctl-buf))
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
3481 (re-search-forward
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3482 regex-B
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3483 (ediff-get-diff-posn 'B 'end n ctl-buf)
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
3484 t))))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3485 (and reg-A-match reg-B-match))))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3486
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3487
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3488 ;;; Quitting, suspending, etc.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3489 (defun ediff-quit ()
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3490 "Finish an Ediff session and exit Ediff.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3491 Unselects the selected difference, if any, restores the read-only and modified
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3492 flags of the compared file buffers, kills Ediff buffers for this session
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3493 \(but not file-A and file-B\)."
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3494 (interactive)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3495 (if (prog1
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3496 (y-or-n-p "Do you really want to exit Ediff? ")
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3497 (message ""))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3498 (ediff-really-quit)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3499
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3500
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3501 ;; Perform the quit operations.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3502 (defun ediff-really-quit ()
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3503 (setq ediff-help-message ediff-help-message-long)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3504 (ediff-restore-buffer-characteristics t) ;; restore as they were at setup
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3505 (ediff-unhighlight-diffs-totally)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3506 (ediff-clear-diff-vector ediff-difference-vector 'fine-diffs-also)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3507 (if ediff-temp-file-A (delete-file ediff-temp-file-A))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3508 (if ediff-temp-file-B (delete-file ediff-temp-file-B))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3509
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3510 ;; restore buffer mode line id's in buffer-A/B
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3511 (let ((control-buffer ediff-control-buffer))
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3512 (condition-case nil
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3513 (ediff-eval-in-buffer
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
3514 ediff-A-buffer
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
3515 (setq before-change-function nil)
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3516 (setq ediff-this-buffer-control-sessions
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
3517 (delq control-buffer ediff-this-buffer-control-sessions))
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
3518 (if (null ediff-this-buffer-control-sessions)
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
3519 (setq local-write-file-hooks
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3520 (delq 'ediff-block-write-file local-write-file-hooks)))
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
3521 (kill-local-variable 'ediff-local-checkout-flag)
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
3522 (kill-local-variable 'mode-line-buffer-identification))
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
3523 (error))
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
3524
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
3525 (condition-case nil
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3526 (ediff-eval-in-buffer
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
3527 ediff-B-buffer
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
3528 (setq ediff-this-buffer-control-sessions
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
3529 (delq control-buffer ediff-this-buffer-control-sessions))
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
3530 (if (null ediff-this-buffer-control-sessions)
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
3531 (setq local-write-file-hooks
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3532 (delq 'ediff-block-write-file local-write-file-hooks)))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3533 (setq before-change-function nil)
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
3534 (kill-local-variable 'ediff-local-checkout-flag)
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
3535 (kill-local-variable 'mode-line-buffer-identification))
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
3536 (error)))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3537
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3538 (run-hooks 'ediff-quit-hooks))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3539
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3540 (defun ediff-kill-buffer-carefully (buf)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3541 "Kill buffer BUF if it exists."
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3542 (if (ediff-buffer-live-p buf)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3543 (kill-buffer (get-buffer buf))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3544
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3545 ;; The default way of quitting Ediff.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3546 ;; Kills control buffers and leaves the
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3547 ;; frame split between the two diff'ed files.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3548 (defun ediff-default-quit-hook ()
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3549 (let ((buff-A ediff-A-buffer)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3550 (buff-B ediff-B-buffer))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3551 (ediff-kill-buffer-carefully ediff-diff-buffer)
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3552 (ediff-kill-buffer-carefully ediff-fine-diff-buffer)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3553 (ediff-kill-buffer-carefully ediff-tmp-buffer)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3554 (ediff-kill-buffer-carefully ediff-error-buffer)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3555 (ediff-kill-buffer-carefully ediff-control-buffer)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3556 (ediff-kill-buffer-carefully ediff-patch-diagnostics)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3557 (delete-other-windows)
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
3558
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
3559 ;; display only if not visible
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
3560 (condition-case nil
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
3561 (or (ediff-get-visible-buffer-window buff-B)
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3562 (switch-to-buffer buff-B))
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
3563 (error))
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
3564 (condition-case nil
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
3565 (or (ediff-get-visible-buffer-window buff-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
3566 (progn
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
3567 (if (ediff-get-visible-buffer-window buff-B)
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3568 (split-window-vertically))
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
3569 (switch-to-buffer buff-A)))
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
3570 (error))
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
3571 (message "")
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
3572 ))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3573
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3574 ;; The default way of suspending Ediff.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3575 ;; Buries Ediff buffers, kills all windows.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3576 (defun ediff-default-suspend-hook ()
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3577 (let ((buf-A ediff-A-buffer)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3578 (buf-B ediff-B-buffer)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3579 (buf-patch ediff-patch-buf)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3580 (buf-patch-diag ediff-patch-diagnostics)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3581 (buf-err ediff-error-buffer)
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3582 (buf-diff ediff-diff-buffer)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3583 (buf-fine-diff ediff-fine-diff-buffer))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3584 (bury-buffer) ;; ediff-control-buffer
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3585 (delete-other-windows)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3586 (bury-buffer buf-err)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3587 (bury-buffer buf-diff)
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3588 (bury-buffer buf-fine-diff)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3589 (bury-buffer buf-patch)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3590 (bury-buffer buf-patch-diag)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3591 (bury-buffer buf-A)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3592 (bury-buffer buf-B)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3593
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3594
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3595 (defun ediff-suspend ()
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
3596 "Suspend Ediff.
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
3597 To resume, switch to the appropriate `Ediff Control Panel'
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
3598 buffer and then type \\[ediff-recenter]. Ediff will automatically set
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3599 up an appropriate window config."
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3600 (interactive)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3601 (let ((key (substitute-command-keys "\\[ediff-recenter]")))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3602 (run-hooks 'ediff-suspend-hooks)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3603 (message
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
3604 "To resume Ediff, switch to Ediff Control Panel and hit '%S'" key)))
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
3605
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
3606
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
3607 (defun ediff-status-info ()
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3608 "Show the names of the buffers or files being operated on by Ediff.
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
3609 Hit \\[ediff-recenter] to reset the windows afterward."
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3610 (interactive)
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
3611 (with-output-to-temp-buffer " *ediff-info*"
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
3612 (princ (ediff-version))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
3613 (princ "\n\n")
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
3614 (ediff-eval-in-buffer ediff-A-buffer
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3615 (if buffer-file-name
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3616 (princ
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3617 (format "File A is: %s\n" buffer-file-name))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3618 (princ
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3619 (format "Buffer A is: %s\n" (buffer-name)))))
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
3620 (ediff-eval-in-buffer ediff-B-buffer
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3621 (if buffer-file-name
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3622 (princ
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3623 (format "File B is: %s\n" buffer-file-name))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3624 (princ
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3625 (format "Buffer B is: %s\n" (buffer-name)))))
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
3626
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
3627 (let* ((A-line (ediff-eval-in-buffer ediff-A-buffer
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
3628 (count-lines (point-min) (point))))
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
3629 (B-line (ediff-eval-in-buffer ediff-B-buffer
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
3630 (count-lines (point-min) (point)))))
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
3631 (princ (format "\nPoint position in buffer A = %d\n" A-line))
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
3632 (princ (format "Point position in buffer B = %d\n" B-line)))
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
3633
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3634 (princ (format "\nCurrent difference number = %S\n"
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3635 (cond ((< ediff-current-difference 0) 'start)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3636 ((>= ediff-current-difference
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3637 ediff-number-of-differences) 'end)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3638 (t (1+ ediff-current-difference)))))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3639
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3640 (cond (ediff-ignore-similar-regions
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3641 (princ "\nSkipping over regions that differ only in white space & line breaks."))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3642 (t
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3643 (princ "\nNo skipping over regions that differ in white space & line breaks.")))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3644
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
3645 (cond ((eq ediff-skip-diff-region-function 'ediff-show-all-diffs)
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3646 (princ "\nSelective browsing by regexp is off.\n"))
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
3647 ((eq ediff-skip-diff-region-function 'ediff-hide-regexp-matches)
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
3648 (princ
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3649 "\nIgnoring regions that match")
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
3650 (princ
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3651 (format "\n\t regexp `%s' in buffer A and\n\t regexp `%s' in buffer B\n"
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
3652 ediff-regexp-hide-A ediff-regexp-hide-B)))
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
3653 ((eq ediff-skip-diff-region-function 'ediff-focus-on-regexp-matches)
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
3654 (princ
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3655 "\nFocusing on regions that match")
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
3656 (princ
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3657 (format "\n\t regexp `%s' in buffer A and\n\t regexp `%s' in buffer B\n"
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3658 ediff-regexp-focus-A ediff-regexp-focus-B)))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3659 (t (princ "\nSelective browsing via a user-defined method.\n")))
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
3660
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
3661 (princ "\nBugs: M-x ediff-submit-report")
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3662 ))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3663
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3664
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3665
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3666 ;;; Support routines
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3667
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3668 ;; Select a difference by placing the ASCII flags around the appropriate
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3669 ;; group of lines in the A, B buffers
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3670 (defun ediff-select-difference (n)
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
3671 (if (and (ediff-buffer-live-p ediff-A-buffer)
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
3672 (ediff-buffer-live-p ediff-B-buffer)
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
3673 (>= n 0) (< n ediff-number-of-differences))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3674 (progn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3675 (ediff-remember-buffer-characteristics)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3676 (if (and window-system ediff-want-faces)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3677 (progn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3678 (ediff-highlight-diff n)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3679 (setq ediff-highlighting-style 'face))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3680 (setq ediff-highlighting-style 'ascii)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3681 (ediff-place-flags-in-buffer 'A ediff-A-buffer
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3682 ediff-control-buffer n)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3683 (ediff-place-flags-in-buffer 'B ediff-B-buffer
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3684 ediff-control-buffer n))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3685
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3686 (cond ((eq ediff-auto-refine 'on)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3687 (if (and
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3688 (> ediff-auto-refine-limit
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3689 (- (ediff-get-diff-posn 'A 'end n)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3690 (ediff-get-diff-posn 'A 'beg n)))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3691 (> ediff-auto-refine-limit
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3692 (- (ediff-get-diff-posn 'B 'end n)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3693 (ediff-get-diff-posn 'B 'beg n))))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3694 (ediff-make-fine-diffs n 'noforce)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3695 (ediff-make-fine-diffs n 'skip)))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3696
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3697 ((eq ediff-auto-refine 'off) ; highlight iff fine diffs
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3698 (ediff-make-fine-diffs n 'skip))) ; already exist
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3699
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3700 (ediff-restore-buffer-characteristics)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3701 (run-hooks 'ediff-select-hooks))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3702
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3703
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3704 ;; Unselect a difference by removing the ASCII flags in the buffers.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3705 (defun ediff-unselect-difference (n)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3706 (if (and (>= n 0) (< n ediff-number-of-differences))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3707 (progn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3708 (ediff-remember-buffer-characteristics)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3709
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3710 (cond ((and window-system ediff-want-faces)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3711 (ediff-unhighlight-diff))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3712 ((eq ediff-highlighting-style 'ascii)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3713 (ediff-remove-flags-from-buffer
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3714 ediff-A-buffer
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3715 (ediff-get-diff-posn 'A 'beg n)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3716 (ediff-get-diff-posn 'A 'end n)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3717 ediff-before-flag-A ediff-after-flag-A)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3718 (ediff-remove-flags-from-buffer
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3719 ediff-B-buffer
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3720 (ediff-get-diff-posn 'B 'beg n)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3721 (ediff-get-diff-posn 'B 'end n)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3722 ediff-before-flag-B ediff-after-flag-B)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3723
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3724 (ediff-restore-buffer-characteristics)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3725 (setq ediff-highlighting-style nil)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3726
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3727 ;; unhighlight fine diffs
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
3728 (ediff-set-fine-diff-properties ediff-current-difference 'default)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3729
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3730 (run-hooks 'ediff-unselect-hooks))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3731
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3732
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3733 ;; Unselects prev diff and selects a new one, if FLAG has value other than
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3734 ;; 'select-only or 'unselect-only. If FLAG is 'select-only, the
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3735 ;; next difference is selected, but the current selection is not
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3736 ;; unselected. If FLAG is 'unselect-only then the current selection is
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3737 ;; unselected, but the next one is not selected. If NO-RECENTER is non-nil,
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3738 ;; don't recenter buffers after selecting/unselecting.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3739 ;;
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
3740 ;; Don't use `ediff-select-difference' and `ediff-unselect-difference'
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
3741 ;; directly, since this will screw up the undo info in the presence of
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3742 ;; ASCII flags.
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
3743 ;; Instead, use `ediff-unselect-and-select-difference' with appropriate
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3744 ;; flags.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3745
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3746 (defun ediff-unselect-and-select-difference (n &optional flag no-recenter)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3747 (let (;; save buf modified info
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3748 (control-buf ediff-control-buffer)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3749 (buf-A-modified (buffer-modified-p ediff-A-buffer))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3750 (buf-B-modified (buffer-modified-p ediff-B-buffer))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3751 ;; temporarily disable undo so highlighting won't confuse the user
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3752 buf-A-undo buf-B-undo)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3753
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3754 (let ((ediff-current-difference n))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3755 (or no-recenter
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3756 (ediff-recenter 'no-rehighlight)))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3757
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
3758 (if (and (ediff-buffer-live-p ediff-A-buffer)
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
3759 (ediff-buffer-live-p ediff-B-buffer))
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
3760 (progn
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
3761 (ediff-eval-in-buffer
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
3762 ediff-A-buffer
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
3763 (setq buf-A-undo buffer-undo-list))
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
3764 (ediff-eval-in-buffer
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
3765 ediff-B-buffer
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
3766 (setq buf-B-undo buffer-undo-list))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3767
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
3768 (buffer-disable-undo ediff-A-buffer)
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
3769 (buffer-disable-undo ediff-B-buffer)))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3770
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3771 (unwind-protect ;; we don't want to lose undo info due to error
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3772 (progn
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3773 (or (eq flag 'select-only)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3774 (ediff-unselect-difference ediff-current-difference))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3775
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3776 ;; Auto-save buffers while Ediff flags are temporarily removed.
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
3777 (ediff-eval-in-buffer
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3778 ediff-A-buffer
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3779 (if buf-A-modified
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3780 (do-auto-save)))
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
3781 (ediff-eval-in-buffer
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3782 ediff-B-buffer
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3783 (if buf-B-modified
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3784 (do-auto-save)))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3785
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3786 (or (eq flag 'unselect-only)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3787 (ediff-select-difference n))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3788 (setq ediff-current-difference n)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3789 ) ;; end protected section
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3790
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
3791 (ediff-eval-in-buffer
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3792 control-buf
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
3793 (ediff-refresh-mode-line)
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
3794 ;; restore undo and buffer-modified info
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
3795 (ediff-eval-in-buffer
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
3796 ediff-A-buffer
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
3797 (set-buffer-modified-p buf-A-modified)
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
3798 (setq buffer-undo-list buf-A-undo)))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3799
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
3800 (ediff-eval-in-buffer
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3801 control-buf
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
3802 (ediff-eval-in-buffer
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
3803 ediff-B-buffer
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
3804 (set-buffer-modified-p buf-B-modified)
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
3805 (setq buffer-undo-list buf-B-undo)))
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
3806 )))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3807
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3808 ;; Revise the mode line to display which difference we have selected
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3809
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3810 (defun ediff-refresh-mode-line ()
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3811 (setq mode-line-buffer-identification
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3812 (cond ((< ediff-current-difference 0)
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3813 (list (format "%%b: At start of %d diffs"
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3814 ediff-number-of-differences)))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3815 ((>= ediff-current-difference ediff-number-of-differences)
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
3816 (list (format "%%b: At end of %d diffs"
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3817 ediff-number-of-differences)))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3818 (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
3819 (list (format "%%b: diff %d of %d"
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3820 (1+ ediff-current-difference)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3821 ediff-number-of-differences)))))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3822 ;; Force mode-line redisplay
8348
bf950cbd542c Made menu bar's autoloaded stuff conditional on
Richard M. Stallman <rms@gnu.org>
parents: 8303
diff changeset
3823 (force-mode-line-update))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3824
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3825
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3826
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3827 ;; Verify that we have a difference selected.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3828 (defun ediff-validate-difference ()
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3829 (if (not (and (>= ediff-current-difference 0)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3830 (< ediff-current-difference ediff-number-of-differences)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3831 (error "No difference selected")))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3832
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
3833 (defun ediff-read-file-name (prompt default-dir default-file)
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
3834 ; This is a modified version of a similar function in `emerge.el'.
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3835 ; PROMPT should not have trailing ': ', so that it can be modified
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3836 ; according to context.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3837 ; If default-file is set, it should be used as the default value.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3838 ; If default-dir is non-nil, use it as the default directory.
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
3839 ; Otherwise, use the value of Emacs' variable `default-directory.'
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
3840
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
3841 ;; hack default-dir if it is not set
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
3842 (setq default-dir
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
3843 (file-name-as-directory
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
3844 (abbreviate-file-name
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3845 (expand-file-name (or default-dir
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
3846 (and default-file
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3847 (file-name-directory default-file))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3848 default-directory)))))
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
3849
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
3850 ;; strip the directory from default-file
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3851 (if default-file
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3852 (setq default-file (file-name-nondirectory default-file)))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3853
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3854 (let (f)
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
3855 (setq f (expand-file-name
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3856 (read-file-name
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3857 (format "%s%s: "
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
3858 prompt
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
3859 (if default-file
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3860 (concat " (default " default-file ")")
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3861 ""))
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
3862 default-dir
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
3863 default-file
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3864 'confirm
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
3865 default-file
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3866 )
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
3867 default-dir
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
3868 ))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3869 ;; If user enters a directory name, expand the default file in that
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3870 ;; directory. This allows the user to enter a directory name for the
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
3871 ;; B-file and diff against the default-file in that directory instead
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
3872 ;; of a DIRED listing!
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
3873 (if (and (file-directory-p f) default-file)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3874 (setq f (expand-file-name
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
3875 (file-name-nondirectory default-file) f)))
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
3876 f))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3877
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3878 ;; If `prefix' is given, then it is used as a prefix for the temp file
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3879 ;; name. Otherwise, `.buffer-name' is used. If `file' is given, use this
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3880 ;; file and don't create a new one.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3881 (defun ediff-make-temp-file (&optional prefix given-file)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3882 (let ((f (or given-file
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3883 (make-temp-name (concat
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3884 ediff-temp-file-prefix
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3885 (or prefix
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3886 (format
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3887 ".%s"
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
3888 "buf")))))))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3889 ;; create the file
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3890 (write-region (point-min) (point-max) f nil 'no-message)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3891 (set-file-modes f ediff-temp-file-mode)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3892 f))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3893
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3894 ;; Quote metacharacters (using \) when executing diff in Unix, but not in
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3895 ;; EMX OS/2
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3896 (defun ediff-protect-metachars (str)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3897 (or (eq system-type 'emx)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3898 (let ((limit 0))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3899 (while (string-match emerge-metachars str limit)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3900 (setq str (concat (substring str 0 (match-beginning 0))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3901 "\\"
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3902 (substring str (match-beginning 0))))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3903 (setq limit (1+ (match-end 0))))))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3904 str)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3905
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
3906 ;; Make sure the current buffer (for a file) has the same contents as the
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
3907 ;; file on disk, and attempt to remedy the situation if not.
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
3908 ;; Signal an error if we can't make them the same, or the user doesn't want
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
3909 ;; to do what is necessary to make them the same.
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
3910 ;; If file has file handlers (indicated by the optional arg), then we
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
3911 ;; offer to instead of saving. This is one difference with Emerge.
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
3912 ;; Another is that we always offer to revert obsolete files, whether they
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
3913 ;; are modified or not.
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
3914 (defun ediff-verify-file-buffer (&optional file-magic)
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3915 ;; First check if the file has been modified since the buffer visited it.
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
3916 (if (verify-visited-file-modtime (current-buffer))
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
3917 (if (buffer-modified-p)
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
3918 ;; If buffer is not obsolete and is modified, offer to save
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
3919 (if (yes-or-no-p
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
3920 (format "Buffer out of sync with visited file. %s file %s? "
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
3921 (if file-magic "Revert" "Save")
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
3922 buffer-file-name))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3923 (if (not file-magic)
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3924 (save-buffer)
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
3925 ;; for some reason, file-name-handlers append instead of
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
3926 ;; replacing, so we have to erase first.
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
3927 (erase-buffer)
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
3928 (revert-buffer t t))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3929 (error "Buffer out of sync for file %s" buffer-file-name))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3930 ;; If buffer is not obsolete and is not modified, do nothing
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
3931 nil)
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3932 ;; If buffer is obsolete, offer to revert
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
3933 (if (yes-or-no-p
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
3934 (format "Buffer out of sync with visited file. Revert file %s? "
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
3935 buffer-file-name))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3936 (progn
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
3937 (if file-magic
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3938 (erase-buffer))
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
3939 (revert-buffer t t))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3940 (error "Buffer out of sync for file %s" buffer-file-name))))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
3941
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
3942
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3943 (defun ediff-block-write-file ()
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3944 "Prevent writing files A and B directly."
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3945 (if (ediff-check-for-ascii-flags)
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
3946 (error "Type 'wa' and 'wb' in Ediff Control Panel to save buffs A/B.")))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3947
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3948 (defun ediff-check-for-ascii-flags ()
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3949 (eval
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3950 (cons 'or
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3951 (mapcar (function (lambda (buf)
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
3952 (if (ediff-buffer-live-p buf)
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
3953 (ediff-eval-in-buffer
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
3954 buf
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
3955 (eq ediff-highlighting-style 'ascii)))))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3956 ediff-this-buffer-control-sessions))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3957
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3958 (defun ediff-insert-in-front (overl beg end)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3959 "Capture overlays that had insertions in the front.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3960 Called when overlay OVERL gets insertion in front."
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3961 (if (ediff-overlay-get overl 'ediff-diff-num)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3962 (setq ediff-disturbed-overlays
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3963 (cons overl ediff-disturbed-overlays)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3964 )
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3965
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3966 (defun ediff-collect-extents-lucid (pos)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3967 "Collects all extents at POS having property `ediff-diff-num'.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3968 Lucid Emacs causes headache by detaching empty extents, so I have to save
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3969 them before they disappear."
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3970 (let (lis elt)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3971 (while (setq elt (extent-at pos nil 'ediff-diff-num elt))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3972 (setq lis (cons elt lis)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3973 (setq ediff-disturbed-overlays lis)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3974
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3975 (defun ediff-move-disturbed-overlays (posn)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3976 (mapcar (function (lambda (overl)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3977 (ediff-move-overlay overl
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3978 posn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3979 (ediff-overlay-end overl))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3980 ))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3981 ediff-disturbed-overlays)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3982 (setq ediff-disturbed-overlays nil))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3983
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3984 (defun ediff-adjust-disturbed-extents-lucid (posn &optional posn-type)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3985 ;; POSN-TYPE tells if POSN should become a new start of the extents
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3986 ;; (if 'new-start) or a new end (if 'new-end). If POSN-TYPE is nil, then
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3987 ;; POSN is both the new start and the new end.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3988 (mapcar (function (lambda (overl)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3989 (cond ((and (null posn-type)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3990 (equal (ediff-overlay-start overl)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3991 (ediff-overlay-end overl)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3992 (ediff-move-overlay overl posn posn))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3993
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3994 (posn-type
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3995 (ediff-move-overlay
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3996 overl
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3997 (if (eq posn-type 'new-start)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3998 posn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3999 (ediff-overlay-start overl))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4000 (if (eq posn-type 'new-end)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4001 posn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4002 (ediff-overlay-end overl)))))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4003 ediff-disturbed-overlays)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4004 (setq ediff-disturbed-overlays nil))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4005
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4006 (defun ediff-save-buffer ()
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4007 "Safe way of saving buffers A, B, and the diff output.
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4008 `wa' saves buffer A, `wb' saves buffer B, and `wf' saves the diff output."
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4009 (interactive)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4010 (let ((hooks local-write-file-hooks))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4011 (ediff-unselect-and-select-difference ediff-current-difference
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4012 'unselect-only)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4013 (unwind-protect
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
4014 (ediff-eval-in-buffer
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4015 (cond ((eq last-command-char ?a)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4016 ediff-A-buffer)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4017 ((eq last-command-char ?b)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4018 ediff-B-buffer)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4019 ((eq last-command-char ?f)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4020 (message "Saving diff output ...")(sit-for 1)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4021 ediff-diff-buffer))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4022 ;; temporarily remove writing block
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4023 (setq hooks (delq 'ediff-block-write-file hooks))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4024 (let ((local-write-file-hooks hooks))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4025 (save-buffer)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4026 (ediff-unselect-and-select-difference ediff-current-difference
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4027 'select-only)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4028 )))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4029
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4030
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4031
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
4032 ;; Essentially `emerge-remove-flags-in-buffer', modified to allow deletion
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
4033 ;; of read-only flags.
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4034 (defun ediff-remove-flags-from-buffer (buffer before-posn after-posn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4035 before-flag after-flag)
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
4036 (ediff-eval-in-buffer
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4037 buffer
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4038 (let ((before-flag-length (length before-flag))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4039 (after-flag-length (length after-flag))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4040 (inhibit-read-only t)
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4041 buffer-read-only
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4042 before-change-function)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4043 (goto-char after-posn)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4044 (setq after-posn (point-marker)) ;; after-posn is now a marker
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4045 ;; remove the flags, if they're there
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4046 (goto-char (- before-posn before-flag-length))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4047 (if (ediff-if-lucid)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4048 (ediff-collect-extents-lucid (+ (point) before-flag-length)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4049 (if (looking-at (regexp-quote before-flag))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4050 (delete-region (point) (+ (point) before-flag-length))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4051 ;; the flag isn't there
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4052 (ding)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4053 (message "Trouble removing ASCII flag"))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4054 (if (ediff-if-lucid)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4055 (ediff-adjust-disturbed-extents-lucid (point)))
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
4056
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4057 (if (ediff-if-lucid)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4058 (ediff-collect-extents-lucid (point)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4059 (goto-char after-posn)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4060 (if (looking-at (regexp-quote after-flag))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4061 (delete-region (point) (+ (point) after-flag-length))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4062 ;; the flag isn't there
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4063 (ding)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4064 (message "Trouble removing ASCII flag"))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4065 (if (ediff-if-lucid)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4066 (ediff-adjust-disturbed-extents-lucid (point)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4067 (setq after-posn nil) ;; after has become a marker--garbage-collect
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4068 )))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4069
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4070
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
4071 ;; This is a modified `emerge-place-flags-in-buffer'.
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4072 (defun ediff-place-flags-in-buffer (buf-type buffer ctl-buffer difference)
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
4073 (ediff-eval-in-buffer
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4074 buffer
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4075 (ediff-place-flags-in-buffer1 buf-type ctl-buffer difference)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4076
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
4077 ;; Modified `emerge-place-flags-in-buffer1'.
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4078 (defun ediff-place-flags-in-buffer1 (buf-type ctl-buffer difference)
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4079 (let ((before-flag-name (if (eq buf-type 'A)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4080 'ediff-before-flag-A
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4081 'ediff-before-flag-B))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4082 (after-flag-name (if (eq buf-type 'A)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4083 'ediff-after-flag-A
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4084 'ediff-after-flag-B))
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4085 (inhibit-read-only t)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4086 buffer-read-only before-change-function beg-of-line flag)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4087
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4088 ;; insert the flag before the difference
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4089 (let ((before (ediff-get-diff-posn buf-type 'beg difference ctl-buffer)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4090 (goto-char before)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4091 (setq beg-of-line (bolp))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4092
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
4093 (setq flag (ediff-eval-in-buffer
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4094 ctl-buffer
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4095 (if beg-of-line
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4096 (set before-flag-name ediff-before-flag-bol)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4097 (set before-flag-name ediff-before-flag-mol))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4098
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4099 ;; insert the flag itself
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4100 (if (ediff-if-lucid)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4101 (ediff-collect-extents-lucid (point)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4102 (insert-before-markers flag)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4103 (if (ediff-if-lucid)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4104 ;; Lucid's extent end-points behave strangely; they won't
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4105 ;; respect insert-before-markers
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4106 (ediff-adjust-disturbed-extents-lucid (point) 'new-start))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4107 )
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4108 ;; insert the flag after the difference
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4109 (let* ((after (ediff-get-diff-posn buf-type 'end difference ctl-buffer)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4110 (goto-char after)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4111 (setq beg-of-line (bolp))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4112
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
4113 (setq flag (ediff-eval-in-buffer
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4114 ctl-buffer
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4115 (if beg-of-line
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4116 (set after-flag-name ediff-after-flag-bol)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4117 (set after-flag-name ediff-after-flag-mol))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4118
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4119 ;; insert the flag itself
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4120 (if (ediff-if-lucid)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4121 (ediff-collect-extents-lucid (point)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4122 (insert flag)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4123 (if (ediff-if-lucid)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4124 (ediff-adjust-disturbed-extents-lucid after 'new-end))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4125 )))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4126
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4127
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4128 (defun ediff-get-diff-posn (buf-type pos &optional n control-buf)
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
4129 "Returns positions of difference sectors in the BUF-TYPE buffer.
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
4130 BUF-TYPE should be a symbol--either `A' or `B'.
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
4131 POS is either `beg' or `end'--it specifies whether you want the position at the
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4132 beginning of a difference or at the end.
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4133
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
4134 The optional argument N says which difference \(default:
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
4135 `ediff-current-difference'\). The optional argument CONTROL-BUF says
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
4136 which control buffer is in effect in case it is not the current
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
4137 buffer."
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4138 (let (diff-overlay)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4139 (or control-buf
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4140 (setq control-buf (current-buffer)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4141
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
4142 (ediff-eval-in-buffer
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4143 control-buf
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4144 (or n (setq n ediff-current-difference))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4145 (if (or (< n 0) (>= n ediff-number-of-differences))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4146 (if (> ediff-number-of-differences 0)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4147 (error "There is no diff %d. Valid diffs are 1 to %d."
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4148 (1+ n) ediff-number-of-differences)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4149 (error "No differences found.")))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4150 (setq diff-overlay (ediff-get-diff-overlay n buf-type)))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4151
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4152 (if (ediff-overlay-get diff-overlay 'detached)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4153 (ediff-move-overlay diff-overlay
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4154 (ediff-overlay-get diff-overlay 'ediff-marker)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4155 (ediff-overlay-get diff-overlay 'ediff-marker)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4156 (if (eq pos 'beg)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4157 (ediff-overlay-start diff-overlay)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4158 (ediff-overlay-end diff-overlay))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4159 ))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4160
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4161
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4162
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4163 ;; These would highlight differences under X
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4164 (defun ediff-highlight-diff (n)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4165 "Put face on diff N. Invoked for X displays only."
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
4166 (let* ((last-A (ediff-eval-in-buffer ediff-A-buffer (point-max)))
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
4167 (last-B (ediff-eval-in-buffer ediff-B-buffer (point-max)))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4168 (begin-A (ediff-get-diff-posn 'A 'beg n))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4169 (end-A (ediff-get-diff-posn 'A 'end n))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4170 (xtraA (if (equal begin-A end-A) 1 0))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4171 (end-A-hilit (min last-A (+ end-A xtraA)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4172
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4173 (begin-B (ediff-get-diff-posn 'B 'beg n))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4174 (end-B (ediff-get-diff-posn 'B 'end n))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4175 (xtraB (if (equal begin-B end-B) 1 0))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4176 (end-B-hilit (min last-B (+ end-B xtraB))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4177
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4178 (if (ediff-if-lucid)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4179 (progn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4180 (ediff-move-overlay
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4181 ediff-current-diff-overlay-A begin-A end-A-hilit)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4182 (ediff-move-overlay
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4183 ediff-current-diff-overlay-B begin-B end-B-hilit))
7391
c40d16ee57bf entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 7267
diff changeset
4184 ;; Emacs 19.22 has a bug, which requires that ediff-move-overlay will
c40d16ee57bf entered into RCS
Richard M. Stallman <rms@gnu.org>
parents: 7267
diff changeset
4185 ;; have the buffer as a parameter. Believed fixed in 19.23.
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4186 (ediff-move-overlay ediff-current-diff-overlay-A
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4187 begin-A end-A-hilit ediff-A-buffer)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4188 (ediff-move-overlay ediff-current-diff-overlay-B
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4189 begin-B end-B-hilit ediff-B-buffer))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4190 ;; giving priority of 0 and then changing it may look funny, but
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4191 ;; this is intended to overcome an Emacs bug.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4192 (ediff-overlay-put ediff-current-diff-overlay-A 'priority 0)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4193 (ediff-overlay-put ediff-current-diff-overlay-B 'priority 0)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4194 (ediff-overlay-put ediff-current-diff-overlay-A 'priority
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4195 (ediff-highest-priority begin-A end-A-hilit ediff-A-buffer))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4196 (ediff-overlay-put ediff-current-diff-overlay-B 'priority
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4197 (ediff-highest-priority begin-B end-B-hilit ediff-B-buffer))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4198
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4199 (or (face-differs-from-default-p 'ediff-odd-diff-face-A-var)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4200 (not ediff-highlight-all-diffs)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4201 (progn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4202 (copy-face ediff-odd-diff-face-A 'ediff-odd-diff-face-A-var)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4203 (copy-face ediff-odd-diff-face-B 'ediff-odd-diff-face-B-var)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4204 (copy-face ediff-even-diff-face-A 'ediff-even-diff-face-A-var)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4205 (copy-face ediff-even-diff-face-B 'ediff-even-diff-face-B-var)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4206
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4207 ;; unhighlight the background overlay for the diff n so they won't
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4208 ;; interfere with the current diff overlay
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4209 (ediff-overlay-put (ediff-get-diff-overlay n 'A) 'face nil)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4210 (ediff-overlay-put (ediff-get-diff-overlay n 'B) 'face nil)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4211
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4212 ;; (sit-for 0) ;; needed synch for some reason in v19.22
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4213 ))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4214
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4215
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4216 (defun ediff-unhighlight-diff ()
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4217 "Remove overlays from buffers A and B."
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4218
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4219 (ediff-move-overlay ediff-current-diff-overlay-A 1 1)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4220 (ediff-move-overlay ediff-current-diff-overlay-B 1 1)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4221
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4222 ;; rehighlight the overlay in the background of the
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4223 ;; current difference region
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4224 (let ((overlay-A (ediff-get-diff-overlay ediff-current-difference 'A))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4225 (overlay-B (ediff-get-diff-overlay ediff-current-difference 'B)))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4226 (ediff-overlay-put overlay-A
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4227 'face (if (ediff-odd-p ediff-current-difference)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4228 'ediff-odd-diff-face-A-var
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4229 'ediff-even-diff-face-A-var))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4230 (ediff-overlay-put overlay-B
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4231 'face (if (ediff-odd-p ediff-current-difference)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4232 'ediff-odd-diff-face-B-var
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4233 'ediff-even-diff-face-B-var))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4234 ))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4235
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4236
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4237 ;; delete highlighting overlays, restore faces to their original form
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4238 (defun ediff-unhighlight-diffs-totally ()
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4239 (let (buffer-read-only)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4240 (ediff-unselect-and-select-difference -1)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4241
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4242 (if (and window-system ediff-want-faces)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4243 (let ((inhibit-quit t))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4244 (if (face-differs-from-default-p 'ediff-odd-diff-face-A-var)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4245 (progn
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4246 (copy-face 'default 'ediff-odd-diff-face-A-var)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4247 (copy-face 'default 'ediff-odd-diff-face-B-var)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4248 (copy-face 'default 'ediff-even-diff-face-A-var)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4249 (copy-face 'default 'ediff-even-diff-face-B-var)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4250 (if (ediff-overlayp ediff-current-diff-overlay-A)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4251 (ediff-delete-overlay ediff-current-diff-overlay-A))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4252 (setq ediff-current-diff-overlay-A nil)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4253 (if (ediff-overlayp ediff-current-diff-overlay-B)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4254 (ediff-delete-overlay ediff-current-diff-overlay-B))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4255 (setq ediff-current-diff-overlay-B nil)))
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4256 ))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4257
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4258 (defun ediff-clear-diff-vector (vec &optional fin-diffs-also)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4259 ;; null out the difference overlays so they won't slow down future
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4260 ;; editing operations
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4261 (mapcar (function
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4262 (lambda (elt)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4263 (ediff-delete-overlay (ediff-get-diff-overlay-from-vector elt 'A))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4264 (ediff-delete-overlay (ediff-get-diff-overlay-from-vector elt 'B))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4265 (if fin-diffs-also
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4266 (ediff-clear-diff-vector
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4267 (ediff-get-fine-diff-vector-from-vec elt)))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4268 ))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4269 vec)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4270 ;; allow them to be garbage collected
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4271 (setq vec nil))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4272
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4273 (defun ediff-operate-on-flags (action)
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
4274 "Re/unhighlights buffers A and B with all flags from all Ediff sessions.
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
4275 This is usually needed only when a
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4276 buffer is involved in multiple Ediff sessions."
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
4277 (let* ((A-sessions (ediff-eval-in-buffer
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4278 ediff-A-buffer
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4279 ediff-this-buffer-control-sessions))
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
4280 (B-sessions (ediff-eval-in-buffer
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4281 ediff-B-buffer
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4282 ediff-this-buffer-control-sessions))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4283 (sessions (ediff-union A-sessions B-sessions))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4284 (flag (if (eq action 'remove) 'unselect-only 'select-only)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4285
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4286 (mapcar (function (lambda (buf)
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
4287 (ediff-eval-in-buffer
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
4288 buf
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
4289 (or (if (eq action 'insert)
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4290 (memq ediff-highlighting-style '(ascii off))
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
4291 (not (eq ediff-highlighting-style 'ascii)))
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
4292 (ediff-unselect-and-select-difference
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
4293 ediff-current-difference
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
4294 flag 'no-recenter))
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
4295 )))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4296 sessions)))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4297
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4298
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4299
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4300 ;;; Refinement of current diff
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4301 ;; Split region along word boundaries. Each word will be on its own line.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4302 ;; Output to buffer out-buffer.
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
4303 (defun ediff-forward-word ()
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
4304 "Move point one word forward. Used for splitting diff regions into words.
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
4305 This is the default for `ediff-forward-word-function'."
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
4306 (or (> (skip-chars-forward ediff-word-1) 0)
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
4307 (> (skip-chars-forward ediff-word-2) 0)))
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
4308
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4309 (defun ediff-wordify (beg end in-buffer out-buffer)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4310 (let (sv-point string)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4311 (save-excursion
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4312 (set-buffer in-buffer)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4313 (setq string (buffer-substring beg end))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4314
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4315 (set-buffer out-buffer)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4316 (erase-buffer)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4317 (insert string)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4318 (goto-char (point-min))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4319 (skip-chars-forward ediff-whitespace)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4320 (delete-region (point-min) (point))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4321
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
4322 (while (not (eobp))
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
4323 (funcall ediff-forward-word-function)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4324 (setq sv-point (point))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4325 (skip-chars-forward ediff-whitespace)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4326 (delete-region sv-point (point))
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
4327 (insert "\n")))))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4328
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4329 ;; `n' is the diff region to work on.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4330 ;; if `flag' is 'noforce then make fine-diffs only if this region's fine
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4331 ;; diffs have not been computed before.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4332 ;; if `flag' is 'skip then don't compute fine diffs for this region.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4333 (defun ediff-make-fine-diffs (&optional n flag)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4334 (interactive)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4335 (or n (setq n ediff-current-difference))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4336
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4337 (if (< ediff-number-of-differences 1)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4338 (error "No differences found."))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4339
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4340 (or (< n 0)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4341 (>= n ediff-number-of-differences)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4342 ;; n is within the range
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4343 (let ((file-A ediff-temp-file-A)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4344 (file-B ediff-temp-file-B))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4345
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4346 (cond ((and (eq flag 'noforce) (ediff-get-fine-diff-vector n))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4347 nil)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4348 ((eq flag 'skip)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4349 (or (ediff-get-fine-diff-vector n)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4350 (eq ediff-auto-refine 'off)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4351 (message "Region %d is larger than auto-refine limit. Hit %S to force-refine."
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4352 (1+ n)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4353 (substitute-command-keys
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4354 "\\[ediff-make-fine-diffs]")
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4355 )))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4356 (t
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4357 ;; delete old fine diffs
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4358 (ediff-clear-diff-vector (ediff-get-fine-diff-vector n))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4359 ;; recompute fine diffs
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4360 (setq ediff-tmp-buffer (get-buffer-create "*ediff-tmp*"))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4361
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4362 (ediff-wordify
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4363 (ediff-get-diff-posn 'A 'beg n)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4364 (ediff-get-diff-posn 'A 'end n)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4365 ediff-A-buffer
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4366 ediff-tmp-buffer)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4367 (ediff-eval-in-buffer
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4368 ediff-tmp-buffer
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4369 (setq file-A (ediff-make-temp-file ".fine-diffs-A" file-A)))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4370
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4371 (ediff-wordify
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4372 (ediff-get-diff-posn 'B 'beg n)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4373 (ediff-get-diff-posn 'B 'end n)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4374 ediff-B-buffer
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4375 ediff-tmp-buffer)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4376 (ediff-eval-in-buffer
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4377 ediff-tmp-buffer
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4378 (setq file-B (ediff-make-temp-file ".fine-diffs-B" file-B)))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4379
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4380 ;; save temp file names.
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4381 (setq ediff-temp-file-A file-A
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4382 ediff-temp-file-B file-B)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4383
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4384 ;; set the new vector of fine diffs, if none exists
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4385 (ediff-set-fine-diff-vector
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4386 n
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4387 (ediff-setup-diff-regions file-A file-B 'use-old-diff-buf n
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4388 ediff-fine-diff-program
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4389 ediff-fine-diff-options
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4390 ediff-fine-diff-ok-lines-regexp))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4391 (if (eq (length (ediff-get-fine-diff-vector n)) 0)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4392 (progn
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4393 (message "No diffs found in region %d, except for white space and line breaks."
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4394 (1+ n))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4395 (ediff-mark-diff-as-space-only n t))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4396 (ediff-mark-diff-as-space-only n nil)))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4397 ) ;; end cond
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4398 (ediff-set-fine-diff-properties n)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4399 )))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4400
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4401
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4402 (defun ediff-set-fine-diff-properties (n &optional default)
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4403 (or (not window-system)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4404 (< n 0)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4405 (>= n ediff-number-of-differences)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4406 ;; in a window system, set faces and priorities of fine overlays
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4407 (let ((fine-diff-vector (ediff-get-fine-diff-vector n))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4408 (face-A (if default 'default (face-name ediff-fine-diff-face-A)))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4409 (face-B (if default 'default (face-name ediff-fine-diff-face-B)))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4410 (priority-A (if default
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4411 0
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4412 (1+ (ediff-overlay-get ediff-current-diff-overlay-A
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4413 'priority))))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4414 (priority-B (if default
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4415 0
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4416 (1+ (ediff-overlay-get ediff-current-diff-overlay-B
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4417 'priority)))))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4418 (mapcar
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4419 (function (lambda (vec)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4420 (ediff-overlay-put
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4421 (ediff-get-diff-overlay-from-vector vec 'A)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4422 'face face-A)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4423 (ediff-overlay-put
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4424 (ediff-get-diff-overlay-from-vector vec 'A)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4425 'priority priority-A)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4426
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4427 (ediff-overlay-put
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4428 (ediff-get-diff-overlay-from-vector vec 'B)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4429 'face face-B)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4430 (ediff-overlay-put
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4431 (ediff-get-diff-overlay-from-vector vec 'B)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4432 'priority priority-B)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4433 ))
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4434 fine-diff-vector)
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4435 )))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4436
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4437 (defun ediff-convert-diffs-to-overlays-refine (A-buffer B-buffer
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4438 diff-list refine-region)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4439 (let* ((current-diff -1)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4440 (reg-A-start (ediff-get-diff-posn 'A 'beg refine-region))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4441 (reg-B-start (ediff-get-diff-posn 'B 'beg refine-region))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4442 diff-overlay-list list-element
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4443 a-begin a-end b-begin b-end
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4444 a-overlay b-overlay)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4445
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
4446 (ediff-eval-in-buffer A-buffer (goto-char reg-A-start))
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
4447 (ediff-eval-in-buffer B-buffer (goto-char reg-B-start))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4448
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4449 (while diff-list
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4450 (setq current-diff (1+ current-diff)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4451 list-element (car diff-list)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4452 a-begin (aref list-element 0)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4453 a-end (aref list-element 1)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4454 b-begin (aref list-element 2)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4455 b-end (aref list-element 3))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4456
8503
084456e12635 (ediff-find-file, ediff-patch-file): Handle symlinks.
Richard M. Stallman <rms@gnu.org>
parents: 8441
diff changeset
4457 ;; put overlays at appropriate places in buffers
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4458 (setq a-overlay (ediff-make-overlay
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4459 (ediff-goto-word (1+ a-begin) A-buffer)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4460 (ediff-goto-word a-end A-buffer 'end)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4461 A-buffer))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4462
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4463 (setq b-overlay (ediff-make-overlay
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4464 (ediff-goto-word (1+ b-begin) B-buffer)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4465 (ediff-goto-word b-end B-buffer 'end)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4466 B-buffer))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4467
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4468 ;; record all overlays for this difference
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4469 (setq diff-overlay-list (nconc diff-overlay-list
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4470 (list (vector a-overlay b-overlay)))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4471 diff-list (cdr diff-list))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4472 ) ;; while
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4473 ;; convert the list of difference information into a vector for
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4474 ;; fast access
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4475 (apply 'vector diff-overlay-list)))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4476
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4477 ;; goto word #n starting at current position in buffer `buf'
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4478 ;; For ediff, a word is either a string of a-z,A-Z, incl `-' and `_';
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
4479 ;; or a string of other non-blanks. A blank is a \n\t\C-j
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4480 ;; If `flag' is non-nil, goto the end of the n-th word.
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4481 (defun ediff-goto-word (n buf &optional flag)
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
4482 (ediff-eval-in-buffer
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4483 buf
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4484 (skip-chars-forward ediff-whitespace)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4485 (while (> n 1)
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
4486 (funcall ediff-forward-word-function)
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4487 (skip-chars-forward ediff-whitespace)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4488 (setq n (1- n)))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4489 ;(if flag
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4490 (if (and flag (> n 0))
8303
33ef3e3234dd (Emacs 19 menu setup): Move back to top level and do it only if purify-flag.
Richard M. Stallman <rms@gnu.org>
parents: 7709
diff changeset
4491 (funcall ediff-forward-word-function))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4492 (point)))
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4493
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4494 (defun ediff-get-visible-buffer-window (wind)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4495 (if (ediff-if-lucid)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4496 (get-buffer-window wind t)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4497 (get-buffer-window wind 'visible)))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4498
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4499
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4500
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4501
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4502
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4503 ;;; Misc
8874
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4504
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4505 ;; These two functions are here to neutralize Lemacs' unwillingless to
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4506 ;; handle overlays whose buffers have been deleted.
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4507 (defun ediff-move-overlay (overlay beg end &optional buffer)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4508 "Calls `move-overlay' in Emacs and `set-extent-endpoints' in Lemacs.
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4509 Checks if overlay's buffer exists before actually doing the move."
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4510 (let ((buf (ediff-overlay-buffer overlay)))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4511 (if (ediff-buffer-live-p buf)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4512 (if (ediff-if-lucid)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4513 (set-extent-endpoints overlay beg end)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4514 (move-overlay overlay beg end buffer))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4515 (ediff-delete-overlay overlay))))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4516
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4517 (defun ediff-overlay-put (overlay prop value)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4518 "Calls `overlay-put' or `set-extent-property' depending on Emacs version.
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4519 Checks if overlay's buffer exists."
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4520 (if (ediff-buffer-live-p (ediff-overlay-buffer overlay))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4521 (if (ediff-if-lucid)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4522 (set-extent-property overlay prop value)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4523 (overlay-put overlay prop value))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4524 (ediff-delete-overlay overlay)))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4525
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4526
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4527 ;; In Emacs 19.23 and Lucid 19.10, the number of variables to
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4528 ;; file-name-handler has changed.
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4529 (defun ediff-find-file-name-handler (file)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4530 (let (newvers)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4531 (setq newvers
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4532 (cond ((and (boundp 'emacs-major-version)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4533 (> emacs-major-version 19))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4534 t)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4535 ((boundp 'emacs-minor-version)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4536 (if (ediff-if-lucid)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4537 (> emacs-minor-version 9)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4538 (> emacs-minor-version 22)))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4539 (t nil)))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4540 (if newvers
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4541 (find-file-name-handler file 'find-file-noselect)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4542 (find-file-name-handler file))))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4543
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4544
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4545
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4546
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4547 (defun ediff-submit-report ()
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4548 "Submit bug report on Ediff."
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4549 (interactive)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4550 (let ((reporter-prompt-for-summary-p t)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4551 varlist salutation)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4552 (setq varlist '(ediff-diff-program ediff-diff-options
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4553 ediff-fine-diff-program ediff-fine-diff-options
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4554 ediff-patch-program ediff-patch-options
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4555 ediff-shell
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4556 ediff-want-faces ediff-want-default-menus
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4557 ediff-auto-refine ediff-highlighting-style
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4558 ediff-A-buffer ediff-B-buffer ediff-control-buffer
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4559 ediff-forward-word-function))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4560 (setq salutation "
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4561 Congratulations! You are about to report a bug in Ediff!
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4562
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4563 Please make a concise, accurate summary of what happened
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4564 and mail it to the address above.
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4565
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4566 Some ``bugs'' may actually not be bugs at all. For instance, if you are
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4567 reporting that certain difference regions are not matched as you think they
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4568 should, this is most likely due to the way Unix diff program decides what
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4569 constitutes a difference region. Ediff is an Emacs interface to diff, and
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4570 it has nothing to do with those decisions---it only takes the output from
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4571 diff and presents it in a way that is better suited for human browsing and
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4572 manipulation.
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4573
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4574 Another popular topic for reports are ``error messages'' arising from
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4575 byte-compilation. Because Ediff interfaces to several other packages and
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4576 runs under Emacs and Lucid Emacs, byte-compilation may produce output like
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4577 this:
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4578 While compiling toplevel forms in file ediff.el:
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4579 ** reference to free variable pm-color-alist
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4580 ........................
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4581 While compiling the end of the data:
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4582 ** The following functions are not known to be defined:
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4583 ediff-valid-color-p, ediff-display-color-p, ediff-set-face,
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4584 ........................
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4585
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4586 These are NOT errors, but inevitable warnings that should be ignored.
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4587
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4588 So, please don't report those and similar things. However, if all you wanted
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4589 is to tell us how much you liked Ediff, go ahead and send this message anyway.
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4590
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4591 ------------------------------------------------------------------")
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4592
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4593 (require 'reporter)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4594
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4595 (reporter-submit-bug-report "kifer@cs.sunysb.edu"
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4596 (ediff-version)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4597 varlist
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4598 nil nil
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4599 salutation)
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4600 ))
716969785d08 (ediff-submit-report, ediff-revision)
Richard M. Stallman <rms@gnu.org>
parents: 8524
diff changeset
4601
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4602
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4603 (defun ediff-union (list1 list2)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4604 "Combine LIST1 and LIST2 using a set-union operation.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4605 The result list contains all items that appear in either LIST1 or LIST2.
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4606 This is a non-destructive function; it makes a copy of the data if necessary
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4607 to avoid corrupting the original LIST1 and LIST2.
7419
0d0a01a0310c Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents: 7391
diff changeset
4608 This is a slightly simplified version from `cl-seq.el'. Added here to
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4609 avoid loading cl-*."
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4610 (cond ((null list1) list2) ((null list2) list1)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4611 ((equal list1 list2) list1)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4612 (t
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4613 (or (>= (length list1) (length list2))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4614 (setq list1 (prog1 list2 (setq list2 list1))))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4615 (while list2
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4616 (or (memq (car list2) list1)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4617 (setq list1 (cons (car list2) list1)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4618 (setq list2 (cdr list2)))
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4619 list1)))
7424
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4620
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4621 ;(defun ediff-debug ()
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4622 ; (interactive)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4623 ; (with-output-to-temp-buffer "*ediff-debug*"
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4624 ; (princ
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4625 ; (format "Ctl buffer: %S\n\nediff-difference-vector:\n"
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4626 ; ediff-control-buffer))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4627 ; (mapcar (function
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4628 ; (lambda (overl-vec)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4629 ; (princ (format "Diff %d: %S %S %S\n\t %S %S %S\n"
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4630 ; (1+ (ediff-overlay-get (aref overl-vec 0)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4631 ; 'ediff-diff-num))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4632 ; (ediff-overlay-get (aref overl-vec 0)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4633 ; 'ediff-control-buffer)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4634 ; (ediff-overlay-get (aref overl-vec 0)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4635 ; 'insert-in-front-hooks)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4636 ; (aref overl-vec 0)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4637 ; (ediff-overlay-get (aref overl-vec 1)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4638 ; 'ediff-control-buffer)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4639 ; (ediff-overlay-get (aref overl-vec 0)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4640 ; 'insert-in-front-hooks)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4641 ; (aref overl-vec 1)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4642 ; ))))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4643 ; ediff-difference-vector)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4644 ; (princ "\nediff-disturbed-overlays:\n")
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4645 ; (mapcar (function
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4646 ; (lambda (overl)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4647 ; (princ (format "%S %S\n"
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4648 ; (ediff-overlay-get overl 'ediff-control-buffer)
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4649 ; overl
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4650 ; ))))
9169ca1bcb95 New version from Kifer.
Richard M. Stallman <rms@gnu.org>
parents: 7419
diff changeset
4651 ; ediff-disturbed-overlays)))
7267
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4652
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4653
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4654 (run-hooks 'ediff-load-hooks)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4655
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4656
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4657 (provide 'ediff)
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4658
4aa70d4d981c Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4659 ;;; ediff.el ends here