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