Mercurial > emacs
annotate lisp/ediff-mult.el @ 15002:0588af7eae96
(MANIFEST): Fix previous change.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Fri, 12 Apr 1996 06:39:36 +0000 |
parents | c768f6d7daaa |
children | 43a3308fcf61 |
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 |
3 ;; Copyright (C) 1995 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 | |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
26 ;; Users are strongly encouraged to add functionality to this file. |
13130 | 27 ;; In particular, epatch needs to be enhanced to work with multi-file |
28 ;; patches. The present file contains all the infrastructure needed for that. | |
29 ;; | |
30 ;; Generally, to to implement a new multisession capability within Ediff, | |
31 ;; you need to tell it | |
32 ;; | |
33 ;; 1. How to display the session group buffer. | |
34 ;; This function must indicate which Ediff sessions are active (+) and | |
35 ;; which are finished (-). | |
36 ;; See ediff-redraw-directory-group-buffer for an example. | |
37 ;; In all likelihood, ediff-redraw-directory-group-buffer can be used | |
38 ;; directly or after a small modification. | |
39 ;; 2. What action to take when the user clicks button 2 or types v,e, or | |
40 ;; RET. See ediff-dir-action. | |
41 ;; 3. Provide a list of pairs or triples of file names (or buffers, | |
42 ;; depending on the particular Ediff operation you want to invoke) | |
43 ;; in the following format: | |
44 ;; ((obj1 obj2 [optional obj3]) (...) ...) | |
45 ;; Actually, the format of this list is pretty much up to the | |
46 ;; developer. The only thing is that it must be a list of lists. | |
47 ;; Also, keep in mind that the function ediff-prepare-meta-buffer | |
14040 | 48 ;; (which see) prepends nil in front of each list (i.e., the above list |
13130 | 49 ;; will become ((nil obj1 obj2 ...) (nil ...) ...). |
50 ;; Ediff expects that your function (in 2 above) will arrange to | |
51 ;; replace this prepended nil (via setcar) with the actual ediff | |
52 ;; control buffer associated with an appropriate Ediff session. | |
53 ;; This is arranged through internal startup hooks that can be passed | |
54 ;; to any of Ediff major entries (such as ediff-files, epatch, etc.). | |
55 ;; See how this is done in ediff-dir-action. | |
56 ;; 4. Write a function that makes a call to ediff-prepare-meta-buffer | |
57 ;; passing all this info. | |
58 ;; You may be able to use ediff-directories-internal as a template. | |
59 ;; 5. If you intend to add several related pieces of functionality, | |
60 ;; you may want to keep the function in 4 as an internal version | |
61 ;; and then write several top-level interactive functions that call it | |
62 ;; with different parameters. | |
63 ;; See how ediff-directories, ediff-merge-directories, and | |
64 ;; ediff-merge-directories-with-ancestor all use | |
65 ;; ediff-directories-internal. | |
66 ;; | |
67 ;; In case of multifile patching, the easiest thing is to first apply the patch | |
68 ;; and then find out which files were patched (using the algorithm utilized by | |
69 ;; Unix patch and by parsing the patch file). The procedure ediff-patch-file | |
70 ;; works for single-file patches only. However, it can deal with remote and | |
71 ;; compressed files. Check out ediff-patch-file for details. | |
72 ;; | |
73 ;; Another useful addition here could be session groups selected by patterns | |
74 ;; (which are different in each directory). For instance, one may want to | |
75 ;; compare files of the form abc{something}.c to files old{something}.d | |
76 ;; which may be in the same or different directories. Or, one may want to | |
77 ;; compare all files of the form {something} to files of the form {something}~. | |
78 ;; | |
13216
b9dc8cc658d5
Moved defsubsts up.
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
13130
diff
changeset
|
79 ;; Implementing this requires writing an collating function, which should pair |
b9dc8cc658d5
Moved defsubsts up.
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
13130
diff
changeset
|
80 ;; up appropriate files. It will also require a generalization of the functions |
13130 | 81 ;; that do the layout of the meta- and differences buffers and of |
82 ;; ediff-dir-action. | |
83 | |
14169 | 84 ;;; Code: |
85 | |
13130 | 86 (require 'ediff-init) |
87 | |
88 ;; meta-buffer | |
89 (ediff-defvar-local ediff-meta-buffer nil "") | |
90 (ediff-defvar-local ediff-parent-meta-buffer nil "") | |
91 ;; the registry buffer | |
92 (defvar ediff-registry-buffer nil) | |
93 | |
94 (defconst ediff-meta-buffer-message "This is an Ediff Session Group Panel: %s | |
95 | |
96 Useful commands: | |
97 button2, `v', RET over a session line: start that Ediff session | |
98 `M' in any session invoked from here: bring back this buffer | |
99 `R':\tdisplay the registry of active Ediff sessions | |
100 `h':\tmark session for hiding; with prefix arg--unmark | |
101 `x':\thide marked sessions; with prefix arg--unhide hidden sessions | |
102 `m':\tmark session for non-hiding operation; with prefix arg--unmark | |
103 SPC:\tnext session | |
104 DEL:\tprevious session | |
105 `E':\tbrowse Ediff on-line manual | |
106 `q':\tquit this session group | |
107 ") | |
108 | |
109 (ediff-defvar-local ediff-meta-buffer-map nil | |
110 "The keymap for the meta buffer.") | |
111 (defvar ediff-dir-diffs-buffer-map (make-sparse-keymap) | |
112 "The keymap to be installed in the buffer showing differences between | |
113 directories.") | |
114 | |
115 ;; Variable specifying the action to take when the use invokes ediff in the | |
116 ;; meta buffer. This is usually ediff-registry-action or ediff-dir-action | |
117 (ediff-defvar-local ediff-meta-action-function nil "") | |
118 ;; Tells ediff-update-meta-buffer how to redraw it | |
119 (ediff-defvar-local ediff-meta-redraw-function nil "") | |
120 ;; Tells ediff-dir-action and similar procedures how to invoke Ediff for the | |
121 ;; sessions in a given session group | |
122 (ediff-defvar-local ediff-session-action-function nil "") | |
123 | |
124 (ediff-defvar-local ediff-metajob-name nil "") | |
125 | |
126 ;; buffer used to collect custom diffs from individual sessions in the group | |
127 (ediff-defvar-local ediff-meta-diff-buffer nil "") | |
128 | |
129 ;; history var to use for filtering groups | |
130 (defvar ediff-filtering-regexp-history nil "") | |
131 | |
132 ;; This has the form ((ctl-buf file1 file2) (stl-buf file1 file2) ...) | |
133 ;; If ctl-buf is nil, the file-pare wasn't processed yet. If it is | |
134 ;; killed-buffer object, the file pair has been processed. If it is a live | |
135 ;; buffer, this means ediff is still working on the pair | |
136 (ediff-defvar-local ediff-meta-list nil "") | |
137 | |
138 | |
139 ;; the difference list between directories in a directory session group | |
140 (ediff-defvar-local ediff-dir-difference-list nil "") | |
141 (ediff-defvar-local ediff-dir-diffs-buffer nil "") | |
142 | |
143 ;; The registry of Ediff sessions. A list of control buffers. | |
144 (defvar ediff-session-registry nil) | |
145 | |
146 (defvar ediff-registry-setup-hook nil | |
147 "*Hooks run just after the registry control panel is set up.") | |
148 (defvar ediff-session-group-setup-hook nil | |
149 "*Hooks run just after a meta-buffer controlling a session group, such as | |
150 ediff-directories, is run.") | |
151 (defvar ediff-show-registry-hook nil | |
152 "*Hooks run just after the registry buffer is shown.") | |
153 (defvar ediff-show-session-group-hook nil | |
154 "*Hooks run just after a session group buffer is shown.") | |
155 | |
156 ;;; API | |
157 | |
158 (defun ediff-get-group-buffer (meta-list) | |
159 (nth 0 (car meta-list))) | |
160 (defun ediff-get-group-regexp (meta-list) | |
161 (nth 1 (car meta-list))) | |
162 (defun ediff-get-group-objA (meta-list) | |
163 (nth 2 (car meta-list))) | |
164 (defun ediff-get-group-objB (meta-list) | |
165 (nth 3 (car meta-list))) | |
166 (defun ediff-get-group-objC (meta-list) | |
167 (nth 4 (car meta-list))) | |
168 (defun ediff-get-session-buffer (elt) | |
169 (nth 0 elt)) | |
170 (defun ediff-get-session-status (elt) | |
171 (nth 1 elt)) | |
172 (defun ediff-get-session-objA (elt) | |
173 (nth 2 elt)) | |
174 (defun ediff-get-session-objB (elt) | |
175 (nth 3 elt)) | |
176 (defun ediff-get-session-objC (elt) | |
177 (nth 4 elt)) | |
178 (defun ediff-set-session-status (session-info new-status) | |
179 (setcar (cdr session-info) new-status)) | |
180 | |
181 ;; set up the keymap in the meta buffer | |
182 (defun ediff-setup-meta-map() | |
183 (setq ediff-meta-buffer-map (make-sparse-keymap)) | |
184 (suppress-keymap ediff-meta-buffer-map) | |
185 (define-key ediff-meta-buffer-map "q" 'ediff-quit-meta-buffer) | |
186 (define-key ediff-meta-buffer-map "R" 'ediff-show-registry) | |
187 (define-key ediff-meta-buffer-map "E" 'ediff-documentation) | |
188 (define-key ediff-meta-buffer-map "v" ediff-meta-action-function) | |
189 (define-key ediff-meta-buffer-map "\C-m" ediff-meta-action-function) | |
190 (define-key ediff-meta-buffer-map " " 'ediff-next-meta-item) | |
191 (define-key ediff-meta-buffer-map "\C-?" 'ediff-previous-meta-item) | |
192 (define-key ediff-meta-buffer-map [delete] 'ediff-previous-meta-item) | |
193 (define-key ediff-meta-buffer-map [backspace] 'ediff-previous-meta-item) | |
194 (if ediff-no-emacs-help-in-control-buffer | |
195 (define-key ediff-meta-buffer-map "\C-h" 'ediff-previous-meta-item)) | |
196 (if ediff-emacs-p | |
197 (define-key ediff-meta-buffer-map [mouse-2] ediff-meta-action-function) | |
198 (define-key ediff-meta-buffer-map [button2] ediff-meta-action-function)) | |
199 | |
200 (use-local-map ediff-meta-buffer-map)) | |
201 | |
202 (defun ediff-meta-mode () | |
203 "This mode controls all operations on Ediff session groups. | |
204 It is entered through one of the following commands: | |
205 `ediff-directories' | |
206 `edirs' | |
207 `ediff-directories3' | |
208 `edirs3' | |
209 `ediff-merge-directories' | |
210 `edirs-merge' | |
211 `ediff-merge-directories-with-ancestor' | |
212 `edirs-merge-with-ancestor' | |
213 `ediff-directory-revisions' | |
214 `edir-revisions' | |
215 `ediff-merge-directory-revisions' | |
216 `edir-merge-revisions' | |
217 `ediff-merge-directory-revisions-with-ancestor' | |
218 `edir-merge-revisions-with-ancestor' | |
219 | |
220 Commands: | |
221 \\{ediff-meta-buffer-map}" | |
222 (kill-all-local-variables) | |
223 (setq major-mode 'ediff-meta-mode) | |
224 (setq mode-name "MetaEdiff")) | |
225 | |
226 | |
227 ;; the keymap for the buffer showing directory differences | |
228 (suppress-keymap ediff-dir-diffs-buffer-map) | |
229 (define-key ediff-dir-diffs-buffer-map "q" 'ediff-bury-dir-diffs-buffer) | |
230 (define-key ediff-dir-diffs-buffer-map " " 'next-line) | |
231 (define-key ediff-dir-diffs-buffer-map "\C-?" 'previous-line) | |
232 (define-key ediff-dir-diffs-buffer-map [delete] 'previous-line) | |
233 (define-key ediff-dir-diffs-buffer-map [backspace] 'previous-line) | |
234 | |
235 (defun ediff-next-meta-item (count) | |
236 "Move to the next item in Ediff registry or session group buffer. | |
237 Moves in circular fashion. With numeric prefix arg, skip this many items." | |
238 (interactive "p") | |
239 (or count (setq count 1)) | |
240 (while (< 0 count) | |
241 (setq count (1- count)) | |
242 (ediff-next-meta-item1))) | |
243 | |
244 ;; Move to the next meta item | |
245 (defun ediff-next-meta-item1 () | |
246 (let (pos) | |
247 (setq pos (ediff-next-meta-overlay-start (point))) | |
248 ;;; ;; skip deleted | |
249 ;;; (while (memq (ediff-get-session-status | |
250 ;;; (ediff-get-meta-info (current-buffer) pos 'noerror)) | |
251 ;;; '(?H ?I)) | |
252 ;;; (setq pos (ediff-next-meta-overlay-start pos))) | |
253 | |
254 (if pos (goto-char pos)) | |
255 (if (eq ediff-metajob-name 'ediff-registry) | |
256 (if (search-forward "*Ediff" nil t) | |
257 (skip-chars-backward "a-zA-Z*")) | |
258 (if (> (skip-chars-forward "-+?H* \t0-9") 0) | |
259 (backward-char 1))))) | |
260 | |
261 | |
262 (defun ediff-previous-meta-item (count) | |
263 "Move to the previous item in Ediff registry or session group buffer. | |
264 Moves in circular fashion. With numeric prefix arg, skip this many items." | |
265 (interactive "p") | |
266 (or count (setq count 1)) | |
267 (while (< 0 count) | |
268 (setq count (1- count)) | |
269 (ediff-previous-meta-item1))) | |
270 | |
271 (defun ediff-previous-meta-item1 () | |
272 (let (pos) | |
273 (setq pos (ediff-previous-meta-overlay-start (point))) | |
274 ;;; ;; skip deleted | |
275 ;;; (while (ediff-get-session-status | |
276 ;;; (ediff-get-meta-info (current-buffer) pos 'noerror)) | |
277 ;;; (setq pos (ediff-previous-meta-overlay-start pos))) | |
278 | |
279 (if pos (goto-char pos)) | |
280 (if (eq ediff-metajob-name 'ediff-registry) | |
281 (if (search-forward "*Ediff" nil t) | |
282 (skip-chars-backward "a-zA-Z*")) | |
283 (if (> (skip-chars-forward "-+?H* \t0-9") 0) | |
284 (backward-char 1))))) | |
285 | |
286 | |
287 | |
288 ;; DIR1, DIR2, DIR3 are directories. | |
289 ;; REGEXP is a regexp used to filter | |
290 ;; files in the directories. | |
291 ;; If a file is a directory in dir1 but not dir2 (or vice versa), it is not | |
292 ;; included in the intersection. However, a regular file that is a dir in dir3 | |
293 ;; is included, since dir3 files are supposed to be ancestors for merging. | |
294 ;; Returns a list of the form: | |
295 ;; ((dir1 dir2 dir3) (f1 f2 f3) (f1 f2 f3) ...) | |
296 ;; dir3, f3 can be nil if intersecting only 2 directories. | |
297 ;; If COMPARISON-FUNC is given, use it. Otherwise, use string= | |
298 ;; DIFF-VAR is contains the name of the variable in which to return the | |
299 ;; difference list. The diff list is of the form: | |
300 ;; ((dir1 dir2 dir3) (file . num) (file . num)...) | |
301 ;; where num encodes the set of dirs where the file is found: | |
302 ;; 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
|
303 (defun ediff-intersect-directories (jobname |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
304 diff-var regexp dir1 dir2 |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
305 &optional dir3 comparison-func) |
13130 | 306 (setq comparison-func (or comparison-func 'string=)) |
307 (let (lis1 lis2 lis3 common auxdir1 auxdir2 auxdir3 difflist) | |
308 | |
309 (setq auxdir1 (file-name-as-directory dir1) | |
310 lis1 (directory-files auxdir1 nil regexp) | |
311 auxdir2 (file-name-as-directory dir2) | |
312 lis2 (directory-files auxdir2 nil regexp)) | |
313 | |
314 (if (stringp dir3) | |
315 (setq auxdir3 (file-name-as-directory dir3) | |
316 lis3 (directory-files auxdir3 nil regexp))) | |
317 | |
318 (setq lis1 (delete "." lis1) | |
319 lis1 (delete ".." lis1)) | |
320 | |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
321 (setq common (ediff-intersection lis1 lis2 comparison-func)) |
13130 | 322 ;; get rid of files that are directories in dir1 but not dir2 |
323 (mapcar (function (lambda (elt) | |
324 (if (Xor (file-directory-p (concat auxdir1 elt)) | |
325 (file-directory-p (concat auxdir2 elt))) | |
326 (setq common (delq elt common))))) | |
327 common) | |
328 ;; intersect with the third dir | |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
329 (if lis3 (setq common (ediff-intersection common lis3 comparison-func))) |
13130 | 330 (if (ediff-comparison-metajob3 jobname) |
331 (mapcar (function (lambda (elt) | |
332 (if (Xor (file-directory-p (concat auxdir1 elt)) | |
333 (file-directory-p (concat auxdir3 elt))) | |
334 (setq common (delq elt common))))) | |
335 common)) | |
336 | |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
337 ;; copying is needed because sort sorts via side effects |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
338 (setq common (sort (ediff-copy-list common) 'string-lessp)) |
13130 | 339 |
340 ;; compute difference list | |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
341 (setq difflist (ediff-set-difference |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
342 (ediff-union (ediff-union lis1 lis2 comparison-func) |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
343 lis3 |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
344 comparison-func) |
13130 | 345 common |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
346 comparison-func) |
13130 | 347 difflist (delete "." difflist) |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
348 ;; copying is needed because sort sorts via side effects |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
349 difflist (sort (ediff-copy-list (delete ".." difflist)) |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
350 'string-lessp)) |
13130 | 351 |
352 (setq difflist (mapcar (function (lambda (elt) (cons elt 1))) difflist)) | |
353 | |
354 ;; check for files belonging to lis1/2/3 | |
355 (mapcar (function (lambda (elt) | |
356 (if (member (car elt) lis1) | |
357 (setcdr elt (* (cdr elt) 2))) | |
358 (if (member (car elt) lis2) | |
359 (setcdr elt (* (cdr elt) 3))) | |
360 (if (member (car elt) lis3) | |
361 (setcdr elt (* (cdr elt) 5))) | |
362 )) | |
363 difflist) | |
364 (setq difflist (cons (list regexp auxdir1 auxdir2 auxdir3) difflist)) | |
365 | |
366 (set diff-var difflist) | |
367 | |
368 ;; return result | |
369 (cons (list regexp auxdir1 auxdir2 auxdir3) | |
370 (mapcar (function (lambda (elt) | |
371 (list (concat auxdir1 elt) | |
372 (concat auxdir2 elt) | |
373 (if lis3 | |
374 (concat auxdir3 elt))))) | |
375 common)) | |
376 )) | |
377 | |
378 ;; find directory files that are under revision. | |
379 ;; display subdirectories, too, since we may visit them recursively. | |
380 (defun ediff-get-directory-files-under-revision (jobname regexp dir1) | |
381 (let (lis1 elt common auxdir1) | |
382 (setq auxdir1 (file-name-as-directory dir1) | |
383 lis1 (directory-files auxdir1 nil regexp)) | |
384 | |
385 (while lis1 | |
386 (setq elt (car lis1) | |
387 lis1 (cdr lis1)) | |
388 ;; take files under revision control | |
389 (cond ((file-directory-p (concat auxdir1 elt)) | |
390 (setq common (cons elt common))) | |
391 ((file-exists-p (concat auxdir1 elt ",v")) | |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
392 (setq common (cons elt common))) |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
393 ((file-exists-p (concat auxdir1 "RCS/" elt ",v")) |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
394 (setq common (cons elt common))) |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
395 ) ; cond |
13130 | 396 ) ; while |
397 | |
398 (setq common (delete "." common) | |
399 common (delete ".." common)) | |
400 | |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
401 ;; copying is needed because sort sorts via side effects |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
402 (setq common (sort (ediff-copy-list common) 'string-lessp)) |
13130 | 403 |
404 ;; return result | |
405 (cons (list regexp auxdir1 nil nil) | |
406 (mapcar (function (lambda (elt) | |
407 (list (concat auxdir1 elt) | |
408 nil nil))) | |
409 common)) | |
410 )) | |
411 | |
412 | |
413 ;; If file groups selected by patterns will ever be implemented, this | |
414 ;; comparison function might become useful. | |
415 ;;;; uses external variables PAT1 PAT2 to compare str1/2 | |
416 ;;;; patterns must be of the form ???*???? where ??? are strings of chars | |
417 ;;;; containing no *. | |
418 ;;(defun ediff-pattern= (str1 str2) | |
419 ;; (let (pos11 pos12 pos21 pos22 len1 len2) | |
420 ;; (setq pos11 0 | |
421 ;; len (length epat1) | |
422 ;; pos12 len) | |
423 ;; (while (and (< pos11 len) (not (= (aref epat1 pos11) ?*))) | |
424 ;; (setq pos11 (1+ pos11))) | |
425 ;; (while (and (> pos12 0) (not (= (aref epat1 (1- pos12)) ?*))) | |
426 ;; (setq pos12 (1- pos12))) | |
427 ;; | |
428 ;; (setq pos21 0 | |
429 ;; len (length epat2) | |
430 ;; pos22 len) | |
431 ;; (while (and (< pos21 len) (not (= (aref epat2 pos21) ?*))) | |
432 ;; (setq pos21 (1+ pos21))) | |
433 ;; (while (and (> pos22 0) (not (= (aref epat2 (1- pos22)) ?*))) | |
434 ;; (setq pos22 (1- pos22))) | |
435 ;; | |
436 ;; (if (and (> (length str1) pos12) (>= pos12 pos11) (> pos11 -1) | |
437 ;; (> (length str2) pos22) (>= pos22 pos21) (> pos21 -1)) | |
438 ;; (string= (substring str1 pos11 pos12) | |
439 ;; (substring str2 pos21 pos22))) | |
440 ;; )) | |
441 | |
442 | |
443 ;; Prepare meta-buffer in accordance with the argument-function and | |
444 ;; redraw-function. Must return the created meta-buffer. | |
445 (defun ediff-prepare-meta-buffer (action-func meta-list | |
446 meta-buffer-name redraw-function | |
447 jobname &optional startup-hooks) | |
448 (let* ((meta-buffer-name | |
449 (ediff-unique-buffer-name meta-buffer-name "*")) | |
450 (meta-buffer (get-buffer-create meta-buffer-name))) | |
451 (ediff-eval-in-buffer meta-buffer | |
452 | |
453 ;; comes first | |
454 (ediff-meta-mode) | |
455 | |
456 (setq ediff-meta-action-function action-func | |
457 ediff-meta-redraw-function redraw-function | |
458 ediff-metajob-name jobname | |
459 ediff-meta-buffer meta-buffer) | |
460 | |
461 ;; comes after ediff-meta-action-function is set | |
462 (ediff-setup-meta-map) | |
463 | |
464 (if (eq ediff-metajob-name 'ediff-registry) | |
465 (progn | |
466 (setq ediff-registry-buffer meta-buffer | |
467 ediff-meta-list meta-list) | |
468 ;; this func is used only from registry buffer, not from other | |
469 ;; meta-buffs. | |
470 (define-key | |
471 ediff-meta-buffer-map "M" 'ediff-show-meta-buff-from-registry)) | |
472 ;; initialize the meta list -- don't do this for registry we prepend | |
473 ;; '(nil nil) nil to all elts of meta-list, except the first. The | |
474 ;; first nil will later be replaced by the session buffer. The second | |
475 ;; is reserved for session status. | |
476 ;; (car ediff-meta-list) gets cons'ed with the session group buffer. | |
477 (setq ediff-meta-list | |
478 (cons (cons meta-buffer (car meta-list)) | |
479 (mapcar (function | |
480 (lambda (elt) | |
481 (cons nil (cons nil elt)))) | |
482 (cdr meta-list))))) | |
483 | |
484 (or (eq meta-buffer ediff-registry-buffer) | |
485 (setq ediff-session-registry | |
486 (cons meta-buffer ediff-session-registry))) | |
487 | |
488 ;; redraw-function uses ediff-meta-list | |
489 (funcall redraw-function ediff-meta-list) | |
490 | |
491 ;; set read-only/non-modified | |
492 (setq buffer-read-only t) | |
493 (set-buffer-modified-p nil) | |
494 | |
495 (run-hooks 'startup-hooks) | |
496 ;; arrange for showing directory contents differences | |
497 ;; must be after run startup-hooks, since ediff-dir-difference-list is | |
498 ;; set inside these hooks | |
499 (if (eq action-func 'ediff-dir-action) | |
500 (progn | |
501 ;; put meta buffer in (car ediff-dir-difference-list) | |
502 (setq ediff-dir-difference-list | |
503 (cons (cons meta-buffer (car ediff-dir-difference-list)) | |
504 (cdr ediff-dir-difference-list))) | |
505 | |
506 (or (ediff-dir1-metajob jobname) | |
507 (ediff-draw-dir-diffs ediff-dir-difference-list)) | |
508 (define-key ediff-meta-buffer-map "h" 'ediff-mark-for-hiding) | |
509 (define-key | |
510 ediff-meta-buffer-map "x" 'ediff-hide-marked-sessions) | |
511 (define-key ediff-meta-buffer-map "m" 'ediff-mark-for-operation) | |
512 (if (ediff-collect-diffs-metajob jobname) | |
513 (define-key | |
514 ediff-meta-buffer-map "P" 'ediff-collect-custom-diffs)) | |
515 (define-key ediff-meta-buffer-map "u" 'ediff-up-meta-hierarchy) | |
516 (define-key ediff-meta-buffer-map "D" 'ediff-show-dir-diffs))) | |
517 | |
518 (if (eq ediff-metajob-name 'ediff-registry) | |
519 (run-hooks 'ediff-registry-setup-hook) | |
520 (run-hooks 'ediff-session-group-setup-hook)) | |
521 ) ; eval in meta-buffer | |
522 meta-buffer)) | |
523 | |
524 | |
525 ;; this is a setup function for ediff-directories | |
526 ;; must return meta-buffer | |
527 (defun ediff-redraw-directory-group-buffer (meta-list) | |
528 ;; extract directories | |
529 (let ((meta-buf (ediff-get-group-buffer meta-list)) | |
530 (empty t) | |
531 (sessionNum 0) | |
532 regexp elt session-buf f1 f2 f3 pt | |
533 point tmp-list buffer-read-only) | |
534 (ediff-eval-in-buffer meta-buf | |
535 (setq point (point)) | |
536 (erase-buffer) | |
537 (insert (format ediff-meta-buffer-message | |
538 (ediff-abbrev-jobname ediff-metajob-name))) | |
539 | |
540 (setq regexp (ediff-get-group-regexp meta-list)) | |
541 | |
542 (if (ediff-collect-diffs-metajob) | |
543 (insert | |
544 " `P':\tcollect custom diffs of all marked sessions\n")) | |
545 (insert | |
546 " `u':\tshow parent session group | |
547 `D':\tdisplay differences among the contents of directories\n\n") | |
548 | |
549 (if (and (stringp regexp) (> (length regexp) 0)) | |
550 (insert (format "Filter-through regular expression: %s\n" regexp))) | |
551 | |
552 (insert "\n | |
553 Size Name | |
554 ----------------------------------------------------------------------- | |
555 | |
556 ") | |
557 | |
558 ;; discard info on directories and regexp | |
559 (setq meta-list (cdr meta-list) | |
560 tmp-list meta-list) | |
561 (while (and tmp-list empty) | |
562 (if (and (car tmp-list) | |
563 (not (eq (ediff-get-session-status (car tmp-list)) ?I))) | |
564 (setq empty nil)) | |
565 (setq tmp-list (cdr tmp-list))) | |
566 | |
567 (if empty | |
568 (insert | |
569 " ****** ****** This session group has no members\n")) | |
570 | |
571 ;; now organize file names like this: | |
572 ;; preferred format: | |
573 ;; use-mark sizeA dateA sizeB dateB filename | |
574 ;; I don't have time to mess up with calculating last modtimes | |
575 ;; (XEmacs has no decode-time function), so | |
576 ;; the actual format is: | |
577 ;; use-mark Size filename | |
578 ;; make sure directories are displayed with a trailing slash. | |
579 ;; If one is a directory and another isn't, indicate this with a `?' | |
580 (while meta-list | |
581 (setq elt (car meta-list) | |
582 meta-list (cdr meta-list) | |
583 sessionNum (1+ sessionNum)) | |
584 (if (eq (ediff-get-session-status elt) ?I) | |
585 () | |
586 (setq session-buf (ediff-get-session-buffer elt) | |
587 f1 (ediff-get-session-objA elt) | |
588 f2 (ediff-get-session-objB elt) | |
589 f3 (ediff-get-session-objC elt)) | |
590 (setq pt (point)) | |
591 ;; insert markers | |
592 (insert (cond ((null session-buf) " ") ; virgin session | |
593 ((ediff-buffer-live-p session-buf) "+") ;active session | |
594 (t "-"))) ; finished session | |
595 (insert (cond ((ediff-get-session-status elt)) ; session has status, | |
596 ;;; e.g., ?H, ?I | |
597 (t " "))) ; normal session | |
598 (insert " Session " (int-to-string sessionNum) ":\n") | |
599 (ediff-meta-insert-file-info f1) | |
600 (ediff-meta-insert-file-info f2) | |
601 (ediff-meta-insert-file-info f3) | |
602 (ediff-set-meta-overlay pt (point) elt))) | |
603 (set-buffer-modified-p nil) | |
604 (goto-char point) | |
605 meta-buf))) | |
606 | |
607 ;; Check if this is a problematic session. | |
608 ;; Return nil if not. Otherwise, return symbol representing the problem | |
609 ;; At present, problematic sessions occur only in -with-ancestor comparisons | |
610 ;; when the ancestor is a directory rather than a file. | |
611 (defun ediff-problematic-session-p (session) | |
612 (let ((f1 (ediff-get-session-objA session)) | |
613 (f2 (ediff-get-session-objB session)) | |
614 (f3 (ediff-get-session-objC session))) | |
615 (cond ((and (stringp f1) (not (file-directory-p f1)) | |
616 (stringp f2) (not (file-directory-p f2)) | |
617 (stringp f3) (file-directory-p f3) | |
618 (ediff-ancestor-metajob)) | |
619 ;; more may be added later | |
620 'ancestor-is-dir) | |
621 (t nil)))) | |
622 | |
623 (defun ediff-meta-insert-file-info (file) | |
624 (if (stringp file) | |
625 (insert | |
626 (format | |
627 " %10d %s\n" | |
628 (nth 7 (file-attributes file)) | |
629 ;; dir names in meta lists have no trailing `/' so insert it | |
630 (cond ((file-directory-p file) | |
631 (file-name-as-directory (ediff-abbreviate-file-name file))) | |
632 (t (ediff-abbreviate-file-name file))))) | |
633 )) | |
634 | |
635 | |
636 | |
637 (defun ediff-draw-dir-diffs (diff-list) | |
638 (if (null diff-list) (error "Lost difference info on these directories")) | |
639 (let* ((buf-name (ediff-unique-buffer-name | |
640 "*Ediff File Group Differences" "*")) | |
641 (regexp (ediff-get-group-regexp diff-list)) | |
642 (dir1 (ediff-abbreviate-file-name (ediff-get-group-objA diff-list))) | |
643 (dir2 (ediff-abbreviate-file-name (ediff-get-group-objB diff-list))) | |
644 (dir3 (ediff-get-group-objC diff-list)) | |
645 (dir3 (if (stringp dir3) (ediff-abbreviate-file-name dir3))) | |
646 (meta-buf (ediff-get-group-buffer diff-list)) | |
647 (underline (make-string 26 ?-)) | |
648 file code | |
649 buffer-read-only) | |
650 ;; skip the directory part | |
651 (setq diff-list (cdr diff-list)) | |
652 (setq ediff-dir-diffs-buffer (get-buffer-create buf-name)) | |
653 (ediff-eval-in-buffer ediff-dir-diffs-buffer | |
654 (use-local-map ediff-dir-diffs-buffer-map) | |
655 (erase-buffer) | |
656 (setq ediff-meta-buffer meta-buf) | |
657 (insert "\t\t*** Directory Differences ***\n") | |
658 (insert " | |
659 Useful commands: | |
660 `q': hide this buffer | |
661 SPC: next line | |
662 DEL: previous line\n\n") | |
663 | |
664 (if (and (stringp regexp) (> (length regexp) 0)) | |
665 (insert (format "Filter-through regular expression: %s\n" regexp))) | |
666 (insert "\n") | |
667 (insert (format "\n%-27s%-26s" | |
668 (ediff-truncate-string-left | |
669 (ediff-abbreviate-file-name | |
670 (file-name-as-directory dir1)) | |
671 25) | |
672 (ediff-truncate-string-left | |
673 (ediff-abbreviate-file-name | |
674 (file-name-as-directory dir2)) | |
675 25))) | |
676 (if dir3 | |
677 (insert (format " %-25s\n" | |
678 (ediff-truncate-string-left | |
679 (ediff-abbreviate-file-name | |
680 (file-name-as-directory dir3)) | |
681 25))) | |
682 (insert "\n")) | |
683 (insert (format "%s%s" underline underline)) | |
684 (if (stringp dir3) | |
685 (insert (format "%s\n\n" underline)) | |
686 (insert "\n\n")) | |
687 | |
688 (if (null diff-list) | |
689 (insert "\n\t*** No differences ***\n")) | |
690 | |
691 (while diff-list | |
692 (setq file (car (car diff-list)) | |
693 code (cdr (car diff-list)) | |
694 diff-list (cdr diff-list)) | |
695 (if (= (mod code 2) 0) ; dir1 | |
696 (insert (format "%-27s" | |
697 (ediff-truncate-string-left | |
698 (ediff-abbreviate-file-name | |
699 (if (file-directory-p (concat dir1 file)) | |
700 (file-name-as-directory file) | |
701 file)) | |
702 24))) | |
703 (insert (format "%-27s" "---"))) | |
704 (if (= (mod code 3) 0) ; dir2 | |
705 (insert (format "%-26s" | |
706 (ediff-truncate-string-left | |
707 (ediff-abbreviate-file-name | |
708 (if (file-directory-p (concat dir2 file)) | |
709 (file-name-as-directory file) | |
710 file)) | |
711 24))) | |
712 (insert (format "%-26s" "---"))) | |
713 (if (stringp dir3) | |
714 (if (= (mod code 5) 0) ; dir3 | |
715 (insert (format " %-25s" | |
716 (ediff-truncate-string-left | |
717 (ediff-abbreviate-file-name | |
718 (if (file-directory-p (concat dir3 file)) | |
719 (file-name-as-directory file) | |
720 file)) | |
721 24))) | |
722 (insert (format " %-25s" "---")))) | |
723 (insert "\n")) | |
724 (setq buffer-read-only t) | |
725 (set-buffer-modified-p nil)) ; eval in diff buffer | |
726 )) | |
727 | |
728 (defun ediff-bury-dir-diffs-buffer () | |
729 "Bury the directory difference buffer. Display the meta buffer instead." | |
730 (interactive) | |
731 (let ((buf ediff-meta-buffer) | |
732 wind) | |
733 (bury-buffer) | |
734 (if (setq wind (ediff-get-visible-buffer-window buf)) | |
735 (select-window wind) | |
736 (set-window-buffer (selected-window) buf)))) | |
737 | |
738 ;; executes in dir session group buffer | |
739 ;; show buffer differences | |
740 (defun ediff-show-dir-diffs () | |
741 "Display differences among the directories involved in session group." | |
742 (interactive) | |
743 (if (ediff-dir1-metajob) | |
744 (error "This command is inapplicable in the present context")) | |
745 (or (ediff-buffer-live-p ediff-dir-diffs-buffer) | |
746 (ediff-draw-dir-diffs ediff-dir-difference-list)) | |
747 (let ((buf ediff-dir-diffs-buffer)) | |
748 (other-window 1) | |
749 (set-window-buffer (selected-window) buf) | |
750 (goto-char (point-min)))) | |
751 | |
752 (defun ediff-up-meta-hierarchy () | |
753 "Go to the parent session group buffer." | |
754 (interactive) | |
755 (if (ediff-buffer-live-p ediff-parent-meta-buffer) | |
756 (ediff-show-meta-buffer ediff-parent-meta-buffer) | |
757 (error "This session group has no parent"))) | |
758 | |
759 | |
760 ;; argument is ignored | |
761 (defun ediff-redraw-registry-buffer (&optional ignore) | |
762 (ediff-eval-in-buffer ediff-registry-buffer | |
763 (let ((point (point)) | |
764 elt bufAname bufBname bufCname cur-diff total-diffs pt | |
765 job-name meta-list registry-list buffer-read-only) | |
766 (erase-buffer) | |
767 (insert "This is a registry of all active Ediff sessions. | |
768 | |
769 Useful commands: | |
770 button2, `v', RET over a session record: switch to that session | |
771 `M' over a session record: display the associated session group | |
772 `R' in any Ediff session: display session registry | |
773 SPC:\tnext session | |
774 DEL:\tprevious session | |
775 `E':\tbrowse Ediff on-line manual | |
776 `q':\tbury registry | |
777 | |
778 | |
779 \t\tActive Ediff Sessions: | |
780 \t\t---------------------- | |
781 | |
782 ") | |
783 ;; purge registry list from dead buffers | |
784 (mapcar (function (lambda (elt) | |
785 (if (not (ediff-buffer-live-p elt)) | |
786 (setq ediff-session-registry | |
787 (delq elt ediff-session-registry))))) | |
788 ediff-session-registry) | |
789 | |
790 (if (null ediff-session-registry) | |
791 (insert " ******* No active Ediff sessions *******\n")) | |
792 | |
793 (setq registry-list ediff-session-registry) | |
794 (while registry-list | |
795 (setq elt (car registry-list) | |
796 registry-list (cdr registry-list)) | |
797 | |
798 (if (ediff-buffer-live-p elt) | |
799 (if (ediff-eval-in-buffer elt | |
800 (setq job-name ediff-metajob-name | |
801 meta-list ediff-meta-list) | |
802 (and ediff-metajob-name | |
803 (not (eq ediff-metajob-name 'ediff-registry)))) | |
804 (progn | |
805 (setq pt (point)) | |
806 (insert (format " *group*\t%s: %s\n" | |
807 (buffer-name elt) | |
808 (ediff-abbrev-jobname job-name))) | |
809 (insert (format "\t\t %s %s %s\n" | |
810 (ediff-abbreviate-file-name | |
811 (ediff-get-group-objA meta-list)) | |
812 (ediff-abbreviate-file-name | |
813 (or (ediff-get-group-objB meta-list) "")) | |
814 (ediff-abbreviate-file-name | |
815 (or (ediff-get-group-objC meta-list) "")))) | |
816 (ediff-set-meta-overlay pt (point) elt)) | |
817 (progn | |
818 (ediff-eval-in-buffer elt | |
819 (setq bufAname (if (ediff-buffer-live-p ediff-buffer-A) | |
820 (buffer-name ediff-buffer-A) | |
821 "!!!killed buffer!!!") | |
822 bufBname (if (ediff-buffer-live-p ediff-buffer-B) | |
823 (buffer-name ediff-buffer-B) | |
824 "!!!killed buffer!!!") | |
825 bufCname (cond ((not (ediff-3way-job)) | |
826 "") | |
827 ((ediff-buffer-live-p ediff-buffer-C) | |
828 (buffer-name ediff-buffer-C)) | |
829 (t "!!!killed buffer!!!"))) | |
830 (setq total-diffs (format "%-4d" ediff-number-of-differences) | |
831 cur-diff | |
832 (cond ((= ediff-current-difference -1) " _") | |
833 ((= ediff-current-difference | |
834 ediff-number-of-differences) | |
835 " $") | |
836 (t (format | |
837 "%4d" (1+ ediff-current-difference)))) | |
838 job-name ediff-job-name)) | |
839 ;; back in the meta buf | |
840 (setq pt (point)) | |
841 (insert cur-diff "/" total-diffs "\t" | |
842 (buffer-name elt) | |
843 (format ": %s" (ediff-abbrev-jobname job-name))) | |
844 (insert | |
845 "\n\t\t " bufAname " " bufBname " " bufCname "\n") | |
846 (ediff-set-meta-overlay pt (point) elt)))) | |
847 ) ; while | |
848 (set-buffer-modified-p nil) | |
849 (goto-char point) | |
850 ))) | |
851 | |
852 ;; sets overlay around a meta record with 'ediff-meta-info property PROP | |
853 (defun ediff-set-meta-overlay (b e prop) | |
854 (let (overl) | |
855 (setq overl (ediff-make-overlay b e)) | |
856 (if ediff-emacs-p | |
857 (ediff-overlay-put overl 'mouse-face 'highlight) | |
858 (ediff-overlay-put overl 'highlight t)) | |
859 (ediff-overlay-put overl 'ediff-meta-info prop))) | |
860 | |
861 (defun ediff-mark-for-hiding (unmark) | |
862 "Mark session for hiding. With prefix arg, unmark." | |
863 (interactive "P") | |
864 (let* ((pos (ediff-event-point last-command-event)) | |
865 (meta-buf (ediff-event-buffer last-command-event)) | |
866 ;; ediff-get-meta-info gives error if meta-buf or pos are invalid | |
867 (info (ediff-get-meta-info meta-buf pos)) | |
868 (session-buf (ediff-get-session-buffer info))) | |
869 | |
870 (if unmark | |
871 (ediff-set-session-status info nil) | |
872 (if (ediff-buffer-live-p session-buf) | |
873 (error "Can't hide active session, %s" (buffer-name session-buf))) | |
874 (ediff-set-session-status info ?H)) | |
875 (ediff-update-meta-buffer meta-buf) | |
876 )) | |
877 | |
878 (defun ediff-mark-for-operation (unmark) | |
879 "Mark session for a group operation. With prefix arg, unmark." | |
880 (interactive "P") | |
881 (let* ((pos (ediff-event-point last-command-event)) | |
882 (meta-buf (ediff-event-buffer last-command-event)) | |
883 ;; ediff-get-meta-info gives error if meta-buf or pos are invalid | |
884 (info (ediff-get-meta-info meta-buf pos))) | |
885 | |
886 (if unmark | |
887 (ediff-set-session-status info nil) | |
888 (ediff-set-session-status info ?*)) | |
889 (ediff-update-meta-buffer meta-buf) | |
890 )) | |
891 | |
892 (defun ediff-hide-marked-sessions (unhide) | |
893 "Hide marked sessions. With prefix arg, unhide." | |
894 (interactive "P") | |
895 (let ((grp-buf (ediff-get-group-buffer ediff-meta-list)) | |
896 (meta-list (cdr ediff-meta-list)) | |
897 (from (if unhide ?I ?H)) | |
898 (to (if unhide ?H ?I)) | |
899 (numMarked 0) | |
900 elt) | |
901 (while meta-list | |
902 (setq elt (car meta-list) | |
903 meta-list (cdr meta-list)) | |
904 (if (eq (ediff-get-session-status elt) from) | |
905 (progn | |
906 (setq numMarked (1+ numMarked)) | |
907 (ediff-set-session-status elt to)))) | |
908 (if (> numMarked 0) | |
909 (ediff-update-meta-buffer grp-buf) | |
910 (beep) | |
911 (if unhide | |
912 (message "Nothing to reveal...") | |
913 (message "Nothing to hide..."))) | |
914 )) | |
915 | |
916 ;; Apply OPERATION to marked sessions. Operation expects one argument of type | |
917 ;; meta-list member (not the first one), i.e., a regular session description. | |
918 ;; Returns number of marked sessions on which operation was performed | |
919 (defun ediff-operate-on-marked-sessions (operation) | |
920 (let ((grp-buf (ediff-get-group-buffer ediff-meta-list)) | |
921 (meta-list (cdr ediff-meta-list)) | |
922 (marksym ?*) | |
923 (numMarked 0) | |
924 (sessionNum 0) | |
925 elt) | |
926 (while meta-list | |
927 (setq elt (car meta-list) | |
928 meta-list (cdr meta-list) | |
929 sessionNum (1+ sessionNum)) | |
930 (if (eq (ediff-get-session-status elt) marksym) | |
931 (save-excursion | |
932 (setq numMarked (1+ numMarked)) | |
933 (funcall operation elt sessionNum)))) | |
934 (ediff-update-meta-buffer grp-buf) ; just in case | |
935 numMarked | |
936 )) | |
937 | |
938 (defun ediff-append-custom-diff (session sessionNum) | |
939 (or (ediff-collect-diffs-metajob) | |
940 (error "Sorry, I don't do this for everyone...")) | |
941 (let ((session-buf (ediff-get-session-buffer session)) | |
942 (meta-diff-buff ediff-meta-diff-buffer) | |
943 (metajob ediff-metajob-name) | |
944 tmp-buf custom-diff-buf) | |
945 (if (ediff-buffer-live-p session-buf) | |
946 (ediff-eval-in-buffer session-buf | |
947 (if (eq ediff-control-buffer session-buf) ; individual session | |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
948 (progn |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
949 (ediff-compute-custom-diffs-maybe) |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
950 (setq custom-diff-buf ediff-custom-diff-buffer))))) |
13130 | 951 |
952 (or (ediff-buffer-live-p meta-diff-buff) | |
953 (error "Ediff: something wrong--no multiple diffs buffer")) | |
954 | |
955 (cond ((ediff-buffer-live-p custom-diff-buf) | |
956 (save-excursion | |
957 (set-buffer meta-diff-buff) | |
958 (goto-char (point-max)) | |
959 (insert-buffer custom-diff-buf) | |
960 (insert "\n"))) | |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
961 ((memq metajob '(ediff-directories |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
962 ediff-merge-directories |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
963 ediff-merge-directories-with-ancestor)) |
13130 | 964 ;; get diffs by calling shell command on ediff-custom-diff-program |
965 (save-excursion | |
966 (set-buffer (setq tmp-buf (get-buffer-create ediff-tmp-buffer))) | |
967 (erase-buffer) | |
968 (shell-command | |
969 (format "%s %s %s %s" | |
970 ediff-custom-diff-program ediff-custom-diff-options | |
971 (ediff-get-session-objA session) | |
972 (ediff-get-session-objB session)) | |
973 t)) | |
974 (save-excursion | |
975 (set-buffer meta-diff-buff) | |
976 (goto-char (point-max)) | |
977 (insert-buffer tmp-buf) | |
978 (insert "\n"))) | |
979 (t | |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
980 (error "Can't make context diff for Session %d" sessionNum ))) |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
981 )) |
13130 | 982 |
983 (defun ediff-collect-custom-diffs () | |
984 "Collect custom diffs of marked sessions in buffer `*Ediff Multifile Diffs*'. | |
985 This operation is defined only for `ediff-directories' and | |
986 `ediff-directory-revisions', since its intent is to produce | |
987 multifile patches. For `ediff-directory-revisions', we insist that | |
988 all marked sessions must be active." | |
989 (interactive) | |
990 (or (ediff-buffer-live-p ediff-meta-diff-buffer) | |
991 (setq ediff-meta-diff-buffer | |
992 (get-buffer-create | |
993 (ediff-unique-buffer-name "*Ediff Multifile Diffs" "*")))) | |
994 (ediff-eval-in-buffer ediff-meta-diff-buffer | |
995 (erase-buffer)) | |
996 (if (> (ediff-operate-on-marked-sessions 'ediff-append-custom-diff) 0) | |
997 ;; did something | |
998 (display-buffer ediff-meta-diff-buffer 'not-this-window) | |
999 (beep) | |
1000 (message "No marked sessions found"))) | |
1001 | |
1002 | |
1003 ;; This function executes in meta buffer. It knows where event happened. | |
1004 (defun ediff-dir-action () | |
1005 "Execute appropriate action for the selected session." | |
1006 (interactive) | |
1007 (let* ((pos (ediff-event-point last-command-event)) | |
1008 (meta-buf (ediff-event-buffer last-command-event)) | |
1009 ;; ediff-get-meta-info gives error if meta-buf or pos are invalid | |
1010 (info (ediff-get-meta-info meta-buf pos)) | |
1011 session-buf file1 file2 file3 regexp) | |
1012 | |
1013 (setq session-buf (ediff-get-session-buffer info) | |
1014 file1 (ediff-get-session-objA info) | |
1015 file2 (ediff-get-session-objB info) | |
1016 file3 (ediff-get-session-objC info)) | |
1017 | |
1018 ;; make sure we don't start on hidden sessions | |
1019 ;; ?H means marked for hiding. ?I means invalid (hidden). | |
1020 (if (memq (ediff-get-session-status info) '(?H ?I)) | |
1021 (progn | |
1022 (beep) | |
1023 (if (y-or-n-p "This session is marked as hidden, unmark? ") | |
1024 (progn | |
1025 (ediff-set-session-status info nil) | |
1026 (ediff-update-meta-buffer meta-buf)) | |
1027 (error "Aborted")))) | |
1028 | |
1029 (ediff-eval-in-buffer meta-buf | |
1030 (goto-char pos) ; if the user clicked on session--move point there | |
1031 ;; First handle sessions involving directories (which are themselves | |
1032 ;; session groups) | |
1033 ;; After that handle individual sessions | |
1034 (cond ((and (file-directory-p file1) | |
1035 (stringp file2) (file-directory-p file2) | |
1036 (if (stringp file3) (file-directory-p file1) t)) | |
1037 ;; do ediff/ediff-merge on subdirectories | |
1038 (if (ediff-buffer-live-p session-buf) | |
1039 (ediff-show-meta-buffer session-buf) | |
1040 (setq regexp (read-string "Filter through regular expression: " | |
1041 nil 'ediff-filtering-regexp-history)) | |
1042 (ediff-directories-internal | |
1043 file1 file2 file3 regexp | |
1044 ediff-session-action-function | |
1045 ediff-metajob-name | |
1046 ;; make it update car info after startup | |
1047 (` (list (lambda () | |
1048 ;; child session group should know its parent | |
1049 (setq ediff-parent-meta-buffer | |
1050 (quote (, ediff-meta-buffer))) | |
1051 ;; and parent will know its child | |
1052 (setcar (quote (, info)) ediff-meta-buffer))))))) | |
1053 | |
1054 ;; Do ediff-revision on a subdirectory | |
1055 ((and (ediff-dir1-metajob) (file-directory-p file1)) | |
1056 (if (ediff-buffer-live-p session-buf) | |
1057 (ediff-show-meta-buffer session-buf) | |
1058 (setq regexp (read-string "Filter through regular expression: " | |
1059 nil 'ediff-filtering-regexp-history)) | |
1060 (ediff-directory-revisions-internal | |
1061 file1 regexp | |
1062 ediff-session-action-function ediff-metajob-name | |
1063 ;; make it update car info after startup | |
1064 (` (list (lambda () | |
1065 ;; child session group should know its parent | |
1066 (setq ediff-parent-meta-buffer | |
1067 (quote (, ediff-meta-buffer))) | |
1068 ;; and parent will know its child | |
1069 (setcar (quote (, info)) ediff-meta-buffer))))))) | |
1070 | |
1071 ;; From here on---only individual session handlers | |
1072 | |
1073 ;; handle an individual session with live control buffer | |
1074 ((ediff-buffer-live-p session-buf) | |
1075 (ediff-eval-in-buffer session-buf | |
1076 (setq ediff-mouse-pixel-position (mouse-pixel-position)) | |
1077 (ediff-recenter 'no-rehighlight))) | |
1078 | |
1079 ((ediff-problematic-session-p info) | |
1080 (beep) | |
1081 (if (y-or-n-p | |
1082 "This session's ancestor is a directory, merge without the ancestor? ") | |
1083 (ediff-merge-files | |
1084 file1 file2 | |
1085 ;; arrange startup hooks | |
1086 (` (list (lambda () | |
1087 (setq ediff-meta-buffer (, (current-buffer))) | |
1088 ;; see below for the explanation of what this does | |
1089 (setcar | |
1090 (quote (, info)) ediff-control-buffer))))) | |
1091 (error "Aborted"))) | |
1092 ((ediff-dir1-metajob) ; needs 1 file arg | |
1093 (funcall ediff-session-action-function | |
1094 file1 | |
1095 ;; arrange startup hooks | |
1096 (` (list (lambda () | |
1097 (setq ediff-meta-buffer (, (current-buffer))) | |
1098 ;; see below for explanation of what this does | |
1099 (setcar | |
1100 (quote (, info)) ediff-control-buffer)))))) | |
1101 ((not (ediff-metajob3)) ; need 2 file args | |
1102 (funcall ediff-session-action-function | |
1103 file1 file2 | |
1104 ;; arrange startup hooks | |
1105 (` (list (lambda () | |
1106 (setq ediff-meta-buffer (, (current-buffer))) | |
1107 ;; this makes ediff-startup pass the value of | |
1108 ;; ediff-control-buffer back to the meta | |
1109 ;; level, to the record in the meta list | |
1110 ;; containing the information about the | |
1111 ;; session associated with that | |
1112 ;; ediff-control-buffer | |
1113 (setcar | |
1114 (quote (, info)) ediff-control-buffer)))))) | |
1115 ((ediff-metajob3) ; need 3 file args | |
1116 (funcall ediff-session-action-function | |
1117 file1 file2 file3 | |
1118 ;; arrange startup hooks | |
1119 (` (list (lambda () | |
1120 (setq ediff-meta-buffer (, (current-buffer))) | |
1121 (setcar | |
1122 (quote (, info)) ediff-control-buffer)))))) | |
1123 ) ; cond | |
1124 ) ; eval in meta-buf | |
1125 )) | |
1126 | |
1127 (defun ediff-registry-action () | |
1128 "Switch to a selected session." | |
1129 (interactive) | |
1130 (let* ((pos (ediff-event-point last-command-event)) | |
1131 (buf (ediff-event-buffer last-command-event)) | |
1132 (ctl-buf (ediff-get-meta-info buf pos))) | |
1133 | |
1134 (if (ediff-buffer-live-p ctl-buf) | |
1135 ;; check if this is ediff-control-buffer or ediff-meta-buffer | |
1136 (if (ediff-eval-in-buffer ctl-buf | |
1137 (eq (key-binding "q") 'ediff-quit-meta-buffer)) | |
1138 ;; it's a meta-buffer -- last action should just display it | |
1139 (ediff-show-meta-buffer ctl-buf) | |
1140 ;; it's a session buffer -- invoke go back to session | |
1141 (ediff-eval-in-buffer ctl-buf | |
1142 (setq ediff-mouse-pixel-position (mouse-pixel-position)) | |
1143 (ediff-recenter 'no-rehighlight))) | |
1144 (beep) | |
1145 (message "You've selected a stale session --- try again") | |
1146 (ediff-update-registry)) | |
1147 (ediff-eval-in-buffer buf | |
1148 (goto-char pos)) | |
1149 )) | |
1150 | |
1151 | |
1152 (defun ediff-show-meta-buffer (&optional meta-buf) | |
1153 "Show the session group buffer." | |
1154 (interactive) | |
1155 (let (wind frame silent) | |
1156 (if meta-buf (setq silent t)) | |
1157 | |
1158 (setq meta-buf (or meta-buf ediff-meta-buffer)) | |
1159 (cond ((not (bufferp meta-buf)) | |
1160 (error "This Ediff session is not part of a session group")) | |
1161 ((not (ediff-buffer-live-p meta-buf)) | |
1162 (error | |
1163 "Can't find this session's group panel -- session itself is ok"))) | |
1164 | |
1165 (ediff-cleanup-meta-buffer meta-buf) | |
1166 (ediff-eval-in-buffer meta-buf | |
1167 (save-excursion | |
1168 (cond ((setq wind (ediff-get-visible-buffer-window meta-buf)) | |
1169 (or silent | |
1170 (message | |
1171 "Already showing the group panel for this session")) | |
1172 (set-window-buffer wind meta-buf) | |
1173 (select-window wind)) | |
1174 ((window-live-p (setq wind ediff-window-C)) ;in merge--merge buf | |
1175 (set-window-buffer ediff-window-C meta-buf) | |
1176 (select-window wind)) | |
1177 ((window-live-p (setq wind ediff-window-A)) | |
1178 (set-window-buffer ediff-window-A meta-buf) | |
1179 (select-window wind)) | |
1180 ((window-live-p (setq wind ediff-window-B)) | |
1181 (set-window-buffer ediff-window-B meta-buf) | |
1182 (select-window wind)) | |
1183 ((and | |
1184 (setq wind | |
1185 (ediff-get-visible-buffer-window ediff-registry-buffer)) | |
1186 (ediff-window-display-p)) | |
1187 (select-window wind) | |
1188 (other-window 1) | |
1189 (set-window-buffer (selected-window) meta-buf)) | |
1190 (t (ediff-skip-unsuitable-frames 'ok-unsplittable) | |
1191 (set-window-buffer (selected-window) meta-buf))) | |
1192 )) | |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1193 (if (and (ediff-window-display-p) |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1194 (window-live-p |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1195 (setq wind (ediff-get-visible-buffer-window meta-buf)))) |
13130 | 1196 (progn |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1197 (setq frame (window-frame wind)) |
13130 | 1198 (raise-frame frame) |
1199 (ediff-reset-mouse frame))) | |
1200 (run-hooks 'ediff-show-session-group-hook) | |
1201 )) | |
1202 | |
1203 (defun ediff-show-meta-buff-from-registry () | |
1204 "Display the session group buffer for a selected session group." | |
1205 (interactive) | |
1206 (let* ((pos (ediff-event-point last-command-event)) | |
1207 (meta-buf (ediff-event-buffer last-command-event)) | |
1208 (info (ediff-get-meta-info meta-buf pos)) | |
1209 (meta-or-session-buf info)) | |
1210 (ediff-eval-in-buffer meta-or-session-buf | |
1211 (ediff-show-meta-buffer)))) | |
1212 | |
1213 ;;;###autoload | |
1214 (defun ediff-show-registry () | |
1215 "Display Ediff's registry." | |
1216 (interactive) | |
1217 (ediff-update-registry) | |
1218 (if (not (ediff-buffer-live-p ediff-registry-buffer)) | |
1219 (error "No active Ediff sessions or corrupted session registry")) | |
1220 (let (wind frame) | |
1221 ;; 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
|
1222 ;; explicitly |
13130 | 1223 (ediff-eval-in-buffer ediff-registry-buffer |
1224 (save-excursion | |
1225 (cond ((setq wind | |
1226 (ediff-get-visible-buffer-window ediff-registry-buffer)) | |
1227 (message "Already showing the registry") | |
1228 (set-window-buffer wind ediff-registry-buffer) | |
1229 (select-window wind)) | |
1230 ((window-live-p ediff-window-C) | |
1231 (set-window-buffer ediff-window-C ediff-registry-buffer) | |
1232 (select-window ediff-window-C)) | |
1233 ((window-live-p ediff-window-A) | |
1234 (set-window-buffer ediff-window-A ediff-registry-buffer) | |
1235 (select-window ediff-window-A)) | |
1236 ((window-live-p ediff-window-B) | |
1237 (set-window-buffer ediff-window-B ediff-registry-buffer) | |
1238 (select-window ediff-window-B)) | |
1239 ((and (setq wind | |
1240 (ediff-get-visible-buffer-window ediff-meta-buffer)) | |
1241 (ediff-window-display-p)) | |
1242 (select-window wind) | |
1243 (other-window 1) | |
1244 (set-window-buffer (selected-window) ediff-registry-buffer)) | |
1245 (t (ediff-skip-unsuitable-frames 'ok-unsplittable) | |
1246 (set-window-buffer (selected-window) ediff-registry-buffer))) | |
1247 )) | |
1248 (if (ediff-window-display-p) | |
1249 (progn | |
1250 (setq frame | |
1251 (window-frame | |
1252 (ediff-get-visible-buffer-window ediff-registry-buffer))) | |
1253 (raise-frame frame) | |
1254 (ediff-reset-mouse frame))) | |
1255 (run-hooks 'ediff-show-registry-hook) | |
1256 )) | |
1257 | |
1258 ;;;###autoload | |
1259 (defalias 'eregistry 'ediff-show-registry) | |
1260 | |
1261 ;; If meta-buf doesn't exist, it is created. In that case, id doesn't have a | |
1262 ;; parent meta-buf | |
1263 ;; Check if META-BUF exists before calling this function | |
1264 (defun ediff-update-meta-buffer (meta-buf) | |
1265 (ediff-eval-in-buffer (current-buffer) | |
1266 (if (ediff-buffer-live-p meta-buf) | |
1267 (ediff-eval-in-buffer meta-buf | |
1268 (funcall ediff-meta-redraw-function ediff-meta-list)) | |
1269 ))) | |
1270 | |
1271 (defun ediff-update-registry () | |
1272 (ediff-eval-in-buffer (current-buffer) | |
1273 (if (ediff-buffer-live-p ediff-registry-buffer) | |
1274 (ediff-redraw-registry-buffer) | |
1275 (ediff-prepare-meta-buffer | |
1276 'ediff-registry-action | |
1277 ediff-session-registry | |
1278 "*Ediff Registry" | |
1279 'ediff-redraw-registry-buffer | |
1280 'ediff-registry)) | |
1281 )) | |
1282 | |
1283 ;; if meta-buf exists, it is redrawn along with parent. Otherwise, nothing | |
1284 ;; happens | |
1285 (defun ediff-cleanup-meta-buffer (meta-buffer) | |
1286 (if (ediff-buffer-live-p meta-buffer) | |
1287 (ediff-eval-in-buffer meta-buffer | |
1288 (ediff-update-meta-buffer meta-buffer) | |
1289 (if (ediff-buffer-live-p ediff-parent-meta-buffer) | |
1290 (ediff-update-meta-buffer ediff-parent-meta-buffer))))) | |
1291 | |
1292 ;; t if no session in progress | |
1293 (defun ediff-safe-to-quit (meta-buffer) | |
1294 (if (ediff-buffer-live-p meta-buffer) | |
1295 (let ((lis ediff-meta-list) | |
1296 (cont t) | |
1297 buffer-read-only) | |
1298 (ediff-update-meta-buffer meta-buffer) | |
1299 (ediff-eval-in-buffer meta-buffer | |
1300 (setq lis (cdr lis)) ; discard the description part of meta-list | |
1301 (while (and cont lis) | |
1302 (if (ediff-buffer-live-p | |
1303 (ediff-get-group-buffer lis)) ; in progress | |
1304 (setq cont nil)) | |
1305 (setq lis (cdr lis))) | |
1306 cont)))) | |
1307 | |
1308 (defun ediff-quit-meta-buffer () | |
1309 "If no unprocessed sessions in the group, delete the meta buffer. | |
1310 If no session is in progress, ask to confirm before deleting meta buffer. | |
1311 Otherwise, bury the meta buffer. | |
1312 If this is a session registry buffer then just bury it." | |
1313 (interactive) | |
1314 (let* ((buf (current-buffer)) | |
1315 (dir-diffs-buffer ediff-dir-diffs-buffer) | |
1316 (meta-diff-buffer ediff-meta-diff-buffer) | |
1317 (parent-buf ediff-parent-meta-buffer) | |
1318 (dont-show-registry (eq buf ediff-registry-buffer))) | |
1319 (if dont-show-registry | |
1320 (bury-buffer) | |
1321 (ediff-cleanup-meta-buffer buf) | |
1322 (cond ((and (ediff-safe-to-quit buf) | |
1323 (y-or-n-p "Quit this session group? ")) | |
1324 (ediff-dispose-of-meta-buffer buf)) | |
1325 ((ediff-safe-to-quit buf) | |
1326 (bury-buffer)) | |
1327 (t | |
1328 (bury-buffer) | |
1329 (beep) | |
1330 (message | |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1331 "Session group suspended, not deleted (has active sessions)"))) |
13130 | 1332 (ediff-cleanup-meta-buffer parent-buf) |
1333 (ediff-kill-buffer-carefully dir-diffs-buffer) | |
1334 (ediff-kill-buffer-carefully meta-diff-buffer) | |
1335 (if (ediff-buffer-live-p parent-buf) | |
1336 (progn | |
1337 (setq dont-show-registry t) | |
1338 (ediff-show-meta-buffer parent-buf))) | |
1339 ) | |
1340 (or dont-show-registry | |
1341 (ediff-show-registry)))) | |
1342 | |
1343 (defun ediff-dispose-of-meta-buffer (buf) | |
1344 (setq ediff-session-registry (delq buf ediff-session-registry)) | |
1345 (ediff-eval-in-buffer buf | |
1346 (if (ediff-buffer-live-p ediff-dir-diffs-buffer) | |
1347 (kill-buffer ediff-dir-diffs-buffer))) | |
1348 (kill-buffer buf)) | |
1349 | |
1350 | |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1351 ;; Obtain information on a meta record where the user clicked or typed |
13130 | 1352 ;; BUF is the buffer where this happened and POINT is the position |
1353 ;; If optional NOERROR arg is given, don't report error and return nil if no | |
1354 ;; meta info is found on line. | |
1355 (defun ediff-get-meta-info (buf point &optional noerror) | |
1356 (let (result olist tmp) | |
1357 (if (and point (ediff-buffer-live-p buf)) | |
1358 (ediff-eval-in-buffer buf | |
1359 (if ediff-xemacs-p | |
1360 (setq result | |
1361 (if (setq tmp (extent-at point buf 'ediff-meta-info)) | |
1362 (ediff-overlay-get tmp 'ediff-meta-info))) | |
1363 (setq olist (overlays-at point)) | |
1364 (setq olist | |
1365 (mapcar (function (lambda (elt) | |
1366 (overlay-get elt 'ediff-meta-info))) | |
1367 olist)) | |
1368 (while (and olist (null (car olist)) | |
1369 (overlay-get (car olist) 'invisible)) | |
1370 (setq olist (cdr olist))) | |
1371 (setq result (car olist))))) | |
1372 (if result | |
1373 result | |
1374 (if noerror | |
1375 nil | |
1376 (ediff-update-registry) | |
1377 (error "No session info in this line"))))) | |
1378 | |
1379 ;; return location of the next meta overlay after point | |
1380 (defun ediff-next-meta-overlay-start (point) | |
1381 (let (overl) | |
1382 (if ediff-xemacs-p | |
1383 (progn | |
1384 (setq overl (extent-at point (current-buffer) 'ediff-meta-info)) | |
1385 (if overl | |
1386 (setq overl (next-extent overl)) | |
1387 (setq overl (next-extent (current-buffer)))) | |
1388 (if overl | |
1389 (extent-start-position overl) | |
1390 (point-max))) | |
1391 (if (= point (point-max)) (setq point (point-min))) | |
1392 (setq overl (car (overlays-at point))) | |
1393 (if (and overl (overlay-get overl 'ediff-meta-info)) | |
1394 (overlay-end overl) | |
1395 (next-overlay-change point))))) | |
1396 | |
1397 (defun ediff-previous-meta-overlay-start (point) | |
1398 (let (overl) | |
1399 (if ediff-xemacs-p | |
1400 (progn | |
1401 (setq overl (extent-at point (current-buffer) 'ediff-meta-info)) | |
1402 (if overl | |
1403 (setq overl (previous-extent overl)) | |
1404 (setq overl (previous-extent (current-buffer)))) | |
1405 (if overl | |
1406 (extent-start-position overl) | |
1407 (point-max))) | |
1408 ;;(if (bobp) (setq point (point-max))) | |
1409 (setq overl (car (overlays-at point))) | |
1410 (setq point (if (and overl (overlay-get overl 'ediff-meta-info)) | |
1411 (previous-overlay-change (overlay-start overl)) | |
1412 (previous-overlay-change point))) | |
1413 (if (= point (point-min)) (point-max) point) | |
1414 ))) | |
1415 | |
1416 | |
1417 ;;; Local Variables: | |
1418 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun) | |
1419 ;;; eval: (put 'ediff-eval-in-buffer 'lisp-indent-hook 1) | |
1420 ;;; End: | |
1421 | |
13607
71a4a349d998
Renamed from ediff-meta.el. Changed provide.
Richard M. Stallman <rms@gnu.org>
parents:
13216
diff
changeset
|
1422 (provide 'ediff-mult) |
13130 | 1423 (require 'ediff-util) |
1424 | |
13607
71a4a349d998
Renamed from ediff-meta.el. Changed provide.
Richard M. Stallman <rms@gnu.org>
parents:
13216
diff
changeset
|
1425 ;;; ediff-mult.el ends here |