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