Mercurial > emacs
annotate lisp/ediff-mult.el @ 17212:de55dc47bae6
Many doc fixes.
(ring-ref): Fix error message.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Sat, 22 Mar 1997 03:52:36 +0000 |
parents | beb94a5271e2 |
children | 0b9d9cbf3cd4 |
rev | line source |
---|---|
13607
71a4a349d998
Renamed from ediff-meta.el. Changed provide.
Richard M. Stallman <rms@gnu.org>
parents:
13216
diff
changeset
|
1 ;;; ediff-mult.el --- support for multi-file/multi-buffer processing in Ediff |
14169 | 2 |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
3 ;; Copyright (C) 1995, 1996 Free Software Foundation, Inc. |
13130 | 4 |
5 ;; Author: Michael Kifer <kifer@cs.sunysb.edu> | |
6 | |
7 ;; This file is part of GNU Emacs. | |
8 | |
9 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
10 ;; it under the terms of the GNU General Public License as published by | |
11 ;; the Free Software Foundation; either version 2, or (at your option) | |
12 ;; any later version. | |
13 | |
14 ;; GNU Emacs is distributed in the hope that it will be useful, | |
15 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 ;; GNU General Public License for more details. | |
18 | |
19 ;; You should have received a copy of the GNU General Public License | |
14169 | 20 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
21 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
22 ;; Boston, MA 02111-1307, USA. | |
13130 | 23 |
14169 | 24 ;;; Commentary: |
25 | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
26 ;; Users are encouraged to add functionality to this file. |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
27 ;; The present file contains all the infrastructure needed for that. |
13130 | 28 ;; |
29 ;; Generally, to to implement a new multisession capability within Ediff, | |
30 ;; you need to tell it | |
31 ;; | |
32 ;; 1. How to display the session group buffer. | |
33 ;; This function must indicate which Ediff sessions are active (+) and | |
34 ;; which are finished (-). | |
35 ;; See ediff-redraw-directory-group-buffer for an example. | |
36 ;; In all likelihood, ediff-redraw-directory-group-buffer can be used | |
37 ;; directly or after a small modification. | |
38 ;; 2. What action to take when the user clicks button 2 or types v,e, or | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
39 ;; RET. See ediff-filegroup-action. |
13130 | 40 ;; 3. Provide a list of pairs or triples of file names (or buffers, |
41 ;; depending on the particular Ediff operation you want to invoke) | |
42 ;; in the following format: | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
43 ;; (descriptor (obj1 obj2 obj3) (...) ...) |
13130 | 44 ;; Actually, the format of this list is pretty much up to the |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
45 ;; developer. The only thing is that it must be a list of lists, |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
46 ;; and the first list must describe the meta session, and subsequent |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
47 ;; elements must describe individual sessions. |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
48 ;; This descriptor must be a list of two, three, or four elements (nil |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
49 ;; or string). The function ediff-redraw-registry-buffer displays the |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
50 ;; second through last of these in the registry buffer. |
13130 | 51 ;; Also, keep in mind that the function ediff-prepare-meta-buffer |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
52 ;; (which see) prepends the session group buffer to the descriptor and |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
53 ;; nil in front of each subsequent list (i.e., the above list |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
54 ;; will become |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
55 ;; ((meta-buf descriptor) (nil obj1 obj2 obj3) (nil ...) ...) |
13130 | 56 ;; Ediff expects that your function (in 2 above) will arrange to |
57 ;; replace this prepended nil (via setcar) with the actual ediff | |
58 ;; control buffer associated with an appropriate Ediff session. | |
59 ;; This is arranged through internal startup hooks that can be passed | |
60 ;; to any of Ediff major entries (such as ediff-files, epatch, etc.). | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
61 ;; See how this is done in ediff-filegroup-action. |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
62 ;; |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
63 ;; Session descriptions are of the form (obj1 obj2 obj3), which |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
64 ;; describe objects relevant to the session. Usually they are names of |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
65 ;; files, but sometimes they may be other things. For instance, obj3 is |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
66 ;; nil for jobs that involve only two files. For patch jobs, obj2 and |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
67 ;; obj3 are markers that specify the patch corresponding to the file |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
68 ;; (whose name is obj1). |
13130 | 69 ;; 4. Write a function that makes a call to ediff-prepare-meta-buffer |
70 ;; passing all this info. | |
71 ;; You may be able to use ediff-directories-internal as a template. | |
72 ;; 5. If you intend to add several related pieces of functionality, | |
73 ;; you may want to keep the function in 4 as an internal version | |
74 ;; and then write several top-level interactive functions that call it | |
75 ;; with different parameters. | |
76 ;; See how ediff-directories, ediff-merge-directories, and | |
77 ;; ediff-merge-directories-with-ancestor all use | |
78 ;; ediff-directories-internal. | |
79 ;; | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
80 ;; A useful addition here could be session groups selected by patterns |
13130 | 81 ;; (which are different in each directory). For instance, one may want to |
82 ;; compare files of the form abc{something}.c to files old{something}.d | |
83 ;; which may be in the same or different directories. Or, one may want to | |
84 ;; compare all files of the form {something} to files of the form {something}~. | |
85 ;; | |
13216
b9dc8cc658d5
Moved defsubsts up.
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
13130
diff
changeset
|
86 ;; Implementing this requires writing an collating function, which should pair |
b9dc8cc658d5
Moved defsubsts up.
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
13130
diff
changeset
|
87 ;; up appropriate files. It will also require a generalization of the functions |
13130 | 88 ;; that do the layout of the meta- and differences buffers and of |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
89 ;; ediff-filegroup-action. |
13130 | 90 |
14169 | 91 ;;; Code: |
92 | |
13130 | 93 (require 'ediff-init) |
94 | |
95 ;; meta-buffer | |
96 (ediff-defvar-local ediff-meta-buffer nil "") | |
97 (ediff-defvar-local ediff-parent-meta-buffer nil "") | |
98 ;; the registry buffer | |
99 (defvar ediff-registry-buffer nil) | |
100 | |
101 (defconst ediff-meta-buffer-message "This is an Ediff Session Group Panel: %s | |
102 | |
103 Useful commands: | |
104 button2, `v', RET over a session line: start that Ediff session | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
105 `M':\tin any session invoked from here, brings back this group panel |
13130 | 106 `R':\tdisplay the registry of active Ediff sessions |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
107 `h':\tmark session for hiding (toggle) |
13130 | 108 `x':\thide marked sessions; with prefix arg--unhide hidden sessions |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
109 `m':\tmark session for a non-hiding operation (toggle) |
13130 | 110 SPC:\tnext session |
111 DEL:\tprevious session | |
112 `E':\tbrowse Ediff on-line manual | |
113 `q':\tquit this session group | |
114 ") | |
115 | |
116 (ediff-defvar-local ediff-meta-buffer-map nil | |
117 "The keymap for the meta buffer.") | |
118 (defvar ediff-dir-diffs-buffer-map (make-sparse-keymap) | |
119 "The keymap to be installed in the buffer showing differences between | |
120 directories.") | |
121 | |
122 ;; Variable specifying the action to take when the use invokes ediff in the | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
123 ;; meta buffer. This is usually ediff-registry-action or ediff-filegroup-action |
13130 | 124 (ediff-defvar-local ediff-meta-action-function nil "") |
125 ;; Tells ediff-update-meta-buffer how to redraw it | |
126 (ediff-defvar-local ediff-meta-redraw-function nil "") | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
127 ;; Tells ediff-filegroup-action and similar procedures how to invoke Ediff for |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
128 ;; the sessions in a given session group |
13130 | 129 (ediff-defvar-local ediff-session-action-function nil "") |
130 | |
131 (ediff-defvar-local ediff-metajob-name nil "") | |
132 | |
133 ;; buffer used to collect custom diffs from individual sessions in the group | |
134 (ediff-defvar-local ediff-meta-diff-buffer nil "") | |
135 | |
136 ;; history var to use for filtering groups | |
137 (defvar ediff-filtering-regexp-history nil "") | |
138 | |
139 ;; This has the form ((ctl-buf file1 file2) (stl-buf file1 file2) ...) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
140 ;; If ctl-buf is nil, the file-pair wasn't processed yet. If it is |
13130 | 141 ;; killed-buffer object, the file pair has been processed. If it is a live |
142 ;; buffer, this means ediff is still working on the pair | |
143 (ediff-defvar-local ediff-meta-list nil "") | |
144 | |
145 | |
146 ;; the difference list between directories in a directory session group | |
147 (ediff-defvar-local ediff-dir-difference-list nil "") | |
148 (ediff-defvar-local ediff-dir-diffs-buffer nil "") | |
149 | |
150 ;; The registry of Ediff sessions. A list of control buffers. | |
151 (defvar ediff-session-registry nil) | |
152 | |
153 (defvar ediff-registry-setup-hook nil | |
154 "*Hooks run just after the registry control panel is set up.") | |
155 (defvar ediff-session-group-setup-hook nil | |
156 "*Hooks run just after a meta-buffer controlling a session group, such as | |
157 ediff-directories, is run.") | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
158 (defvar ediff-quit-session-group-hook nil |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
159 "*Hooks run just before exiting a session group.") |
13130 | 160 (defvar ediff-show-registry-hook nil |
161 "*Hooks run just after the registry buffer is shown.") | |
162 (defvar ediff-show-session-group-hook nil | |
163 "*Hooks run just after a session group buffer is shown.") | |
16766
beb94a5271e2
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
16248
diff
changeset
|
164 (defvar ediff-meta-buffer-keymap-setup-hook nil |
beb94a5271e2
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
16248
diff
changeset
|
165 "*Hooks run just after setting up the ediff-meta-buffer-map. |
beb94a5271e2
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
16248
diff
changeset
|
166 This keymap controls key bindings in the meta buffer and is a local variable. |
beb94a5271e2
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
16248
diff
changeset
|
167 This means that you can set different bindings for different kinds of meta |
beb94a5271e2
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
16248
diff
changeset
|
168 buffers.") |
13130 | 169 |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
170 ;; buffer holding the multi-file patch. local to the meta buffer |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
171 (ediff-defvar-local ediff-meta-patchbufer nil "") |
13130 | 172 |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
173 ;;; API for ediff-meta-list |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
174 |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
175 ;; group buffer/regexp |
13130 | 176 (defun ediff-get-group-buffer (meta-list) |
177 (nth 0 (car meta-list))) | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
178 |
13130 | 179 (defun ediff-get-group-regexp (meta-list) |
180 (nth 1 (car meta-list))) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
181 ;; group objects |
13130 | 182 (defun ediff-get-group-objA (meta-list) |
183 (nth 2 (car meta-list))) | |
184 (defun ediff-get-group-objB (meta-list) | |
185 (nth 3 (car meta-list))) | |
186 (defun ediff-get-group-objC (meta-list) | |
187 (nth 4 (car meta-list))) | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
188 (defun ediff-get-group-merge-autostore-dir (meta-list) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
189 (nth 5 (car meta-list))) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
190 |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
191 ;; session buffer |
13130 | 192 (defun ediff-get-session-buffer (elt) |
193 (nth 0 elt)) | |
194 (defun ediff-get-session-status (elt) | |
195 (nth 1 elt)) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
196 (defun ediff-set-session-status (session-info new-status) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
197 (setcar (cdr session-info) new-status)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
198 ;; session objects |
13130 | 199 (defun ediff-get-session-objA (elt) |
200 (nth 2 elt)) | |
201 (defun ediff-get-session-objB (elt) | |
202 (nth 3 elt)) | |
203 (defun ediff-get-session-objC (elt) | |
204 (nth 4 elt)) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
205 (defun ediff-get-session-objA-name (elt) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
206 (car (nth 2 elt))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
207 (defun ediff-get-session-objB-name (elt) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
208 (car (nth 3 elt))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
209 (defun ediff-get-session-objC-name (elt) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
210 (car (nth 4 elt))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
211 ;; equality indicators |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
212 (defsubst ediff-get-file-eqstatus (elt) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
213 (nth 1 elt)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
214 (defsubst ediff-set-file-eqstatus (elt value) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
215 (setcar (cdr elt) value)) |
13130 | 216 |
217 ;; set up the keymap in the meta buffer | |
218 (defun ediff-setup-meta-map() | |
219 (setq ediff-meta-buffer-map (make-sparse-keymap)) | |
220 (suppress-keymap ediff-meta-buffer-map) | |
221 (define-key ediff-meta-buffer-map "q" 'ediff-quit-meta-buffer) | |
222 (define-key ediff-meta-buffer-map "R" 'ediff-show-registry) | |
223 (define-key ediff-meta-buffer-map "E" 'ediff-documentation) | |
224 (define-key ediff-meta-buffer-map "v" ediff-meta-action-function) | |
225 (define-key ediff-meta-buffer-map "\C-m" ediff-meta-action-function) | |
226 (define-key ediff-meta-buffer-map " " 'ediff-next-meta-item) | |
227 (define-key ediff-meta-buffer-map "\C-?" 'ediff-previous-meta-item) | |
228 (define-key ediff-meta-buffer-map [delete] 'ediff-previous-meta-item) | |
229 (define-key ediff-meta-buffer-map [backspace] 'ediff-previous-meta-item) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
230 (or (ediff-one-filegroup-metajob) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
231 (define-key ediff-meta-buffer-map "=" 'ediff-meta-mark-equal-files)) |
13130 | 232 (if ediff-no-emacs-help-in-control-buffer |
233 (define-key ediff-meta-buffer-map "\C-h" 'ediff-previous-meta-item)) | |
234 (if ediff-emacs-p | |
235 (define-key ediff-meta-buffer-map [mouse-2] ediff-meta-action-function) | |
236 (define-key ediff-meta-buffer-map [button2] ediff-meta-action-function)) | |
237 | |
16766
beb94a5271e2
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
16248
diff
changeset
|
238 (use-local-map ediff-meta-buffer-map) |
beb94a5271e2
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
16248
diff
changeset
|
239 ;; modify ediff-meta-buffer-map here |
beb94a5271e2
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
16248
diff
changeset
|
240 (run-hooks 'ediff-meta-buffer-keymap-setup-hook)) |
13130 | 241 |
242 (defun ediff-meta-mode () | |
243 "This mode controls all operations on Ediff session groups. | |
244 It is entered through one of the following commands: | |
245 `ediff-directories' | |
246 `edirs' | |
247 `ediff-directories3' | |
248 `edirs3' | |
249 `ediff-merge-directories' | |
250 `edirs-merge' | |
251 `ediff-merge-directories-with-ancestor' | |
252 `edirs-merge-with-ancestor' | |
253 `ediff-directory-revisions' | |
254 `edir-revisions' | |
255 `ediff-merge-directory-revisions' | |
256 `edir-merge-revisions' | |
257 `ediff-merge-directory-revisions-with-ancestor' | |
258 `edir-merge-revisions-with-ancestor' | |
259 | |
260 Commands: | |
261 \\{ediff-meta-buffer-map}" | |
262 (kill-all-local-variables) | |
263 (setq major-mode 'ediff-meta-mode) | |
264 (setq mode-name "MetaEdiff")) | |
265 | |
266 | |
267 ;; the keymap for the buffer showing directory differences | |
268 (suppress-keymap ediff-dir-diffs-buffer-map) | |
269 (define-key ediff-dir-diffs-buffer-map "q" 'ediff-bury-dir-diffs-buffer) | |
270 (define-key ediff-dir-diffs-buffer-map " " 'next-line) | |
271 (define-key ediff-dir-diffs-buffer-map "\C-?" 'previous-line) | |
272 (define-key ediff-dir-diffs-buffer-map [delete] 'previous-line) | |
273 (define-key ediff-dir-diffs-buffer-map [backspace] 'previous-line) | |
274 | |
275 (defun ediff-next-meta-item (count) | |
276 "Move to the next item in Ediff registry or session group buffer. | |
277 Moves in circular fashion. With numeric prefix arg, skip this many items." | |
278 (interactive "p") | |
279 (or count (setq count 1)) | |
280 (while (< 0 count) | |
281 (setq count (1- count)) | |
282 (ediff-next-meta-item1))) | |
283 | |
284 ;; Move to the next meta item | |
285 (defun ediff-next-meta-item1 () | |
286 (let (pos) | |
287 (setq pos (ediff-next-meta-overlay-start (point))) | |
288 ;;; ;; skip deleted | |
289 ;;; (while (memq (ediff-get-session-status | |
290 ;;; (ediff-get-meta-info (current-buffer) pos 'noerror)) | |
291 ;;; '(?H ?I)) | |
292 ;;; (setq pos (ediff-next-meta-overlay-start pos))) | |
293 | |
294 (if pos (goto-char pos)) | |
295 (if (eq ediff-metajob-name 'ediff-registry) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
296 (if (and (ediff-get-meta-info (current-buffer) pos 'noerror) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
297 (search-forward "*Ediff" nil t)) |
13130 | 298 (skip-chars-backward "a-zA-Z*")) |
299 (if (> (skip-chars-forward "-+?H* \t0-9") 0) | |
300 (backward-char 1))))) | |
301 | |
302 | |
303 (defun ediff-previous-meta-item (count) | |
304 "Move to the previous item in Ediff registry or session group buffer. | |
305 Moves in circular fashion. With numeric prefix arg, skip this many items." | |
306 (interactive "p") | |
307 (or count (setq count 1)) | |
308 (while (< 0 count) | |
309 (setq count (1- count)) | |
310 (ediff-previous-meta-item1))) | |
311 | |
312 (defun ediff-previous-meta-item1 () | |
313 (let (pos) | |
314 (setq pos (ediff-previous-meta-overlay-start (point))) | |
315 ;;; ;; skip deleted | |
316 ;;; (while (ediff-get-session-status | |
317 ;;; (ediff-get-meta-info (current-buffer) pos 'noerror)) | |
318 ;;; (setq pos (ediff-previous-meta-overlay-start pos))) | |
319 | |
320 (if pos (goto-char pos)) | |
321 (if (eq ediff-metajob-name 'ediff-registry) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
322 (if (and (ediff-get-meta-info (current-buffer) pos 'noerror) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
323 (search-forward "*Ediff" nil t)) |
13130 | 324 (skip-chars-backward "a-zA-Z*")) |
325 (if (> (skip-chars-forward "-+?H* \t0-9") 0) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
326 (backward-char 1))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
327 )) |
13130 | 328 |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
329 (defsubst ediff-add-slash-if-directory (dir file) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
330 (if (file-directory-p (concat dir file)) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
331 (file-name-as-directory file) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
332 file)) |
13130 | 333 |
334 | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
335 ;; DIR1, DIR2, DIR3 are directories. DIR3 can be nil. |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
336 ;; OUTPUT-DIR is a directory for auto-storing the results of merge jobs. |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
337 ;; Can be nil. |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
338 ;; REGEXP is a regexp used to filter out files in the directories. |
13130 | 339 ;; If a file is a directory in dir1 but not dir2 (or vice versa), it is not |
340 ;; included in the intersection. However, a regular file that is a dir in dir3 | |
341 ;; is included, since dir3 files are supposed to be ancestors for merging. | |
342 ;; Returns a list of the form: | |
343 ;; ((dir1 dir2 dir3) (f1 f2 f3) (f1 f2 f3) ...) | |
344 ;; dir3, f3 can be nil if intersecting only 2 directories. | |
345 ;; If COMPARISON-FUNC is given, use it. Otherwise, use string= | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
346 ;; DIFF-VAR contains the name of the variable in which to return the |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
347 ;; difference list (which represents the differences among the contents of |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
348 ;; directories). The diff list is of the form: |
13130 | 349 ;; ((dir1 dir2 dir3) (file . num) (file . num)...) |
350 ;; where num encodes the set of dirs where the file is found: | |
351 ;; 2 - only dir1; 3 - only dir2; 5 - only dir3; 6 - dir1&2; 10 - dir1&3; etc. | |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
352 (defun ediff-intersect-directories (jobname |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
353 diff-var regexp dir1 dir2 |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
354 &optional |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
355 dir3 merge-autostore-dir comparison-func) |
13130 | 356 (setq comparison-func (or comparison-func 'string=)) |
357 (let (lis1 lis2 lis3 common auxdir1 auxdir2 auxdir3 difflist) | |
358 | |
359 (setq auxdir1 (file-name-as-directory dir1) | |
360 lis1 (directory-files auxdir1 nil regexp) | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
361 lis1 (delete "." lis1) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
362 lis1 (delete ".." lis1) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
363 lis1 (mapcar |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
364 (function |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
365 (lambda (elt) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
366 (ediff-add-slash-if-directory auxdir1 elt))) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
367 lis1) |
13130 | 368 auxdir2 (file-name-as-directory dir2) |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
369 lis2 (mapcar |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
370 (function |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
371 (lambda (elt) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
372 (ediff-add-slash-if-directory auxdir2 elt))) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
373 (directory-files auxdir2 nil regexp))) |
13130 | 374 |
375 (if (stringp dir3) | |
376 (setq auxdir3 (file-name-as-directory dir3) | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
377 lis3 (mapcar |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
378 (function |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
379 (lambda (elt) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
380 (ediff-add-slash-if-directory auxdir3 elt))) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
381 (directory-files auxdir3 nil regexp)))) |
13130 | 382 |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
383 (if (stringp merge-autostore-dir) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
384 (setq merge-autostore-dir |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
385 (file-name-as-directory merge-autostore-dir))) |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
386 (setq common (ediff-intersection lis1 lis2 comparison-func)) |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
387 |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
388 ;; In merge with ancestor jobs, we don't intersect with lis3. |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
389 ;; If there is no ancestor, we'll offer to merge without the ancestor. |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
390 ;; So, we intersect with lis3 only when we are doing 3-way file comparison |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
391 (if (and lis3 (ediff-comparison-metajob3 jobname)) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
392 (setq common (ediff-intersection common lis3 comparison-func))) |
13130 | 393 |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
394 ;; copying is needed because sort sorts via side effects |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
395 (setq common (sort (ediff-copy-list common) 'string-lessp)) |
13130 | 396 |
397 ;; compute difference list | |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
398 (setq difflist (ediff-set-difference |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
399 (ediff-union (ediff-union lis1 lis2 comparison-func) |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
400 lis3 |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
401 comparison-func) |
13130 | 402 common |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
403 comparison-func) |
13130 | 404 difflist (delete "." difflist) |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
405 ;; copying is needed because sort sorts via side effects |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
406 difflist (sort (ediff-copy-list (delete ".." difflist)) |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
407 'string-lessp)) |
13130 | 408 |
409 (setq difflist (mapcar (function (lambda (elt) (cons elt 1))) difflist)) | |
410 | |
411 ;; check for files belonging to lis1/2/3 | |
412 (mapcar (function (lambda (elt) | |
413 (if (member (car elt) lis1) | |
414 (setcdr elt (* (cdr elt) 2))) | |
415 (if (member (car elt) lis2) | |
416 (setcdr elt (* (cdr elt) 3))) | |
417 (if (member (car elt) lis3) | |
418 (setcdr elt (* (cdr elt) 5))) | |
419 )) | |
420 difflist) | |
421 (setq difflist (cons (list regexp auxdir1 auxdir2 auxdir3) difflist)) | |
422 | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
423 ;; return the difference list back to the calling function |
13130 | 424 (set diff-var difflist) |
425 | |
426 ;; return result | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
427 (cons (list regexp auxdir1 auxdir2 auxdir3 merge-autostore-dir) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
428 (mapcar |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
429 (function |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
430 (lambda (elt) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
431 (list (concat auxdir1 elt) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
432 (concat auxdir2 elt) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
433 (if lis3 |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
434 (progn |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
435 ;; The following is done because: |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
436 ;; In merging with ancestor, we don't intersect |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
437 ;; with lis3. So, it is possible that elt is a |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
438 ;; file in auxdir1/2 but a directory in auxdir3 |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
439 ;; Or elt may not exist in auxdir3 at all. |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
440 ;; In the first case, we add a slash at the end. |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
441 ;; In the second case, we insert nil. |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
442 (setq elt (ediff-add-slash-if-directory auxdir3 elt)) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
443 (if (file-exists-p (concat auxdir3 elt)) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
444 (concat auxdir3 elt))))))) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
445 common)) |
13130 | 446 )) |
447 | |
448 ;; find directory files that are under revision. | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
449 ;; Include subdirectories, since we may visit them recursively. |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
450 ;; DIR1 is the directory to inspect. |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
451 ;; OUTPUT-DIR is the directory where to auto-store the results of merges. Can |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
452 ;; be nil. |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
453 (defun ediff-get-directory-files-under-revision (jobname |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
454 regexp dir1 |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
455 &optional merge-autostore-dir) |
13130 | 456 (let (lis1 elt common auxdir1) |
457 (setq auxdir1 (file-name-as-directory dir1) | |
458 lis1 (directory-files auxdir1 nil regexp)) | |
459 | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
460 (if (stringp merge-autostore-dir) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
461 (setq merge-autostore-dir |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
462 (file-name-as-directory merge-autostore-dir))) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
463 |
13130 | 464 (while lis1 |
465 (setq elt (car lis1) | |
466 lis1 (cdr lis1)) | |
467 ;; take files under revision control | |
468 (cond ((file-directory-p (concat auxdir1 elt)) | |
469 (setq common (cons elt common))) | |
470 ((file-exists-p (concat auxdir1 elt ",v")) | |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
471 (setq common (cons elt common))) |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
472 ((file-exists-p (concat auxdir1 "RCS/" elt ",v")) |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
473 (setq common (cons elt common))) |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
474 ) ; cond |
13130 | 475 ) ; while |
476 | |
477 (setq common (delete "." common) | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
478 common (delete ".." common) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
479 common (delete "RCS" common)) |
13130 | 480 |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
481 ;; copying is needed because sort sorts via side effects |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
482 (setq common (sort (ediff-copy-list common) 'string-lessp)) |
13130 | 483 |
484 ;; return result | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
485 (cons (list regexp auxdir1 nil nil merge-autostore-dir) |
13130 | 486 (mapcar (function (lambda (elt) |
487 (list (concat auxdir1 elt) | |
488 nil nil))) | |
489 common)) | |
490 )) | |
491 | |
492 | |
493 ;; If file groups selected by patterns will ever be implemented, this | |
494 ;; comparison function might become useful. | |
495 ;;;; uses external variables PAT1 PAT2 to compare str1/2 | |
496 ;;;; patterns must be of the form ???*???? where ??? are strings of chars | |
497 ;;;; containing no *. | |
498 ;;(defun ediff-pattern= (str1 str2) | |
499 ;; (let (pos11 pos12 pos21 pos22 len1 len2) | |
500 ;; (setq pos11 0 | |
501 ;; len (length epat1) | |
502 ;; pos12 len) | |
503 ;; (while (and (< pos11 len) (not (= (aref epat1 pos11) ?*))) | |
504 ;; (setq pos11 (1+ pos11))) | |
505 ;; (while (and (> pos12 0) (not (= (aref epat1 (1- pos12)) ?*))) | |
506 ;; (setq pos12 (1- pos12))) | |
507 ;; | |
508 ;; (setq pos21 0 | |
509 ;; len (length epat2) | |
510 ;; pos22 len) | |
511 ;; (while (and (< pos21 len) (not (= (aref epat2 pos21) ?*))) | |
512 ;; (setq pos21 (1+ pos21))) | |
513 ;; (while (and (> pos22 0) (not (= (aref epat2 (1- pos22)) ?*))) | |
514 ;; (setq pos22 (1- pos22))) | |
515 ;; | |
516 ;; (if (and (> (length str1) pos12) (>= pos12 pos11) (> pos11 -1) | |
517 ;; (> (length str2) pos22) (>= pos22 pos21) (> pos21 -1)) | |
518 ;; (string= (substring str1 pos11 pos12) | |
519 ;; (substring str2 pos21 pos22))) | |
520 ;; )) | |
521 | |
522 | |
523 ;; Prepare meta-buffer in accordance with the argument-function and | |
524 ;; redraw-function. Must return the created meta-buffer. | |
525 (defun ediff-prepare-meta-buffer (action-func meta-list | |
526 meta-buffer-name redraw-function | |
527 jobname &optional startup-hooks) | |
528 (let* ((meta-buffer-name | |
529 (ediff-unique-buffer-name meta-buffer-name "*")) | |
530 (meta-buffer (get-buffer-create meta-buffer-name))) | |
531 (ediff-eval-in-buffer meta-buffer | |
532 | |
533 ;; comes first | |
534 (ediff-meta-mode) | |
535 | |
536 (setq ediff-meta-action-function action-func | |
537 ediff-meta-redraw-function redraw-function | |
538 ediff-metajob-name jobname | |
539 ediff-meta-buffer meta-buffer) | |
540 | |
541 ;; comes after ediff-meta-action-function is set | |
542 (ediff-setup-meta-map) | |
543 | |
544 (if (eq ediff-metajob-name 'ediff-registry) | |
545 (progn | |
546 (setq ediff-registry-buffer meta-buffer | |
547 ediff-meta-list meta-list) | |
548 ;; this func is used only from registry buffer, not from other | |
549 ;; meta-buffs. | |
550 (define-key | |
551 ediff-meta-buffer-map "M" 'ediff-show-meta-buff-from-registry)) | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
552 ;; Initialize the meta list -- don't do this for registry. |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
553 ;; |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
554 ;; We prepend '(nil nil) to all elts of meta-list, except the first. |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
555 ;; The first nil will later be replaced by the session buffer. The |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
556 ;; second is reserved for session status. |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
557 ;; |
13130 | 558 ;; (car ediff-meta-list) gets cons'ed with the session group buffer. |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
559 ;; Also, session objects A/B/C are turned into lists of the form |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
560 ;; (obj eq-indicator). Eq-indicator is either nil or =. Initialized to |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
561 ;; nil. If later it is discovered that this file is = to some other |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
562 ;; file in the same session, eq-indicator is changed to `='. |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
563 ;; For now, the eq-indicator is used only for 2 and 3-file jobs. |
13130 | 564 (setq ediff-meta-list |
565 (cons (cons meta-buffer (car meta-list)) | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
566 (mapcar |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
567 (function |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
568 (lambda (elt) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
569 (cons nil |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
570 (cons nil |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
571 ;; convert each obj to (obj nil), |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
572 ;; where nil is the initial value |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
573 ;; for eq-indicator -- see above |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
574 (mapcar |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
575 (function (lambda (obj) (list obj nil))) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
576 elt))))) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
577 (cdr meta-list))))) |
13130 | 578 |
579 (or (eq meta-buffer ediff-registry-buffer) | |
580 (setq ediff-session-registry | |
581 (cons meta-buffer ediff-session-registry))) | |
582 | |
583 ;; redraw-function uses ediff-meta-list | |
584 (funcall redraw-function ediff-meta-list) | |
585 | |
586 ;; set read-only/non-modified | |
587 (setq buffer-read-only t) | |
588 (set-buffer-modified-p nil) | |
589 | |
590 (run-hooks 'startup-hooks) | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
591 |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
592 ;; Arrange to show directory contents differences |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
593 ;; Must be after run startup-hooks, since ediff-dir-difference-list is |
13130 | 594 ;; set inside these hooks |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
595 (if (eq action-func 'ediff-filegroup-action) |
13130 | 596 (progn |
597 ;; put meta buffer in (car ediff-dir-difference-list) | |
598 (setq ediff-dir-difference-list | |
599 (cons (cons meta-buffer (car ediff-dir-difference-list)) | |
600 (cdr ediff-dir-difference-list))) | |
601 | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
602 (or (ediff-one-filegroup-metajob jobname) |
13130 | 603 (ediff-draw-dir-diffs ediff-dir-difference-list)) |
604 (define-key ediff-meta-buffer-map "h" 'ediff-mark-for-hiding) | |
605 (define-key | |
606 ediff-meta-buffer-map "x" 'ediff-hide-marked-sessions) | |
607 (define-key ediff-meta-buffer-map "m" 'ediff-mark-for-operation) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
608 (cond ((ediff-collect-diffs-metajob jobname) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
609 (define-key |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
610 ediff-meta-buffer-map "P" 'ediff-collect-custom-diffs)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
611 ((ediff-patch-metajob jobname) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
612 (define-key |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
613 ediff-meta-buffer-map "P" 'ediff-meta-show-patch))) |
13130 | 614 (define-key ediff-meta-buffer-map "u" 'ediff-up-meta-hierarchy) |
615 (define-key ediff-meta-buffer-map "D" 'ediff-show-dir-diffs))) | |
616 | |
617 (if (eq ediff-metajob-name 'ediff-registry) | |
618 (run-hooks 'ediff-registry-setup-hook) | |
619 (run-hooks 'ediff-session-group-setup-hook)) | |
620 ) ; eval in meta-buffer | |
621 meta-buffer)) | |
622 | |
623 | |
624 ;; this is a setup function for ediff-directories | |
625 ;; must return meta-buffer | |
626 (defun ediff-redraw-directory-group-buffer (meta-list) | |
627 ;; extract directories | |
628 (let ((meta-buf (ediff-get-group-buffer meta-list)) | |
629 (empty t) | |
630 (sessionNum 0) | |
631 regexp elt session-buf f1 f2 f3 pt | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
632 merge-autostore-dir |
13130 | 633 point tmp-list buffer-read-only) |
634 (ediff-eval-in-buffer meta-buf | |
635 (setq point (point)) | |
636 (erase-buffer) | |
637 (insert (format ediff-meta-buffer-message | |
638 (ediff-abbrev-jobname ediff-metajob-name))) | |
639 | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
640 (setq regexp (ediff-get-group-regexp meta-list) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
641 merge-autostore-dir (ediff-get-group-merge-autostore-dir meta-list)) |
13130 | 642 |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
643 (cond ((ediff-collect-diffs-metajob) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
644 (insert |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
645 " `P':\tcollect custom diffs of all marked sessions\n")) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
646 ((ediff-patch-metajob) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
647 (insert |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
648 " `P':\tshow patch appropriately for the context (session or group)\n"))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
649 (insert |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
650 " `u':\tshow parent session group\n") |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
651 (or (ediff-one-filegroup-metajob) |
13130 | 652 (insert |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
653 " `D':\tshow differences among directories\n" |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
654 " `=':\tmark identical files in each session\n\n")) |
13130 | 655 |
656 (if (and (stringp regexp) (> (length regexp) 0)) | |
657 (insert (format "Filter-through regular expression: %s\n" regexp))) | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
658 (if (and ediff-autostore-merges (ediff-merge-metajob) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
659 (stringp merge-autostore-dir)) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
660 (insert (format |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
661 "\nMerges are automatically stored in directory: %s\n" |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
662 merge-autostore-dir))) |
13130 | 663 (insert "\n |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
664 Size Last modified Name |
13130 | 665 ----------------------------------------------------------------------- |
666 | |
667 ") | |
668 | |
669 ;; discard info on directories and regexp | |
670 (setq meta-list (cdr meta-list) | |
671 tmp-list meta-list) | |
672 (while (and tmp-list empty) | |
673 (if (and (car tmp-list) | |
674 (not (eq (ediff-get-session-status (car tmp-list)) ?I))) | |
675 (setq empty nil)) | |
676 (setq tmp-list (cdr tmp-list))) | |
677 | |
678 (if empty | |
679 (insert | |
680 " ****** ****** This session group has no members\n")) | |
681 | |
682 ;; now organize file names like this: | |
683 ;; use-mark sizeA dateA sizeB dateB filename | |
684 ;; make sure directories are displayed with a trailing slash. | |
685 (while meta-list | |
686 (setq elt (car meta-list) | |
687 meta-list (cdr meta-list) | |
688 sessionNum (1+ sessionNum)) | |
689 (if (eq (ediff-get-session-status elt) ?I) | |
690 () | |
691 (setq session-buf (ediff-get-session-buffer elt) | |
692 f1 (ediff-get-session-objA elt) | |
693 f2 (ediff-get-session-objB elt) | |
694 f3 (ediff-get-session-objC elt)) | |
695 (setq pt (point)) | |
696 ;; insert markers | |
697 (insert (cond ((null session-buf) " ") ; virgin session | |
698 ((ediff-buffer-live-p session-buf) "+") ;active session | |
699 (t "-"))) ; finished session | |
700 (insert (cond ((ediff-get-session-status elt)) ; session has status, | |
701 ;;; e.g., ?H, ?I | |
702 (t " "))) ; normal session | |
703 (insert " Session " (int-to-string sessionNum) ":\n") | |
704 (ediff-meta-insert-file-info f1) | |
705 (ediff-meta-insert-file-info f2) | |
706 (ediff-meta-insert-file-info f3) | |
707 (ediff-set-meta-overlay pt (point) elt))) | |
708 (set-buffer-modified-p nil) | |
709 (goto-char point) | |
710 meta-buf))) | |
711 | |
712 ;; Check if this is a problematic session. | |
713 ;; Return nil if not. Otherwise, return symbol representing the problem | |
714 ;; At present, problematic sessions occur only in -with-ancestor comparisons | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
715 ;; when the ancestor is a directory rather than a file, or when there is no |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
716 ;; suitable ancestor file in the ancestor directory |
13130 | 717 (defun ediff-problematic-session-p (session) |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
718 (let ((f1 (ediff-get-session-objA-name session)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
719 (f2 (ediff-get-session-objB-name session)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
720 (f3 (ediff-get-session-objC-name session))) |
13130 | 721 (cond ((and (stringp f1) (not (file-directory-p f1)) |
722 (stringp f2) (not (file-directory-p f2)) | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
723 ;; either invalid file name or a directory |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
724 (or (not (stringp f3)) (file-directory-p f3)) |
13130 | 725 (ediff-ancestor-metajob)) |
726 ;; more may be added later | |
727 'ancestor-is-dir) | |
728 (t nil)))) | |
729 | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
730 (defun ediff-meta-insert-file-info (fileinfo) |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
731 (let ((fname (car fileinfo)) |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
732 (feq (ediff-get-file-eqstatus fileinfo)) |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
733 file-modtime file-size) |
13130 | 734 |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
735 (cond ((not (stringp fname)) (setq file-size -2)) ; file doesn't exits |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
736 ((not (ediff-file-remote-p fname)) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
737 (if (file-exists-p fname) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
738 ;; set real size and modtime |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
739 (setq file-size (ediff-file-size fname) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
740 file-modtime (ediff-file-modtime fname)) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
741 (setq file-size -2))) ; file doesn't exist |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
742 ( t (setq file-size -1))) ; remote file |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
743 (if (stringp fname) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
744 (insert |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
745 (format |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
746 "%s %s %-20s %s\n" |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
747 (if feq "=" " ") ; equality indicator |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
748 (format "%10s" (cond ((= file-size -1) "--") |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
749 ((< file-size -1) "--") |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
750 (t file-size))) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
751 (cond ((= file-size -1) "*remote file*") |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
752 ((< file-size -1) "*file doesn't exist*") |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
753 (t (ediff-format-date (decode-time file-modtime)))) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
754 |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
755 ;; dir names in meta lists have training slashes, so we just |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
756 ;; abbreviate the file name, if file exists |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
757 (if (and (not (stringp fname)) (< file-size -1)) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
758 "-------" ; file doesn't exist |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
759 (ediff-abbreviate-file-name fname))))))) |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
760 |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
761 (defconst ediff-months '((1 . "Jan") (2 . "Feb") (3 . "Mar") (4 . "Apr") |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
762 (5 . "May") (6 . "Jun") (7 . "Jul") (8 . "Aug") |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
763 (9 . "Sep") (10 . "Oct") (11 . "Nov") (12 . "Dec")) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
764 "Months' associative array.") |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
765 |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
766 ;; returns 2char string |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
767 (defsubst ediff-fill-leading-zero (num) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
768 (if (< num 10) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
769 (format "0%d" num) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
770 (number-to-string num))) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
771 |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
772 ;; TIME is like the output of decode-time |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
773 (defun ediff-format-date (time) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
774 (format "%s %2d %4d %s:%s:%s" |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
775 (cdr (assoc (nth 4 time) ediff-months)) ; month |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
776 (nth 3 time) ; day |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
777 (nth 5 time) ; year |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
778 (ediff-fill-leading-zero (nth 2 time)) ; hour |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
779 (ediff-fill-leading-zero (nth 1 time)) ; min |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
780 (ediff-fill-leading-zero (nth 0 time)) ; sec |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
781 )) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
782 |
13130 | 783 (defun ediff-draw-dir-diffs (diff-list) |
784 (if (null diff-list) (error "Lost difference info on these directories")) | |
785 (let* ((buf-name (ediff-unique-buffer-name | |
786 "*Ediff File Group Differences" "*")) | |
787 (regexp (ediff-get-group-regexp diff-list)) | |
788 (dir1 (ediff-abbreviate-file-name (ediff-get-group-objA diff-list))) | |
789 (dir2 (ediff-abbreviate-file-name (ediff-get-group-objB diff-list))) | |
790 (dir3 (ediff-get-group-objC diff-list)) | |
791 (dir3 (if (stringp dir3) (ediff-abbreviate-file-name dir3))) | |
792 (meta-buf (ediff-get-group-buffer diff-list)) | |
793 (underline (make-string 26 ?-)) | |
794 file code | |
795 buffer-read-only) | |
796 ;; skip the directory part | |
797 (setq diff-list (cdr diff-list)) | |
798 (setq ediff-dir-diffs-buffer (get-buffer-create buf-name)) | |
799 (ediff-eval-in-buffer ediff-dir-diffs-buffer | |
800 (use-local-map ediff-dir-diffs-buffer-map) | |
801 (erase-buffer) | |
802 (setq ediff-meta-buffer meta-buf) | |
803 (insert "\t\t*** Directory Differences ***\n") | |
804 (insert " | |
805 Useful commands: | |
806 `q': hide this buffer | |
807 SPC: next line | |
808 DEL: previous line\n\n") | |
809 | |
810 (if (and (stringp regexp) (> (length regexp) 0)) | |
811 (insert (format "Filter-through regular expression: %s\n" regexp))) | |
812 (insert "\n") | |
813 (insert (format "\n%-27s%-26s" | |
814 (ediff-truncate-string-left | |
815 (ediff-abbreviate-file-name | |
816 (file-name-as-directory dir1)) | |
817 25) | |
818 (ediff-truncate-string-left | |
819 (ediff-abbreviate-file-name | |
820 (file-name-as-directory dir2)) | |
821 25))) | |
822 (if dir3 | |
823 (insert (format " %-25s\n" | |
824 (ediff-truncate-string-left | |
825 (ediff-abbreviate-file-name | |
826 (file-name-as-directory dir3)) | |
827 25))) | |
828 (insert "\n")) | |
829 (insert (format "%s%s" underline underline)) | |
830 (if (stringp dir3) | |
831 (insert (format "%s\n\n" underline)) | |
832 (insert "\n\n")) | |
833 | |
834 (if (null diff-list) | |
835 (insert "\n\t*** No differences ***\n")) | |
836 | |
837 (while diff-list | |
838 (setq file (car (car diff-list)) | |
839 code (cdr (car diff-list)) | |
840 diff-list (cdr diff-list)) | |
841 (if (= (mod code 2) 0) ; dir1 | |
842 (insert (format "%-27s" | |
843 (ediff-truncate-string-left | |
844 (ediff-abbreviate-file-name | |
845 (if (file-directory-p (concat dir1 file)) | |
846 (file-name-as-directory file) | |
847 file)) | |
848 24))) | |
849 (insert (format "%-27s" "---"))) | |
850 (if (= (mod code 3) 0) ; dir2 | |
851 (insert (format "%-26s" | |
852 (ediff-truncate-string-left | |
853 (ediff-abbreviate-file-name | |
854 (if (file-directory-p (concat dir2 file)) | |
855 (file-name-as-directory file) | |
856 file)) | |
857 24))) | |
858 (insert (format "%-26s" "---"))) | |
859 (if (stringp dir3) | |
860 (if (= (mod code 5) 0) ; dir3 | |
861 (insert (format " %-25s" | |
862 (ediff-truncate-string-left | |
863 (ediff-abbreviate-file-name | |
864 (if (file-directory-p (concat dir3 file)) | |
865 (file-name-as-directory file) | |
866 file)) | |
867 24))) | |
868 (insert (format " %-25s" "---")))) | |
869 (insert "\n")) | |
870 (setq buffer-read-only t) | |
871 (set-buffer-modified-p nil)) ; eval in diff buffer | |
872 )) | |
873 | |
874 (defun ediff-bury-dir-diffs-buffer () | |
875 "Bury the directory difference buffer. Display the meta buffer instead." | |
876 (interactive) | |
877 (let ((buf ediff-meta-buffer) | |
878 wind) | |
879 (bury-buffer) | |
880 (if (setq wind (ediff-get-visible-buffer-window buf)) | |
881 (select-window wind) | |
882 (set-window-buffer (selected-window) buf)))) | |
883 | |
884 ;; executes in dir session group buffer | |
885 ;; show buffer differences | |
886 (defun ediff-show-dir-diffs () | |
887 "Display differences among the directories involved in session group." | |
888 (interactive) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
889 (if (ediff-one-filegroup-metajob) |
13130 | 890 (error "This command is inapplicable in the present context")) |
891 (or (ediff-buffer-live-p ediff-dir-diffs-buffer) | |
892 (ediff-draw-dir-diffs ediff-dir-difference-list)) | |
893 (let ((buf ediff-dir-diffs-buffer)) | |
894 (other-window 1) | |
895 (set-window-buffer (selected-window) buf) | |
896 (goto-char (point-min)))) | |
897 | |
898 (defun ediff-up-meta-hierarchy () | |
899 "Go to the parent session group buffer." | |
900 (interactive) | |
901 (if (ediff-buffer-live-p ediff-parent-meta-buffer) | |
902 (ediff-show-meta-buffer ediff-parent-meta-buffer) | |
903 (error "This session group has no parent"))) | |
904 | |
905 | |
906 ;; argument is ignored | |
907 (defun ediff-redraw-registry-buffer (&optional ignore) | |
908 (ediff-eval-in-buffer ediff-registry-buffer | |
909 (let ((point (point)) | |
910 elt bufAname bufBname bufCname cur-diff total-diffs pt | |
911 job-name meta-list registry-list buffer-read-only) | |
912 (erase-buffer) | |
913 (insert "This is a registry of all active Ediff sessions. | |
914 | |
915 Useful commands: | |
916 button2, `v', RET over a session record: switch to that session | |
917 `M' over a session record: display the associated session group | |
918 `R' in any Ediff session: display session registry | |
919 SPC:\tnext session | |
920 DEL:\tprevious session | |
921 `E':\tbrowse Ediff on-line manual | |
922 `q':\tbury registry | |
923 | |
924 | |
925 \t\tActive Ediff Sessions: | |
926 \t\t---------------------- | |
927 | |
928 ") | |
929 ;; purge registry list from dead buffers | |
930 (mapcar (function (lambda (elt) | |
931 (if (not (ediff-buffer-live-p elt)) | |
932 (setq ediff-session-registry | |
933 (delq elt ediff-session-registry))))) | |
934 ediff-session-registry) | |
935 | |
936 (if (null ediff-session-registry) | |
937 (insert " ******* No active Ediff sessions *******\n")) | |
938 | |
939 (setq registry-list ediff-session-registry) | |
940 (while registry-list | |
941 (setq elt (car registry-list) | |
942 registry-list (cdr registry-list)) | |
943 | |
944 (if (ediff-buffer-live-p elt) | |
945 (if (ediff-eval-in-buffer elt | |
946 (setq job-name ediff-metajob-name | |
947 meta-list ediff-meta-list) | |
948 (and ediff-metajob-name | |
949 (not (eq ediff-metajob-name 'ediff-registry)))) | |
950 (progn | |
951 (setq pt (point)) | |
952 (insert (format " *group*\t%s: %s\n" | |
953 (buffer-name elt) | |
954 (ediff-abbrev-jobname job-name))) | |
955 (insert (format "\t\t %s %s %s\n" | |
956 (ediff-abbreviate-file-name | |
957 (ediff-get-group-objA meta-list)) | |
958 (ediff-abbreviate-file-name | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
959 (if (stringp |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
960 (ediff-get-group-objB meta-list)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
961 (ediff-get-group-objB meta-list) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
962 "")) |
13130 | 963 (ediff-abbreviate-file-name |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
964 (if (stringp |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
965 (ediff-get-group-objC meta-list)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
966 (ediff-get-group-objC meta-list) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
967 "")))) |
13130 | 968 (ediff-set-meta-overlay pt (point) elt)) |
969 (progn | |
970 (ediff-eval-in-buffer elt | |
971 (setq bufAname (if (ediff-buffer-live-p ediff-buffer-A) | |
972 (buffer-name ediff-buffer-A) | |
973 "!!!killed buffer!!!") | |
974 bufBname (if (ediff-buffer-live-p ediff-buffer-B) | |
975 (buffer-name ediff-buffer-B) | |
976 "!!!killed buffer!!!") | |
977 bufCname (cond ((not (ediff-3way-job)) | |
978 "") | |
979 ((ediff-buffer-live-p ediff-buffer-C) | |
980 (buffer-name ediff-buffer-C)) | |
981 (t "!!!killed buffer!!!"))) | |
982 (setq total-diffs (format "%-4d" ediff-number-of-differences) | |
983 cur-diff | |
984 (cond ((= ediff-current-difference -1) " _") | |
985 ((= ediff-current-difference | |
986 ediff-number-of-differences) | |
987 " $") | |
988 (t (format | |
989 "%4d" (1+ ediff-current-difference)))) | |
990 job-name ediff-job-name)) | |
991 ;; back in the meta buf | |
992 (setq pt (point)) | |
993 (insert cur-diff "/" total-diffs "\t" | |
994 (buffer-name elt) | |
995 (format ": %s" (ediff-abbrev-jobname job-name))) | |
996 (insert | |
997 "\n\t\t " bufAname " " bufBname " " bufCname "\n") | |
998 (ediff-set-meta-overlay pt (point) elt)))) | |
999 ) ; while | |
1000 (set-buffer-modified-p nil) | |
1001 (goto-char point) | |
1002 ))) | |
1003 | |
1004 ;; sets overlay around a meta record with 'ediff-meta-info property PROP | |
1005 (defun ediff-set-meta-overlay (b e prop) | |
1006 (let (overl) | |
1007 (setq overl (ediff-make-overlay b e)) | |
1008 (if ediff-emacs-p | |
1009 (ediff-overlay-put overl 'mouse-face 'highlight) | |
1010 (ediff-overlay-put overl 'highlight t)) | |
1011 (ediff-overlay-put overl 'ediff-meta-info prop))) | |
1012 | |
1013 (defun ediff-mark-for-hiding (unmark) | |
1014 "Mark session for hiding. With prefix arg, unmark." | |
1015 (interactive "P") | |
1016 (let* ((pos (ediff-event-point last-command-event)) | |
1017 (meta-buf (ediff-event-buffer last-command-event)) | |
1018 ;; ediff-get-meta-info gives error if meta-buf or pos are invalid | |
1019 (info (ediff-get-meta-info meta-buf pos)) | |
1020 (session-buf (ediff-get-session-buffer info))) | |
1021 | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1022 (if (eq (ediff-get-session-status info) ?H) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1023 (setq unmark t)) |
13130 | 1024 (if unmark |
1025 (ediff-set-session-status info nil) | |
1026 (if (ediff-buffer-live-p session-buf) | |
1027 (error "Can't hide active session, %s" (buffer-name session-buf))) | |
1028 (ediff-set-session-status info ?H)) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1029 (or unmark |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1030 (ediff-next-meta-item 1)) |
13130 | 1031 (ediff-update-meta-buffer meta-buf) |
1032 )) | |
1033 | |
1034 (defun ediff-mark-for-operation (unmark) | |
1035 "Mark session for a group operation. With prefix arg, unmark." | |
1036 (interactive "P") | |
1037 (let* ((pos (ediff-event-point last-command-event)) | |
1038 (meta-buf (ediff-event-buffer last-command-event)) | |
1039 ;; ediff-get-meta-info gives error if meta-buf or pos are invalid | |
1040 (info (ediff-get-meta-info meta-buf pos))) | |
1041 | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1042 (if (eq (ediff-get-session-status info) ?*) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1043 (setq unmark t)) |
13130 | 1044 (if unmark |
1045 (ediff-set-session-status info nil) | |
1046 (ediff-set-session-status info ?*)) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1047 (or unmark |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1048 (ediff-next-meta-item 1)) |
13130 | 1049 (ediff-update-meta-buffer meta-buf) |
1050 )) | |
1051 | |
1052 (defun ediff-hide-marked-sessions (unhide) | |
1053 "Hide marked sessions. With prefix arg, unhide." | |
1054 (interactive "P") | |
1055 (let ((grp-buf (ediff-get-group-buffer ediff-meta-list)) | |
1056 (meta-list (cdr ediff-meta-list)) | |
1057 (from (if unhide ?I ?H)) | |
1058 (to (if unhide ?H ?I)) | |
1059 (numMarked 0) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1060 active-sessions-exist session-buf elt) |
13130 | 1061 (while meta-list |
1062 (setq elt (car meta-list) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1063 meta-list (cdr meta-list) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1064 session-buf (ediff-get-session-buffer elt)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1065 |
13130 | 1066 (if (eq (ediff-get-session-status elt) from) |
1067 (progn | |
1068 (setq numMarked (1+ numMarked)) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1069 (if (and (eq to ?I) (buffer-live-p session-buf)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1070 ;; shouldn't hide active sessions |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1071 (setq active-sessions-exist t) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1072 (ediff-set-session-status elt to))))) |
13130 | 1073 (if (> numMarked 0) |
1074 (ediff-update-meta-buffer grp-buf) | |
1075 (beep) | |
1076 (if unhide | |
1077 (message "Nothing to reveal...") | |
1078 (message "Nothing to hide..."))) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1079 (if active-sessions-exist |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1080 (message "Note: didn't hide active sessions!")) |
13130 | 1081 )) |
1082 | |
1083 ;; Apply OPERATION to marked sessions. Operation expects one argument of type | |
1084 ;; meta-list member (not the first one), i.e., a regular session description. | |
1085 ;; Returns number of marked sessions on which operation was performed | |
1086 (defun ediff-operate-on-marked-sessions (operation) | |
1087 (let ((grp-buf (ediff-get-group-buffer ediff-meta-list)) | |
1088 (meta-list (cdr ediff-meta-list)) | |
1089 (marksym ?*) | |
1090 (numMarked 0) | |
1091 (sessionNum 0) | |
1092 elt) | |
1093 (while meta-list | |
1094 (setq elt (car meta-list) | |
1095 meta-list (cdr meta-list) | |
1096 sessionNum (1+ sessionNum)) | |
1097 (if (eq (ediff-get-session-status elt) marksym) | |
1098 (save-excursion | |
1099 (setq numMarked (1+ numMarked)) | |
1100 (funcall operation elt sessionNum)))) | |
1101 (ediff-update-meta-buffer grp-buf) ; just in case | |
1102 numMarked | |
1103 )) | |
1104 | |
1105 (defun ediff-append-custom-diff (session sessionNum) | |
1106 (or (ediff-collect-diffs-metajob) | |
1107 (error "Sorry, I don't do this for everyone...")) | |
1108 (let ((session-buf (ediff-get-session-buffer session)) | |
1109 (meta-diff-buff ediff-meta-diff-buffer) | |
1110 (metajob ediff-metajob-name) | |
1111 tmp-buf custom-diff-buf) | |
1112 (if (ediff-buffer-live-p session-buf) | |
1113 (ediff-eval-in-buffer session-buf | |
1114 (if (eq ediff-control-buffer session-buf) ; individual session | |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1115 (progn |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1116 (ediff-compute-custom-diffs-maybe) |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1117 (setq custom-diff-buf ediff-custom-diff-buffer))))) |
13130 | 1118 |
1119 (or (ediff-buffer-live-p meta-diff-buff) | |
1120 (error "Ediff: something wrong--no multiple diffs buffer")) | |
1121 | |
1122 (cond ((ediff-buffer-live-p custom-diff-buf) | |
1123 (save-excursion | |
1124 (set-buffer meta-diff-buff) | |
1125 (goto-char (point-max)) | |
1126 (insert-buffer custom-diff-buf) | |
1127 (insert "\n"))) | |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1128 ((memq metajob '(ediff-directories |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1129 ediff-merge-directories |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1130 ediff-merge-directories-with-ancestor)) |
13130 | 1131 ;; get diffs by calling shell command on ediff-custom-diff-program |
1132 (save-excursion | |
1133 (set-buffer (setq tmp-buf (get-buffer-create ediff-tmp-buffer))) | |
1134 (erase-buffer) | |
1135 (shell-command | |
1136 (format "%s %s %s %s" | |
1137 ediff-custom-diff-program ediff-custom-diff-options | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1138 (ediff-get-session-objA-name session) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1139 (ediff-get-session-objB-name session)) |
13130 | 1140 t)) |
1141 (save-excursion | |
1142 (set-buffer meta-diff-buff) | |
1143 (goto-char (point-max)) | |
1144 (insert-buffer tmp-buf) | |
1145 (insert "\n"))) | |
1146 (t | |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1147 (error "Can't make context diff for Session %d" sessionNum ))) |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1148 )) |
13130 | 1149 |
1150 (defun ediff-collect-custom-diffs () | |
1151 "Collect custom diffs of marked sessions in buffer `*Ediff Multifile Diffs*'. | |
1152 This operation is defined only for `ediff-directories' and | |
1153 `ediff-directory-revisions', since its intent is to produce | |
1154 multifile patches. For `ediff-directory-revisions', we insist that | |
1155 all marked sessions must be active." | |
1156 (interactive) | |
1157 (or (ediff-buffer-live-p ediff-meta-diff-buffer) | |
1158 (setq ediff-meta-diff-buffer | |
1159 (get-buffer-create | |
1160 (ediff-unique-buffer-name "*Ediff Multifile Diffs" "*")))) | |
1161 (ediff-eval-in-buffer ediff-meta-diff-buffer | |
1162 (erase-buffer)) | |
1163 (if (> (ediff-operate-on-marked-sessions 'ediff-append-custom-diff) 0) | |
1164 ;; did something | |
1165 (display-buffer ediff-meta-diff-buffer 'not-this-window) | |
1166 (beep) | |
1167 (message "No marked sessions found"))) | |
1168 | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1169 (defun ediff-meta-show-patch () |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1170 "Show the multi-file patch associated with this group session." |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1171 (interactive) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1172 (let* ((pos (ediff-event-point last-command-event)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1173 (meta-buf (ediff-event-buffer last-command-event)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1174 (info (ediff-get-meta-info meta-buf pos 'noerror)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1175 (patchbuffer ediff-meta-patchbufer)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1176 (if (ediff-buffer-live-p patchbuffer) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1177 (ediff-eval-in-buffer patchbuffer |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1178 (save-restriction |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1179 (if (not info) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1180 (widen) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1181 (narrow-to-region |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1182 (ediff-get-session-objB-name info) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1183 (ediff-get-session-objC-name info))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1184 (set-buffer (get-buffer-create ediff-tmp-buffer)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1185 (erase-buffer) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1186 (insert-buffer patchbuffer) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1187 (display-buffer ediff-tmp-buffer 'not-this-window) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1188 )) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1189 (error "The patch buffer wasn't found")))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1190 |
13130 | 1191 |
1192 ;; This function executes in meta buffer. It knows where event happened. | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1193 (defun ediff-filegroup-action () |
13130 | 1194 "Execute appropriate action for the selected session." |
1195 (interactive) | |
1196 (let* ((pos (ediff-event-point last-command-event)) | |
1197 (meta-buf (ediff-event-buffer last-command-event)) | |
1198 ;; ediff-get-meta-info gives error if meta-buf or pos are invalid | |
1199 (info (ediff-get-meta-info meta-buf pos)) | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1200 merge-autostore-dir |
13130 | 1201 session-buf file1 file2 file3 regexp) |
1202 | |
1203 (setq session-buf (ediff-get-session-buffer info) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1204 file1 (ediff-get-session-objA-name info) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1205 file2 (ediff-get-session-objB-name info) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1206 file3 (ediff-get-session-objC-name info)) |
13130 | 1207 |
1208 ;; make sure we don't start on hidden sessions | |
1209 ;; ?H means marked for hiding. ?I means invalid (hidden). | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1210 (if (memq (ediff-get-session-status info) '(?I)) |
13130 | 1211 (progn |
1212 (beep) | |
1213 (if (y-or-n-p "This session is marked as hidden, unmark? ") | |
1214 (progn | |
1215 (ediff-set-session-status info nil) | |
1216 (ediff-update-meta-buffer meta-buf)) | |
1217 (error "Aborted")))) | |
1218 | |
1219 (ediff-eval-in-buffer meta-buf | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1220 (setq merge-autostore-dir |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1221 (ediff-get-group-merge-autostore-dir ediff-meta-list)) |
13130 | 1222 (goto-char pos) ; if the user clicked on session--move point there |
1223 ;; First handle sessions involving directories (which are themselves | |
1224 ;; session groups) | |
1225 ;; After that handle individual sessions | |
1226 (cond ((and (file-directory-p file1) | |
1227 (stringp file2) (file-directory-p file2) | |
1228 (if (stringp file3) (file-directory-p file1) t)) | |
1229 ;; do ediff/ediff-merge on subdirectories | |
1230 (if (ediff-buffer-live-p session-buf) | |
1231 (ediff-show-meta-buffer session-buf) | |
1232 (setq regexp (read-string "Filter through regular expression: " | |
1233 nil 'ediff-filtering-regexp-history)) | |
1234 (ediff-directories-internal | |
1235 file1 file2 file3 regexp | |
1236 ediff-session-action-function | |
1237 ediff-metajob-name | |
1238 ;; make it update car info after startup | |
1239 (` (list (lambda () | |
1240 ;; child session group should know its parent | |
1241 (setq ediff-parent-meta-buffer | |
1242 (quote (, ediff-meta-buffer))) | |
1243 ;; and parent will know its child | |
1244 (setcar (quote (, info)) ediff-meta-buffer))))))) | |
1245 | |
1246 ;; Do ediff-revision on a subdirectory | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1247 ((and (ediff-one-filegroup-metajob) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1248 (ediff-revision-metajob) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1249 (file-directory-p file1)) |
13130 | 1250 (if (ediff-buffer-live-p session-buf) |
1251 (ediff-show-meta-buffer session-buf) | |
1252 (setq regexp (read-string "Filter through regular expression: " | |
1253 nil 'ediff-filtering-regexp-history)) | |
1254 (ediff-directory-revisions-internal | |
1255 file1 regexp | |
1256 ediff-session-action-function ediff-metajob-name | |
1257 ;; make it update car info after startup | |
1258 (` (list (lambda () | |
1259 ;; child session group should know its parent | |
1260 (setq ediff-parent-meta-buffer | |
1261 (quote (, ediff-meta-buffer))) | |
1262 ;; and parent will know its child | |
1263 (setcar (quote (, info)) ediff-meta-buffer))))))) | |
1264 | |
1265 ;; From here on---only individual session handlers | |
1266 | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1267 ;; handle an individual session with a live control buffer |
13130 | 1268 ((ediff-buffer-live-p session-buf) |
1269 (ediff-eval-in-buffer session-buf | |
1270 (setq ediff-mouse-pixel-position (mouse-pixel-position)) | |
1271 (ediff-recenter 'no-rehighlight))) | |
1272 | |
1273 ((ediff-problematic-session-p info) | |
1274 (beep) | |
1275 (if (y-or-n-p | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1276 "This session has no ancestor. Merge without the ancestor? ") |
13130 | 1277 (ediff-merge-files |
1278 file1 file2 | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1279 ;; provide startup hooks |
13130 | 1280 (` (list (lambda () |
1281 (setq ediff-meta-buffer (, (current-buffer))) | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1282 (setq ediff-merge-store-file |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1283 (, (concat |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1284 merge-autostore-dir |
16766
beb94a5271e2
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
16248
diff
changeset
|
1285 "mrg_" |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1286 (file-name-nondirectory file1)))) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1287 ;; make ediff-startup pass |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1288 ;; ediff-control-buffer back to the meta |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1289 ;; level; see below |
13130 | 1290 (setcar |
1291 (quote (, info)) ediff-control-buffer))))) | |
1292 (error "Aborted"))) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1293 ((ediff-one-filegroup-metajob) ; needs 1 file arg |
13130 | 1294 (funcall ediff-session-action-function |
1295 file1 | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1296 ;; provide startup hooks |
13130 | 1297 (` (list (lambda () |
1298 (setq ediff-meta-buffer (, (current-buffer))) | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1299 (setq ediff-merge-store-file |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1300 (, (concat |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1301 merge-autostore-dir |
16766
beb94a5271e2
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
16248
diff
changeset
|
1302 "mrg_" |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1303 (file-name-nondirectory file1)))) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1304 ;; make ediff-startup pass |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1305 ;; ediff-control-buffer back to the meta |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1306 ;; level; see below |
13130 | 1307 (setcar |
1308 (quote (, info)) ediff-control-buffer)))))) | |
1309 ((not (ediff-metajob3)) ; need 2 file args | |
1310 (funcall ediff-session-action-function | |
1311 file1 file2 | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1312 ;; provide startup hooks |
13130 | 1313 (` (list (lambda () |
1314 (setq ediff-meta-buffer (, (current-buffer))) | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1315 (setq ediff-merge-store-file |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1316 (, (concat |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1317 merge-autostore-dir |
16766
beb94a5271e2
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
16248
diff
changeset
|
1318 "mrg_" |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1319 (file-name-nondirectory file1)))) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1320 ;; make ediff-startup pass |
13130 | 1321 ;; ediff-control-buffer back to the meta |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1322 ;; level; see below |
13130 | 1323 (setcar |
1324 (quote (, info)) ediff-control-buffer)))))) | |
1325 ((ediff-metajob3) ; need 3 file args | |
1326 (funcall ediff-session-action-function | |
1327 file1 file2 file3 | |
1328 ;; arrange startup hooks | |
1329 (` (list (lambda () | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1330 (setq ediff-merge-store-file |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1331 (, (concat |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1332 merge-autostore-dir |
16766
beb94a5271e2
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
16248
diff
changeset
|
1333 "mrg_" |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1334 (file-name-nondirectory file1)))) |
13130 | 1335 (setq ediff-meta-buffer (, (current-buffer))) |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1336 ;; this arranges that ediff-startup will pass |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1337 ;; the value of ediff-control-buffer back to |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1338 ;; the meta level, to the record in the meta |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1339 ;; list containing the information about the |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1340 ;; session associated with that |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1341 ;; ediff-control-buffer |
13130 | 1342 (setcar |
1343 (quote (, info)) ediff-control-buffer)))))) | |
1344 ) ; cond | |
1345 ) ; eval in meta-buf | |
1346 )) | |
1347 | |
1348 (defun ediff-registry-action () | |
1349 "Switch to a selected session." | |
1350 (interactive) | |
1351 (let* ((pos (ediff-event-point last-command-event)) | |
1352 (buf (ediff-event-buffer last-command-event)) | |
1353 (ctl-buf (ediff-get-meta-info buf pos))) | |
1354 | |
1355 (if (ediff-buffer-live-p ctl-buf) | |
1356 ;; check if this is ediff-control-buffer or ediff-meta-buffer | |
1357 (if (ediff-eval-in-buffer ctl-buf | |
1358 (eq (key-binding "q") 'ediff-quit-meta-buffer)) | |
1359 ;; it's a meta-buffer -- last action should just display it | |
1360 (ediff-show-meta-buffer ctl-buf) | |
1361 ;; it's a session buffer -- invoke go back to session | |
1362 (ediff-eval-in-buffer ctl-buf | |
1363 (setq ediff-mouse-pixel-position (mouse-pixel-position)) | |
1364 (ediff-recenter 'no-rehighlight))) | |
1365 (beep) | |
1366 (message "You've selected a stale session --- try again") | |
1367 (ediff-update-registry)) | |
1368 (ediff-eval-in-buffer buf | |
1369 (goto-char pos)) | |
1370 )) | |
1371 | |
1372 | |
1373 (defun ediff-show-meta-buffer (&optional meta-buf) | |
1374 "Show the session group buffer." | |
1375 (interactive) | |
1376 (let (wind frame silent) | |
1377 (if meta-buf (setq silent t)) | |
1378 | |
1379 (setq meta-buf (or meta-buf ediff-meta-buffer)) | |
1380 (cond ((not (bufferp meta-buf)) | |
1381 (error "This Ediff session is not part of a session group")) | |
1382 ((not (ediff-buffer-live-p meta-buf)) | |
1383 (error | |
1384 "Can't find this session's group panel -- session itself is ok"))) | |
1385 | |
1386 (ediff-cleanup-meta-buffer meta-buf) | |
1387 (ediff-eval-in-buffer meta-buf | |
1388 (save-excursion | |
1389 (cond ((setq wind (ediff-get-visible-buffer-window meta-buf)) | |
1390 (or silent | |
1391 (message | |
1392 "Already showing the group panel for this session")) | |
1393 (set-window-buffer wind meta-buf) | |
1394 (select-window wind)) | |
1395 ((window-live-p (setq wind ediff-window-C)) ;in merge--merge buf | |
1396 (set-window-buffer ediff-window-C meta-buf) | |
1397 (select-window wind)) | |
1398 ((window-live-p (setq wind ediff-window-A)) | |
1399 (set-window-buffer ediff-window-A meta-buf) | |
1400 (select-window wind)) | |
1401 ((window-live-p (setq wind ediff-window-B)) | |
1402 (set-window-buffer ediff-window-B meta-buf) | |
1403 (select-window wind)) | |
1404 ((and | |
1405 (setq wind | |
1406 (ediff-get-visible-buffer-window ediff-registry-buffer)) | |
1407 (ediff-window-display-p)) | |
1408 (select-window wind) | |
1409 (other-window 1) | |
1410 (set-window-buffer (selected-window) meta-buf)) | |
1411 (t (ediff-skip-unsuitable-frames 'ok-unsplittable) | |
1412 (set-window-buffer (selected-window) meta-buf))) | |
1413 )) | |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1414 (if (and (ediff-window-display-p) |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1415 (window-live-p |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1416 (setq wind (ediff-get-visible-buffer-window meta-buf)))) |
13130 | 1417 (progn |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1418 (setq frame (window-frame wind)) |
13130 | 1419 (raise-frame frame) |
1420 (ediff-reset-mouse frame))) | |
1421 (run-hooks 'ediff-show-session-group-hook) | |
1422 )) | |
1423 | |
1424 (defun ediff-show-meta-buff-from-registry () | |
1425 "Display the session group buffer for a selected session group." | |
1426 (interactive) | |
1427 (let* ((pos (ediff-event-point last-command-event)) | |
1428 (meta-buf (ediff-event-buffer last-command-event)) | |
1429 (info (ediff-get-meta-info meta-buf pos)) | |
1430 (meta-or-session-buf info)) | |
1431 (ediff-eval-in-buffer meta-or-session-buf | |
1432 (ediff-show-meta-buffer)))) | |
1433 | |
1434 ;;;###autoload | |
1435 (defun ediff-show-registry () | |
1436 "Display Ediff's registry." | |
1437 (interactive) | |
1438 (ediff-update-registry) | |
1439 (if (not (ediff-buffer-live-p ediff-registry-buffer)) | |
1440 (error "No active Ediff sessions or corrupted session registry")) | |
1441 (let (wind frame) | |
1442 ;; for some reason, point moves in ediff-registry-buffer, so we preserve it | |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1443 ;; explicitly |
13130 | 1444 (ediff-eval-in-buffer ediff-registry-buffer |
1445 (save-excursion | |
1446 (cond ((setq wind | |
1447 (ediff-get-visible-buffer-window ediff-registry-buffer)) | |
1448 (message "Already showing the registry") | |
1449 (set-window-buffer wind ediff-registry-buffer) | |
1450 (select-window wind)) | |
1451 ((window-live-p ediff-window-C) | |
1452 (set-window-buffer ediff-window-C ediff-registry-buffer) | |
1453 (select-window ediff-window-C)) | |
1454 ((window-live-p ediff-window-A) | |
1455 (set-window-buffer ediff-window-A ediff-registry-buffer) | |
1456 (select-window ediff-window-A)) | |
1457 ((window-live-p ediff-window-B) | |
1458 (set-window-buffer ediff-window-B ediff-registry-buffer) | |
1459 (select-window ediff-window-B)) | |
1460 ((and (setq wind | |
1461 (ediff-get-visible-buffer-window ediff-meta-buffer)) | |
1462 (ediff-window-display-p)) | |
1463 (select-window wind) | |
1464 (other-window 1) | |
1465 (set-window-buffer (selected-window) ediff-registry-buffer)) | |
1466 (t (ediff-skip-unsuitable-frames 'ok-unsplittable) | |
1467 (set-window-buffer (selected-window) ediff-registry-buffer))) | |
1468 )) | |
1469 (if (ediff-window-display-p) | |
1470 (progn | |
1471 (setq frame | |
1472 (window-frame | |
1473 (ediff-get-visible-buffer-window ediff-registry-buffer))) | |
1474 (raise-frame frame) | |
1475 (ediff-reset-mouse frame))) | |
1476 (run-hooks 'ediff-show-registry-hook) | |
1477 )) | |
1478 | |
1479 ;;;###autoload | |
1480 (defalias 'eregistry 'ediff-show-registry) | |
1481 | |
1482 ;; If meta-buf doesn't exist, it is created. In that case, id doesn't have a | |
1483 ;; parent meta-buf | |
1484 ;; Check if META-BUF exists before calling this function | |
1485 (defun ediff-update-meta-buffer (meta-buf) | |
1486 (ediff-eval-in-buffer (current-buffer) | |
1487 (if (ediff-buffer-live-p meta-buf) | |
1488 (ediff-eval-in-buffer meta-buf | |
1489 (funcall ediff-meta-redraw-function ediff-meta-list)) | |
1490 ))) | |
1491 | |
1492 (defun ediff-update-registry () | |
1493 (ediff-eval-in-buffer (current-buffer) | |
1494 (if (ediff-buffer-live-p ediff-registry-buffer) | |
1495 (ediff-redraw-registry-buffer) | |
1496 (ediff-prepare-meta-buffer | |
1497 'ediff-registry-action | |
1498 ediff-session-registry | |
1499 "*Ediff Registry" | |
1500 'ediff-redraw-registry-buffer | |
1501 'ediff-registry)) | |
1502 )) | |
1503 | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1504 ;; If meta-buf exists, it is redrawn along with parent. |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1505 ;; Otherwise, nothing happens. |
13130 | 1506 (defun ediff-cleanup-meta-buffer (meta-buffer) |
1507 (if (ediff-buffer-live-p meta-buffer) | |
1508 (ediff-eval-in-buffer meta-buffer | |
1509 (ediff-update-meta-buffer meta-buffer) | |
1510 (if (ediff-buffer-live-p ediff-parent-meta-buffer) | |
1511 (ediff-update-meta-buffer ediff-parent-meta-buffer))))) | |
1512 | |
1513 ;; t if no session in progress | |
1514 (defun ediff-safe-to-quit (meta-buffer) | |
1515 (if (ediff-buffer-live-p meta-buffer) | |
1516 (let ((lis ediff-meta-list) | |
1517 (cont t) | |
1518 buffer-read-only) | |
1519 (ediff-update-meta-buffer meta-buffer) | |
1520 (ediff-eval-in-buffer meta-buffer | |
1521 (setq lis (cdr lis)) ; discard the description part of meta-list | |
1522 (while (and cont lis) | |
1523 (if (ediff-buffer-live-p | |
1524 (ediff-get-group-buffer lis)) ; in progress | |
1525 (setq cont nil)) | |
1526 (setq lis (cdr lis))) | |
1527 cont)))) | |
1528 | |
1529 (defun ediff-quit-meta-buffer () | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1530 "If the group has no active session, delete the meta buffer. |
13130 | 1531 If no session is in progress, ask to confirm before deleting meta buffer. |
1532 Otherwise, bury the meta buffer. | |
1533 If this is a session registry buffer then just bury it." | |
1534 (interactive) | |
1535 (let* ((buf (current-buffer)) | |
1536 (dir-diffs-buffer ediff-dir-diffs-buffer) | |
1537 (meta-diff-buffer ediff-meta-diff-buffer) | |
1538 (parent-buf ediff-parent-meta-buffer) | |
1539 (dont-show-registry (eq buf ediff-registry-buffer))) | |
1540 (if dont-show-registry | |
1541 (bury-buffer) | |
1542 (ediff-cleanup-meta-buffer buf) | |
1543 (cond ((and (ediff-safe-to-quit buf) | |
1544 (y-or-n-p "Quit this session group? ")) | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1545 (run-hooks 'ediff-quit-session-group-hook) |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1546 (message "") |
13130 | 1547 (ediff-dispose-of-meta-buffer buf)) |
1548 ((ediff-safe-to-quit buf) | |
1549 (bury-buffer)) | |
1550 (t | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1551 (error |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1552 "This session group has active sessions---cannot exit"))) |
13130 | 1553 (ediff-cleanup-meta-buffer parent-buf) |
1554 (ediff-kill-buffer-carefully dir-diffs-buffer) | |
1555 (ediff-kill-buffer-carefully meta-diff-buffer) | |
1556 (if (ediff-buffer-live-p parent-buf) | |
1557 (progn | |
1558 (setq dont-show-registry t) | |
1559 (ediff-show-meta-buffer parent-buf))) | |
1560 ) | |
1561 (or dont-show-registry | |
1562 (ediff-show-registry)))) | |
1563 | |
1564 (defun ediff-dispose-of-meta-buffer (buf) | |
1565 (setq ediff-session-registry (delq buf ediff-session-registry)) | |
1566 (ediff-eval-in-buffer buf | |
1567 (if (ediff-buffer-live-p ediff-dir-diffs-buffer) | |
1568 (kill-buffer ediff-dir-diffs-buffer))) | |
1569 (kill-buffer buf)) | |
1570 | |
1571 | |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1572 ;; Obtain information on a meta record where the user clicked or typed |
13130 | 1573 ;; BUF is the buffer where this happened and POINT is the position |
1574 ;; If optional NOERROR arg is given, don't report error and return nil if no | |
1575 ;; meta info is found on line. | |
1576 (defun ediff-get-meta-info (buf point &optional noerror) | |
1577 (let (result olist tmp) | |
1578 (if (and point (ediff-buffer-live-p buf)) | |
1579 (ediff-eval-in-buffer buf | |
1580 (if ediff-xemacs-p | |
1581 (setq result | |
1582 (if (setq tmp (extent-at point buf 'ediff-meta-info)) | |
1583 (ediff-overlay-get tmp 'ediff-meta-info))) | |
1584 (setq olist (overlays-at point)) | |
1585 (setq olist | |
1586 (mapcar (function (lambda (elt) | |
1587 (overlay-get elt 'ediff-meta-info))) | |
1588 olist)) | |
1589 (while (and olist (null (car olist)) | |
1590 (overlay-get (car olist) 'invisible)) | |
1591 (setq olist (cdr olist))) | |
1592 (setq result (car olist))))) | |
1593 (if result | |
1594 result | |
1595 (if noerror | |
1596 nil | |
1597 (ediff-update-registry) | |
1598 (error "No session info in this line"))))) | |
1599 | |
1600 ;; return location of the next meta overlay after point | |
1601 (defun ediff-next-meta-overlay-start (point) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1602 (if (eobp) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1603 (goto-char (point-min)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1604 (let (overl) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1605 (if ediff-xemacs-p |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1606 (progn |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1607 (setq overl (extent-at point (current-buffer) 'ediff-meta-info)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1608 (if overl |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1609 (setq overl (next-extent overl)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1610 (setq overl (next-extent (current-buffer)))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1611 (if overl |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1612 (extent-start-position overl) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1613 (point-max))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1614 (setq overl (car (overlays-at point))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1615 (if (and overl (overlay-get overl 'ediff-meta-info)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1616 ;; note: end of current overlay is the beginning of the next one |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1617 (overlay-end overl) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1618 (next-overlay-change point)))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1619 )) |
13130 | 1620 |
1621 (defun ediff-previous-meta-overlay-start (point) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1622 (if (bobp) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1623 (goto-char (point-max)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1624 (let (overl) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1625 (if ediff-xemacs-p |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1626 (progn |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1627 (setq overl (extent-at point (current-buffer) 'ediff-meta-info)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1628 (if overl |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1629 (setq overl (previous-extent overl)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1630 (setq overl (previous-extent (current-buffer)))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1631 (if overl |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1632 (extent-start-position overl) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1633 (point-min))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1634 (setq overl (car (overlays-at point))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1635 (if (and overl (overlay-get overl 'ediff-meta-info)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1636 (setq point (overlay-start overl))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1637 ;; to get to the beginning of prev overlay |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1638 (if (not (bobp)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1639 ;; trickery to overcome an emacs bug--doesn't always find previous |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1640 ;; overlay change correctly |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1641 (setq point (1- point))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1642 (setq point (previous-overlay-change point)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1643 ;; If we are not over an overlay after subtracting 1, it means we are |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1644 ;; in the description area preceding session records. In this case, |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1645 ;; goto the top of the registry buffer. |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1646 (or (car (overlays-at point)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1647 (setq point (point-min))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1648 point |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1649 )))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1650 |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1651 ;; this is the action invoked when the user selects a patch from the meta |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1652 ;; buffer. |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1653 (defun ediff-patch-file-form-meta (file &optional startup-hooks) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1654 (let* ((pos (ediff-event-point last-command-event)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1655 (meta-buf (ediff-event-buffer last-command-event)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1656 ;; ediff-get-meta-info gives error if meta-buf or pos are invalid |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1657 (info (ediff-get-meta-info meta-buf pos)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1658 (meta-patchbuf ediff-meta-patchbufer) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1659 session-buf beg-marker end-marker) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1660 |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1661 (if (or (file-directory-p file) (string-match "/dev/null" file)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1662 (error "`%s' is not an ordinary file" (file-name-as-directory file))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1663 (setq session-buf (ediff-get-session-buffer info) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1664 beg-marker (ediff-get-session-objB-name info) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1665 end-marker (ediff-get-session-objC-name info)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1666 |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1667 (or (ediff-buffer-live-p session-buf) ; either an active patch session |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1668 (null session-buf) ; or it is a virgin session |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1669 (error |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1670 "Patch has been already applied to this file--cannot be repeated!")) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1671 |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1672 (ediff-eval-in-buffer meta-patchbuf |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1673 (save-restriction |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1674 (widen) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1675 (narrow-to-region beg-marker end-marker) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1676 (ediff-patch-file-internal meta-patchbuf file startup-hooks))))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1677 |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1678 |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1679 (defun ediff-meta-mark-equal-files () |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1680 "Run though the session list and mark identical files. |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1681 This is used only for sessions that involve 2 or 3 files at the same time." |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1682 (interactive) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1683 (let ((list (cdr ediff-meta-list)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1684 fileinfo1 fileinfo2 fileinfo3 elt) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1685 (while (setq elt (car list)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1686 (setq fileinfo1 (ediff-get-session-objA elt) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1687 fileinfo2 (ediff-get-session-objB elt) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1688 fileinfo3 (ediff-get-session-objC elt)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1689 (ediff-set-file-eqstatus fileinfo1 nil) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1690 (ediff-set-file-eqstatus fileinfo2 nil) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1691 (ediff-set-file-eqstatus fileinfo3 nil) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1692 |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1693 (ediff-mark-if-equal fileinfo1 fileinfo2) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1694 (if (ediff-metajob3) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1695 (progn |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1696 (ediff-mark-if-equal fileinfo1 fileinfo3) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1697 (ediff-mark-if-equal fileinfo2 fileinfo3))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1698 (setq list (cdr list)))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1699 (ediff-update-meta-buffer (current-buffer))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1700 |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1701 ;; mark files 1 and 2 as equal, if they are. |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1702 (defun ediff-mark-if-equal (fileinfo1 fileinfo2) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1703 (get-buffer-create ediff-tmp-buffer) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1704 (or (file-directory-p (car fileinfo1)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1705 (file-directory-p (car fileinfo2)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1706 (if (= (ediff-make-diff2-buffer |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1707 ediff-tmp-buffer (car fileinfo1) (car fileinfo2)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1708 0) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1709 (progn |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1710 (ediff-set-file-eqstatus fileinfo1 t) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1711 (ediff-set-file-eqstatus fileinfo2 t))))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1712 |
13130 | 1713 |
1714 | |
1715 ;;; Local Variables: | |
1716 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun) | |
1717 ;;; eval: (put 'ediff-eval-in-buffer 'lisp-indent-hook 1) | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1718 ;;; eval: (put 'ediff-eval-in-buffer 'edebug-form-spec '(form body)) |
13130 | 1719 ;;; End: |
1720 | |
13607
71a4a349d998
Renamed from ediff-meta.el. Changed provide.
Richard M. Stallman <rms@gnu.org>
parents:
13216
diff
changeset
|
1721 (provide 'ediff-mult) |
13130 | 1722 (require 'ediff-util) |
1723 | |
13607
71a4a349d998
Renamed from ediff-meta.el. Changed provide.
Richard M. Stallman <rms@gnu.org>
parents:
13216
diff
changeset
|
1724 ;;; ediff-mult.el ends here |