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