Mercurial > emacs
annotate lisp/ediff-mult.el @ 37944:b64d19038fca
(note_mouse_highlight): If an overlapping overlay
exists, but we find that we highlight the same overlay as before,
don't do the highlighting again.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Wed, 30 May 2001 11:19:10 +0000 |
parents | 6306740f6938 |
children | 10482dd382e7 |
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 |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
45 ;; developer. The only thing is that it must be a list of lists, |
15480
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 |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
49 ;; or string). The function ediff-redraw-registry-buffer displays the |
15480
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 |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
64 ;; describe objects relevant to the session. Usually they are names of |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
65 ;; files, but sometimes they may be other things. For instance, obj3 |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
66 ;; is nil for jobs that involve only two files. For patch jobs, obj2 |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
67 ;; and obj3 are markers that specify the patch corresponding to the |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
68 ;; file (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 |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
81 ;; (which are different in each directory). For instance, one may want to |
13130 | 82 ;; compare files of the form abc{something}.c to files old{something}.d |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
83 ;; which may be in the same or different directories. Or, one may want to |
13130 | 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 |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
87 ;; up appropriate files. It will also require a generalization of the |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
88 ;; functions 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: | |
20206 | 123 button2, v, or RET over session record: start that Ediff session |
124 M:\tin sessions invoked from here, brings back this group panel | |
125 R:\tdisplay the registry of active Ediff sessions | |
126 h:\tmark session for hiding (toggle) | |
127 x:\thide marked sessions; with prefix arg: unhide | |
128 m:\tmark session for a non-hiding operation (toggle) | |
22286 | 129 uh/um:\tunmark all sessions marked for hiding/operation |
20206 | 130 n,SPC:\tnext session |
131 p,DEL:\tprevious session | |
132 E:\tbrowse Ediff on-line manual | |
133 T:\ttoggle truncation of long file names | |
134 q:\tquit this session group | |
13130 | 135 ") |
136 | |
137 (ediff-defvar-local ediff-meta-buffer-map nil | |
138 "The keymap for the meta buffer.") | |
139 (defvar ediff-dir-diffs-buffer-map (make-sparse-keymap) | |
140 "The keymap to be installed in the buffer showing differences between | |
141 directories.") | |
142 | |
143 ;; Variable specifying the action to take when the use invokes ediff in the | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
144 ;; meta buffer. This is usually ediff-registry-action or ediff-filegroup-action |
13130 | 145 (ediff-defvar-local ediff-meta-action-function nil "") |
146 ;; Tells ediff-update-meta-buffer how to redraw it | |
147 (ediff-defvar-local ediff-meta-redraw-function nil "") | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
148 ;; 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
|
149 ;; the sessions in a given session group |
13130 | 150 (ediff-defvar-local ediff-session-action-function nil "") |
151 | |
152 (ediff-defvar-local ediff-metajob-name nil "") | |
153 | |
154 ;; buffer used to collect custom diffs from individual sessions in the group | |
155 (ediff-defvar-local ediff-meta-diff-buffer nil "") | |
156 | |
157 ;; history var to use for filtering groups | |
158 (defvar ediff-filtering-regexp-history nil "") | |
159 | |
19774 | 160 ;; This has the form ((meta-buf regexp dir1 dir2 dir3 merge-auto-store-dir) |
161 ;; (ctl-buf session-status (file1 . eq-status) (file2 . eq-status) (file3 | |
162 ;; . eq-status)) (ctl-buf session-status (file1 . eq-status) (file2 | |
163 ;; . eq-status)) ...) | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
164 ;; If ctl-buf is nil, the file-pair hasn't processed yet. If it is |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
165 ;; killed-buffer object, the file pair has been processed. If it is a live |
19774 | 166 ;; buffer, this means ediff is still working on the pair. |
167 ;; Eq-status of a file is t if the file equals some other file in the same | |
168 ;; group. | |
13130 | 169 (ediff-defvar-local ediff-meta-list nil "") |
170 | |
20206 | 171 (ediff-defvar-local ediff-meta-session-number nil "") |
172 | |
13130 | 173 |
174 ;; the difference list between directories in a directory session group | |
175 (ediff-defvar-local ediff-dir-difference-list nil "") | |
176 (ediff-defvar-local ediff-dir-diffs-buffer nil "") | |
177 | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
178 ;; The registry of Ediff sessions. A list of control buffers. |
13130 | 179 (defvar ediff-session-registry nil) |
180 | |
20206 | 181 (defcustom ediff-meta-truncate-filenames t |
182 "*If non-nil, truncate long file names in the session group buffers. | |
183 This can be toggled with `ediff-toggle-filename-truncation'." | |
184 :type 'hook | |
185 :group 'ediff-mult) | |
18054 | 186 (defcustom ediff-registry-setup-hook nil |
187 "*Hooks run just after the registry control panel is set up." | |
188 :type 'hook | |
189 :group 'ediff-mult) | |
33019
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
29165
diff
changeset
|
190 |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
29165
diff
changeset
|
191 (defcustom ediff-before-session-group-setup-hooks nil |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
29165
diff
changeset
|
192 "*Hooks to run before Ediff arranges the window for group-level operations. |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
29165
diff
changeset
|
193 It is used by commands such as ediff-directories. |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
29165
diff
changeset
|
194 This hook can be used to save the previous window config, which can be restored |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
29165
diff
changeset
|
195 on ediff-quit, ediff-suspend, or ediff-quit-session-group-hook." |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
29165
diff
changeset
|
196 :type 'hook |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
29165
diff
changeset
|
197 :group 'ediff-hook) |
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
29165
diff
changeset
|
198 (defcustom ediff-after-session-group-setup-hook nil |
13130 | 199 "*Hooks run just after a meta-buffer controlling a session group, such as |
18054 | 200 ediff-directories, is run." |
201 :type 'hook | |
202 :group 'ediff-mult) | |
203 (defcustom ediff-quit-session-group-hook nil | |
204 "*Hooks run just before exiting a session group." | |
205 :type 'hook | |
206 :group 'ediff-mult) | |
207 (defcustom ediff-show-registry-hook nil | |
208 "*Hooks run just after the registry buffer is shown." | |
209 :type 'hook | |
210 :group 'ediff-mult) | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
211 (defcustom ediff-show-session-group-hook '(delete-other-windows) |
18054 | 212 "*Hooks run just after a session group buffer is shown." |
213 :type 'hook | |
214 :group 'ediff-mult) | |
215 (defcustom ediff-meta-buffer-keymap-setup-hook nil | |
16766
beb94a5271e2
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
16248
diff
changeset
|
216 "*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
|
217 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
|
218 This means that you can set different bindings for different kinds of meta |
18054 | 219 buffers." |
220 :type 'hook | |
221 :group 'ediff-mult) | |
13130 | 222 |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
223 ;; Buffer holding the multi-file patch. Local to the meta buffer |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
224 (ediff-defvar-local ediff-meta-patchbufer nil "") |
13130 | 225 |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
226 ;;; API for ediff-meta-list |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
227 |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
228 ;; group buffer/regexp |
19774 | 229 (defsubst ediff-get-group-buffer (meta-list) |
13130 | 230 (nth 0 (car meta-list))) |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
231 |
19774 | 232 (defsubst ediff-get-group-regexp (meta-list) |
13130 | 233 (nth 1 (car meta-list))) |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
234 ;; group objects |
19774 | 235 (defsubst ediff-get-group-objA (meta-list) |
13130 | 236 (nth 2 (car meta-list))) |
19774 | 237 (defsubst ediff-get-group-objB (meta-list) |
13130 | 238 (nth 3 (car meta-list))) |
19774 | 239 (defsubst ediff-get-group-objC (meta-list) |
13130 | 240 (nth 4 (car meta-list))) |
19774 | 241 (defsubst ediff-get-group-merge-autostore-dir (meta-list) |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
242 (nth 5 (car meta-list))) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
243 |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
244 ;; session buffer |
19774 | 245 (defsubst ediff-get-session-buffer (elt) |
13130 | 246 (nth 0 elt)) |
19774 | 247 (defsubst ediff-get-session-status (elt) |
13130 | 248 (nth 1 elt)) |
19774 | 249 (defsubst ediff-set-session-status (session-info new-status) |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
250 (setcar (cdr session-info) new-status)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
251 ;; session objects |
19774 | 252 (defsubst ediff-get-session-objA (elt) |
13130 | 253 (nth 2 elt)) |
19774 | 254 (defsubst ediff-get-session-objB (elt) |
13130 | 255 (nth 3 elt)) |
19774 | 256 (defsubst ediff-get-session-objC (elt) |
13130 | 257 (nth 4 elt)) |
19774 | 258 (defsubst ediff-get-session-objA-name (elt) |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
259 (car (nth 2 elt))) |
19774 | 260 (defsubst ediff-get-session-objB-name (elt) |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
261 (car (nth 3 elt))) |
19774 | 262 (defsubst ediff-get-session-objC-name (elt) |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
263 (car (nth 4 elt))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
264 ;; equality indicators |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
265 (defsubst ediff-get-file-eqstatus (elt) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
266 (nth 1 elt)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
267 (defsubst ediff-set-file-eqstatus (elt value) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
268 (setcar (cdr elt) value)) |
13130 | 269 |
20206 | 270 ;; The activity marker is either or + (active session, i.e., ediff is currently |
271 ;; run in it), or - (finished session, i.e., we've ran ediff in it and then | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
272 ;; exited). Return nil, if session is neither active nor finished |
20206 | 273 (defun ediff-get-session-activity-marker (session) |
274 (let ((session-buf (ediff-get-session-buffer session))) | |
275 (cond ((null session-buf) nil) ; virgin session | |
276 ((ediff-buffer-live-p session-buf) ?+) ;active session | |
277 (t ?-)))) | |
278 | |
19774 | 279 ;; checks if the session is a meta session |
280 (defun ediff-meta-session-p (session-info) | |
281 (and (stringp (ediff-get-session-objA-name session-info)) | |
282 (file-directory-p (ediff-get-session-objA-name session-info)) | |
283 (stringp (ediff-get-session-objB-name session-info)) | |
284 (file-directory-p (ediff-get-session-objB-name session-info)) | |
285 (if (stringp (ediff-get-session-objC-name session-info)) | |
286 (file-directory-p (ediff-get-session-objC-name session-info)) t))) | |
287 | |
13130 | 288 ;; set up the keymap in the meta buffer |
289 (defun ediff-setup-meta-map() | |
290 (setq ediff-meta-buffer-map (make-sparse-keymap)) | |
291 (suppress-keymap ediff-meta-buffer-map) | |
292 (define-key ediff-meta-buffer-map "q" 'ediff-quit-meta-buffer) | |
20206 | 293 (define-key ediff-meta-buffer-map "T" 'ediff-toggle-filename-truncation) |
13130 | 294 (define-key ediff-meta-buffer-map "R" 'ediff-show-registry) |
295 (define-key ediff-meta-buffer-map "E" 'ediff-documentation) | |
296 (define-key ediff-meta-buffer-map "v" ediff-meta-action-function) | |
297 (define-key ediff-meta-buffer-map "\C-m" ediff-meta-action-function) | |
298 (define-key ediff-meta-buffer-map " " 'ediff-next-meta-item) | |
20206 | 299 (define-key ediff-meta-buffer-map "n" 'ediff-next-meta-item) |
13130 | 300 (define-key ediff-meta-buffer-map "\C-?" 'ediff-previous-meta-item) |
20206 | 301 (define-key ediff-meta-buffer-map "p" 'ediff-previous-meta-item) |
13130 | 302 (define-key ediff-meta-buffer-map [delete] 'ediff-previous-meta-item) |
303 (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
|
304 (or (ediff-one-filegroup-metajob) |
22286 | 305 (progn |
306 (define-key ediff-meta-buffer-map "=" nil) | |
307 (define-key ediff-meta-buffer-map "==" 'ediff-meta-mark-equal-files) | |
308 (define-key ediff-meta-buffer-map "=m" 'ediff-meta-mark-equal-files) | |
309 (define-key ediff-meta-buffer-map "=h" 'ediff-meta-mark-equal-files))) | |
13130 | 310 (if ediff-no-emacs-help-in-control-buffer |
311 (define-key ediff-meta-buffer-map "\C-h" 'ediff-previous-meta-item)) | |
312 (if ediff-emacs-p | |
313 (define-key ediff-meta-buffer-map [mouse-2] ediff-meta-action-function) | |
314 (define-key ediff-meta-buffer-map [button2] ediff-meta-action-function)) | |
315 | |
16766
beb94a5271e2
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
16248
diff
changeset
|
316 (use-local-map ediff-meta-buffer-map) |
beb94a5271e2
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
16248
diff
changeset
|
317 ;; modify ediff-meta-buffer-map here |
beb94a5271e2
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
16248
diff
changeset
|
318 (run-hooks 'ediff-meta-buffer-keymap-setup-hook)) |
13130 | 319 |
320 (defun ediff-meta-mode () | |
321 "This mode controls all operations on Ediff session groups. | |
322 It is entered through one of the following commands: | |
323 `ediff-directories' | |
324 `edirs' | |
325 `ediff-directories3' | |
326 `edirs3' | |
327 `ediff-merge-directories' | |
328 `edirs-merge' | |
329 `ediff-merge-directories-with-ancestor' | |
330 `edirs-merge-with-ancestor' | |
331 `ediff-directory-revisions' | |
332 `edir-revisions' | |
333 `ediff-merge-directory-revisions' | |
334 `edir-merge-revisions' | |
335 `ediff-merge-directory-revisions-with-ancestor' | |
336 `edir-merge-revisions-with-ancestor' | |
337 | |
338 Commands: | |
339 \\{ediff-meta-buffer-map}" | |
340 (kill-all-local-variables) | |
341 (setq major-mode 'ediff-meta-mode) | |
342 (setq mode-name "MetaEdiff")) | |
343 | |
344 | |
345 ;; the keymap for the buffer showing directory differences | |
346 (suppress-keymap ediff-dir-diffs-buffer-map) | |
347 (define-key ediff-dir-diffs-buffer-map "q" 'ediff-bury-dir-diffs-buffer) | |
348 (define-key ediff-dir-diffs-buffer-map " " 'next-line) | |
20206 | 349 (define-key ediff-dir-diffs-buffer-map "n" 'next-line) |
13130 | 350 (define-key ediff-dir-diffs-buffer-map "\C-?" 'previous-line) |
20206 | 351 (define-key ediff-dir-diffs-buffer-map "p" 'previous-line) |
13130 | 352 (define-key ediff-dir-diffs-buffer-map [delete] 'previous-line) |
353 (define-key ediff-dir-diffs-buffer-map [backspace] 'previous-line) | |
354 | |
355 (defun ediff-next-meta-item (count) | |
356 "Move to the next item in Ediff registry or session group buffer. | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
357 Moves in circular fashion. With numeric prefix arg, skip this many items." |
13130 | 358 (interactive "p") |
359 (or count (setq count 1)) | |
20206 | 360 (let (overl) |
361 (while (< 0 count) | |
362 (setq count (1- count)) | |
363 (ediff-next-meta-item1) | |
364 (setq overl (ediff-get-meta-overlay-at-pos (point))) | |
365 ;; skip invisible ones | |
366 (while (and overl (ediff-overlay-get overl 'invisible)) | |
367 (ediff-next-meta-item1) | |
368 (setq overl (ediff-get-meta-overlay-at-pos (point))))))) | |
13130 | 369 |
370 ;; Move to the next meta item | |
371 (defun ediff-next-meta-item1 () | |
372 (let (pos) | |
373 (setq pos (ediff-next-meta-overlay-start (point))) | |
374 (if pos (goto-char pos)) | |
375 (if (eq ediff-metajob-name 'ediff-registry) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
376 (if (and (ediff-get-meta-info (current-buffer) pos 'noerror) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
377 (search-forward "*Ediff" nil t)) |
13130 | 378 (skip-chars-backward "a-zA-Z*")) |
379 (if (> (skip-chars-forward "-+?H* \t0-9") 0) | |
380 (backward-char 1))))) | |
381 | |
382 | |
383 (defun ediff-previous-meta-item (count) | |
384 "Move to the previous item in Ediff registry or session group buffer. | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
385 Moves in circular fashion. With numeric prefix arg, skip this many items." |
13130 | 386 (interactive "p") |
387 (or count (setq count 1)) | |
20206 | 388 (let (overl) |
389 (while (< 0 count) | |
390 (setq count (1- count)) | |
391 (ediff-previous-meta-item1) | |
392 (setq overl (ediff-get-meta-overlay-at-pos (point))) | |
393 ;; skip invisible ones | |
394 (while (and overl (ediff-overlay-get overl 'invisible)) | |
395 (ediff-previous-meta-item1) | |
396 (setq overl (ediff-get-meta-overlay-at-pos (point))))))) | |
13130 | 397 |
398 (defun ediff-previous-meta-item1 () | |
399 (let (pos) | |
400 (setq pos (ediff-previous-meta-overlay-start (point))) | |
401 ;;; ;; skip deleted | |
402 ;;; (while (ediff-get-session-status | |
403 ;;; (ediff-get-meta-info (current-buffer) pos 'noerror)) | |
404 ;;; (setq pos (ediff-previous-meta-overlay-start pos))) | |
405 | |
406 (if pos (goto-char pos)) | |
407 (if (eq ediff-metajob-name 'ediff-registry) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
408 (if (and (ediff-get-meta-info (current-buffer) pos 'noerror) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
409 (search-forward "*Ediff" nil t)) |
13130 | 410 (skip-chars-backward "a-zA-Z*")) |
411 (if (> (skip-chars-forward "-+?H* \t0-9") 0) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
412 (backward-char 1))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
413 )) |
13130 | 414 |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
415 (defsubst ediff-add-slash-if-directory (dir file) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
416 (if (file-directory-p (concat dir file)) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
417 (file-name-as-directory file) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
418 file)) |
13130 | 419 |
20206 | 420 (defun ediff-toggle-filename-truncation () |
421 "Toggle truncation of long file names in session group buffers. | |
422 Set `ediff-meta-truncate-filenames' variable if you want to change the default | |
423 behavior." | |
424 (interactive) | |
425 (setq ediff-meta-truncate-filenames (not ediff-meta-truncate-filenames)) | |
426 (ediff-update-meta-buffer (current-buffer) 'must-redraw)) | |
427 | |
13130 | 428 |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
429 ;; DIR1, DIR2, DIR3 are directories. DIR3 can be nil. |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
430 ;; 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
|
431 ;; Can be nil. |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
432 ;; REGEXP is a regexp used to filter out files in the directories. |
13130 | 433 ;; If a file is a directory in dir1 but not dir2 (or vice versa), it is not |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
434 ;; included in the intersection. However, a regular file that is a dir in dir3 |
13130 | 435 ;; is included, since dir3 files are supposed to be ancestors for merging. |
436 ;; Returns a list of the form: | |
437 ;; ((dir1 dir2 dir3) (f1 f2 f3) (f1 f2 f3) ...) | |
438 ;; dir3, f3 can be nil if intersecting only 2 directories. | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
439 ;; 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
|
440 ;; 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
|
441 ;; difference list (which represents the differences among the contents of |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
442 ;; directories). The diff list is of the form: |
13130 | 443 ;; ((dir1 dir2 dir3) (file . num) (file . num)...) |
444 ;; where num encodes the set of dirs where the file is found: | |
445 ;; 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
|
446 (defun ediff-intersect-directories (jobname |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
447 diff-var regexp dir1 dir2 |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
448 &optional |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
449 dir3 merge-autostore-dir comparison-func) |
13130 | 450 (setq comparison-func (or comparison-func 'string=)) |
451 (let (lis1 lis2 lis3 common auxdir1 auxdir2 auxdir3 difflist) | |
452 | |
453 (setq auxdir1 (file-name-as-directory dir1) | |
454 lis1 (directory-files auxdir1 nil regexp) | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
455 lis1 (delete "." lis1) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
456 lis1 (delete ".." lis1) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
457 lis1 (mapcar |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
458 (lambda (elt) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
459 (ediff-add-slash-if-directory auxdir1 elt)) |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
460 lis1) |
13130 | 461 auxdir2 (file-name-as-directory dir2) |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
462 lis2 (mapcar |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
463 (lambda (elt) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
464 (ediff-add-slash-if-directory auxdir2 elt)) |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
465 (directory-files auxdir2 nil regexp))) |
13130 | 466 |
467 (if (stringp dir3) | |
468 (setq auxdir3 (file-name-as-directory dir3) | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
469 lis3 (mapcar |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
470 (lambda (elt) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
471 (ediff-add-slash-if-directory auxdir3 elt)) |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
472 (directory-files auxdir3 nil regexp)))) |
13130 | 473 |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
474 (if (ediff-nonempty-string-p merge-autostore-dir) |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
475 (setq merge-autostore-dir |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
476 (file-name-as-directory merge-autostore-dir))) |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
477 (setq common (ediff-intersection lis1 lis2 comparison-func)) |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
478 |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
479 ;; 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
|
480 ;; 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
|
481 ;; 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
|
482 (if (and lis3 (ediff-comparison-metajob3 jobname)) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
483 (setq common (ediff-intersection common lis3 comparison-func))) |
13130 | 484 |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
485 ;; copying is needed because sort sorts via side effects |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
486 (setq common (sort (ediff-copy-list common) 'string-lessp)) |
13130 | 487 |
488 ;; compute difference list | |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
489 (setq difflist (ediff-set-difference |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
490 (ediff-union (ediff-union lis1 lis2 comparison-func) |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
491 lis3 |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
492 comparison-func) |
13130 | 493 common |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
494 comparison-func) |
13130 | 495 difflist (delete "." difflist) |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
496 ;; copying is needed because sort sorts via side effects |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
497 difflist (sort (ediff-copy-list (delete ".." difflist)) |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
498 'string-lessp)) |
13130 | 499 |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
500 (setq difflist (mapcar (lambda (elt) (cons elt 1)) difflist)) |
13130 | 501 |
502 ;; check for files belonging to lis1/2/3 | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
503 (mapcar (lambda (elt) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
504 (if (member (car elt) lis1) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
505 (setcdr elt (* (cdr elt) 2))) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
506 (if (member (car elt) lis2) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
507 (setcdr elt (* (cdr elt) 3))) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
508 (if (member (car elt) lis3) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
509 (setcdr elt (* (cdr elt) 5))) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
510 ) |
13130 | 511 difflist) |
512 (setq difflist (cons (list regexp auxdir1 auxdir2 auxdir3) difflist)) | |
513 | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
514 ;; return the difference list back to the calling function |
13130 | 515 (set diff-var difflist) |
516 | |
517 ;; return result | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
518 (cons (list regexp auxdir1 auxdir2 auxdir3 merge-autostore-dir) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
519 (mapcar |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
520 (lambda (elt) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
521 (list (concat auxdir1 elt) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
522 (concat auxdir2 elt) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
523 (if lis3 |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
524 (progn |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
525 ;; The following is done because: |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
526 ;; In merging with ancestor, we don't intersect |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
527 ;; with lis3. So, it is possible that elt is a |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
528 ;; file in auxdir1/2 but a directory in auxdir3 |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
529 ;; Or elt may not exist in auxdir3 at all. |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
530 ;; In the first case, we add a slash at the end. |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
531 ;; In the second case, we insert nil. |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
532 (setq elt (ediff-add-slash-if-directory auxdir3 elt)) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
533 (if (file-exists-p (concat auxdir3 elt)) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
534 (concat auxdir3 elt)))))) |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
535 common)) |
13130 | 536 )) |
537 | |
20206 | 538 ;; find directory files that are under revision. Include subdirectories, since |
539 ;; we may visit them recursively. DIR1 is the directory to inspect. | |
540 ;; MERGE-AUTOSTORE-DIR is the directory where to auto-store the results of | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
541 ;; merges. Can be nil. |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
542 (defun ediff-get-directory-files-under-revision (jobname |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
543 regexp dir1 |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
544 &optional merge-autostore-dir) |
13130 | 545 (let (lis1 elt common auxdir1) |
546 (setq auxdir1 (file-name-as-directory dir1) | |
547 lis1 (directory-files auxdir1 nil regexp)) | |
548 | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
549 (if (ediff-nonempty-string-p merge-autostore-dir) |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
550 (setq merge-autostore-dir |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
551 (file-name-as-directory merge-autostore-dir))) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
552 |
13130 | 553 (while lis1 |
554 (setq elt (car lis1) | |
555 lis1 (cdr lis1)) | |
556 ;; take files under revision control | |
557 (cond ((file-directory-p (concat auxdir1 elt)) | |
20206 | 558 (setq common |
559 (cons (ediff-add-slash-if-directory auxdir1 elt) common))) | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
560 ((and (featurep 'vc-hooks) (vc-backend (concat auxdir1 elt))) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
561 (setq common (cons elt common))) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
562 ;; The following two are needed only if vc-hooks isn't loaded. |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
563 ;; They won't recognize CVS files. |
13130 | 564 ((file-exists-p (concat auxdir1 elt ",v")) |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
565 (setq common (cons elt common))) |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
566 ((file-exists-p (concat auxdir1 "RCS/" elt ",v")) |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
567 (setq common (cons elt common))) |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
568 ) ; cond |
13130 | 569 ) ; while |
570 | |
20206 | 571 (setq common (delete "./" common) |
572 common (delete "../" common) | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
573 common (delete "RCS" common) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
574 common (delete "CVS" common) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
575 ) |
13130 | 576 |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
577 ;; copying is needed because sort sorts via side effects |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
578 (setq common (sort (ediff-copy-list common) 'string-lessp)) |
13130 | 579 |
580 ;; return result | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
581 (cons (list regexp auxdir1 nil nil merge-autostore-dir) |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
582 (mapcar (lambda (elt) (list (concat auxdir1 elt) nil nil)) |
13130 | 583 common)) |
584 )) | |
585 | |
586 | |
587 ;; If file groups selected by patterns will ever be implemented, this | |
588 ;; comparison function might become useful. | |
589 ;;;; uses external variables PAT1 PAT2 to compare str1/2 | |
590 ;;;; patterns must be of the form ???*???? where ??? are strings of chars | |
591 ;;;; containing no *. | |
592 ;;(defun ediff-pattern= (str1 str2) | |
593 ;; (let (pos11 pos12 pos21 pos22 len1 len2) | |
594 ;; (setq pos11 0 | |
595 ;; len (length epat1) | |
596 ;; pos12 len) | |
597 ;; (while (and (< pos11 len) (not (= (aref epat1 pos11) ?*))) | |
598 ;; (setq pos11 (1+ pos11))) | |
599 ;; (while (and (> pos12 0) (not (= (aref epat1 (1- pos12)) ?*))) | |
600 ;; (setq pos12 (1- pos12))) | |
601 ;; | |
602 ;; (setq pos21 0 | |
603 ;; len (length epat2) | |
604 ;; pos22 len) | |
605 ;; (while (and (< pos21 len) (not (= (aref epat2 pos21) ?*))) | |
606 ;; (setq pos21 (1+ pos21))) | |
607 ;; (while (and (> pos22 0) (not (= (aref epat2 (1- pos22)) ?*))) | |
608 ;; (setq pos22 (1- pos22))) | |
609 ;; | |
610 ;; (if (and (> (length str1) pos12) (>= pos12 pos11) (> pos11 -1) | |
611 ;; (> (length str2) pos22) (>= pos22 pos21) (> pos21 -1)) | |
612 ;; (string= (substring str1 pos11 pos12) | |
613 ;; (substring str2 pos21 pos22))) | |
614 ;; )) | |
615 | |
616 | |
617 ;; Prepare meta-buffer in accordance with the argument-function and | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
618 ;; redraw-function. Must return the created meta-buffer. |
13130 | 619 (defun ediff-prepare-meta-buffer (action-func meta-list |
620 meta-buffer-name redraw-function | |
621 jobname &optional startup-hooks) | |
622 (let* ((meta-buffer-name | |
623 (ediff-unique-buffer-name meta-buffer-name "*")) | |
624 (meta-buffer (get-buffer-create meta-buffer-name))) | |
19047 | 625 (ediff-with-current-buffer meta-buffer |
13130 | 626 |
627 ;; comes first | |
628 (ediff-meta-mode) | |
629 | |
630 (setq ediff-meta-action-function action-func | |
631 ediff-meta-redraw-function redraw-function | |
632 ediff-metajob-name jobname | |
633 ediff-meta-buffer meta-buffer) | |
634 | |
635 ;; comes after ediff-meta-action-function is set | |
636 (ediff-setup-meta-map) | |
637 | |
638 (if (eq ediff-metajob-name 'ediff-registry) | |
639 (progn | |
640 (setq ediff-registry-buffer meta-buffer | |
641 ediff-meta-list meta-list) | |
642 ;; this func is used only from registry buffer, not from other | |
643 ;; meta-buffs. | |
644 (define-key | |
645 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
|
646 ;; Initialize the meta list -- don't do this for registry. |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
647 ;; |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
648 ;; We prepend '(nil nil) to all elts of meta-list, except the first. |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
649 ;; The first nil will later be replaced by the session buffer. The |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
650 ;; second is reserved for session status. |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
651 ;; |
13130 | 652 ;; (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
|
653 ;; Also, session objects A/B/C are turned into lists of the form |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
654 ;; (obj eq-indicator). Eq-indicator is either nil or =. Initialized to |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
655 ;; nil. If later it is discovered that this file is = to some other |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
656 ;; 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
|
657 ;; For now, the eq-indicator is used only for 2 and 3-file jobs. |
13130 | 658 (setq ediff-meta-list |
659 (cons (cons meta-buffer (car meta-list)) | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
660 (mapcar |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
661 (lambda (elt) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
662 (cons nil |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
663 (cons nil |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
664 ;; convert each obj to (obj nil), |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
665 ;; where nil is the initial value |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
666 ;; for eq-indicator -- see above |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
667 (mapcar (lambda (obj) (list obj nil)) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
668 elt)))) |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
669 (cdr meta-list))))) |
13130 | 670 |
671 (or (eq meta-buffer ediff-registry-buffer) | |
672 (setq ediff-session-registry | |
673 (cons meta-buffer ediff-session-registry))) | |
674 | |
675 ;; redraw-function uses ediff-meta-list | |
676 (funcall redraw-function ediff-meta-list) | |
677 | |
678 ;; set read-only/non-modified | |
679 (setq buffer-read-only t) | |
680 (set-buffer-modified-p nil) | |
681 | |
682 (run-hooks 'startup-hooks) | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
683 |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
684 ;; Arrange to show directory contents differences |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
685 ;; Must be after run startup-hooks, since ediff-dir-difference-list is |
13130 | 686 ;; set inside these hooks |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
687 (if (eq action-func 'ediff-filegroup-action) |
13130 | 688 (progn |
689 ;; put meta buffer in (car ediff-dir-difference-list) | |
690 (setq ediff-dir-difference-list | |
691 (cons (cons meta-buffer (car ediff-dir-difference-list)) | |
692 (cdr ediff-dir-difference-list))) | |
693 | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
694 (or (ediff-one-filegroup-metajob jobname) |
13130 | 695 (ediff-draw-dir-diffs ediff-dir-difference-list)) |
22286 | 696 (define-key |
697 ediff-meta-buffer-map "h" 'ediff-mark-for-hiding-at-pos) | |
698 (define-key ediff-meta-buffer-map "x" 'ediff-hide-marked-sessions) | |
699 (define-key | |
700 ediff-meta-buffer-map "m" 'ediff-mark-for-operation-at-pos) | |
701 (define-key ediff-meta-buffer-map "u" nil) | |
13130 | 702 (define-key |
22286 | 703 ediff-meta-buffer-map "um" 'ediff-unmark-all-for-operation) |
704 (define-key | |
705 ediff-meta-buffer-map "uh" 'ediff-unmark-all-for-hiding) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
706 (cond ((ediff-collect-diffs-metajob jobname) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
707 (define-key |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
708 ediff-meta-buffer-map "P" 'ediff-collect-custom-diffs)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
709 ((ediff-patch-metajob jobname) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
710 (define-key |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
711 ediff-meta-buffer-map "P" 'ediff-meta-show-patch))) |
22286 | 712 (define-key ediff-meta-buffer-map "^" 'ediff-up-meta-hierarchy) |
13130 | 713 (define-key ediff-meta-buffer-map "D" 'ediff-show-dir-diffs))) |
714 | |
715 (if (eq ediff-metajob-name 'ediff-registry) | |
716 (run-hooks 'ediff-registry-setup-hook) | |
33019
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
29165
diff
changeset
|
717 (run-hooks 'ediff-after-session-group-setup-hook)) |
13130 | 718 ) ; eval in meta-buffer |
719 meta-buffer)) | |
720 | |
20206 | 721 ;; Insert the activity marker for session SESSION in the meta buffer at point |
722 ;; The activity marker is either SPC (untouched session), or + (active session, | |
723 ;; i.e., ediff is currently run in it), or - (finished session, i.e., we've ran | |
724 ;; ediff in it and then exited) | |
725 (defun ediff-insert-session-activity-marker-in-meta-buffer (session) | |
726 (insert | |
727 (cond ((ediff-get-session-activity-marker session)) | |
728 ;; virgin session | |
729 (t " ")))) | |
730 | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
731 ;; Insert session status at point. Status is either ?H (marked for hiding), or |
20206 | 732 ;; ?I (hidden or invalid), or ?* (meaning marked for an operation; currently, |
733 ;; such op can only be checking for equality)), or SPC (meaning neither marked | |
734 ;; nor invalid) | |
735 (defun ediff-insert-session-status-in-meta-buffer (session) | |
736 (insert | |
737 (cond ((ediff-get-session-status session)) ; session has status: ?H, ?I, ?* | |
738 ;; normal session, no marks or hidings | |
739 (t " ")))) | |
740 | |
741 ;; If NEW-MARKER is non-nil, use it to substitute the current activity marker | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
742 ;; in the meta buffer. If nil, use SPC |
20206 | 743 (defun ediff-replace-session-activity-marker-in-meta-buffer (point new-marker) |
744 (let* ((overl (ediff-get-meta-overlay-at-pos point)) | |
745 (session-info (ediff-overlay-get overl 'ediff-meta-info)) | |
746 (activity-marker (ediff-get-session-activity-marker session-info)) | |
747 buffer-read-only) | |
748 (or new-marker activity-marker (setq new-marker ?\ )) | |
749 (goto-char (ediff-overlay-start overl)) | |
750 (if (eq (char-after (point)) new-marker) | |
751 () ; if marker shown in buffer is the same as new-marker, do nothing | |
752 (insert new-marker) | |
753 (delete-char 1) | |
754 (set-buffer-modified-p nil)))) | |
755 | |
756 ;; If NEW-STATUS is non-nil, use it to substitute the current status marker in | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
757 ;; the meta buffer. If nil, use SPC |
20206 | 758 (defun ediff-replace-session-status-in-meta-buffer (point new-status) |
759 (let* ((overl (ediff-get-meta-overlay-at-pos point)) | |
760 (session-info (ediff-overlay-get overl 'ediff-meta-info)) | |
761 (status (ediff-get-session-status session-info)) | |
762 buffer-read-only) | |
763 (setq new-status (or new-status status ?\ )) | |
764 (goto-char (ediff-overlay-start overl)) | |
765 (forward-char 1) ; status is the second char in session record | |
766 (if (eq (char-after (point)) new-status) | |
767 () ; if marker shown in buffer is the same as new-marker, do nothing | |
768 (insert new-status) | |
769 (delete-char 1) | |
770 (set-buffer-modified-p nil)))) | |
771 | |
772 ;; insert all file info in meta buffer for a given session | |
773 (defun ediff-insert-session-info-in-meta-buffer (session-info sessionNum) | |
774 (let ((f1 (ediff-get-session-objA session-info)) | |
775 (f2 (ediff-get-session-objB session-info)) | |
776 (f3 (ediff-get-session-objC session-info)) | |
777 (pt (point)) | |
778 (hidden (eq (ediff-get-session-status session-info) ?I))) | |
779 ;; insert activity marker, i.e., SPC, - or + | |
780 (ediff-insert-session-activity-marker-in-meta-buffer session-info) | |
781 ;; insert session status, i.e., *, H | |
782 (ediff-insert-session-status-in-meta-buffer session-info) | |
783 (insert " Session " (int-to-string sessionNum) ":\n") | |
784 (ediff-meta-insert-file-info1 f1) | |
785 (ediff-meta-insert-file-info1 f2) | |
786 (ediff-meta-insert-file-info1 f3) | |
787 (ediff-set-meta-overlay pt (point) session-info sessionNum hidden))) | |
788 | |
13130 | 789 |
790 ;; this is a setup function for ediff-directories | |
791 ;; must return meta-buffer | |
792 (defun ediff-redraw-directory-group-buffer (meta-list) | |
793 ;; extract directories | |
794 (let ((meta-buf (ediff-get-group-buffer meta-list)) | |
795 (empty t) | |
796 (sessionNum 0) | |
20206 | 797 regexp elt merge-autostore-dir |
13130 | 798 point tmp-list buffer-read-only) |
19047 | 799 (ediff-with-current-buffer meta-buf |
13130 | 800 (setq point (point)) |
801 (erase-buffer) | |
20206 | 802 ;; delete phony overlays that used to represent sessions before the buff |
803 ;; was redrawn | |
804 (if ediff-emacs-p | |
805 (mapcar 'delete-overlay (overlays-in 1 1)) | |
806 (map-extents 'delete-extent)) | |
807 | |
13130 | 808 (insert (format ediff-meta-buffer-message |
809 (ediff-abbrev-jobname ediff-metajob-name))) | |
810 | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
811 (setq regexp (ediff-get-group-regexp meta-list) |
20206 | 812 merge-autostore-dir |
813 (ediff-get-group-merge-autostore-dir meta-list)) | |
13130 | 814 |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
815 (cond ((ediff-collect-diffs-metajob) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
816 (insert |
20206 | 817 " P:\tcollect custom diffs of all marked sessions\n")) |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
818 ((ediff-patch-metajob) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
819 (insert |
20206 | 820 " P:\tshow patch appropriately for the context (session or group)\n"))) |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
821 (insert |
22286 | 822 " ^:\tshow parent session group\n") |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
823 (or (ediff-one-filegroup-metajob) |
13130 | 824 (insert |
20206 | 825 " D:\tshow differences among directories\n" |
22286 | 826 " ==:\tfor each session, show which files are identical\n" |
827 " =h:\tlike ==, but also marks those sessions for hiding\n" | |
828 " =m:\tlike ==, but also marks those sessions for operation\n\n")) | |
13130 | 829 |
20206 | 830 (insert "\n") |
13130 | 831 (if (and (stringp regexp) (> (length regexp) 0)) |
18054 | 832 (insert |
20206 | 833 (format "*** Filter-through regular expression: %s\n" regexp))) |
834 (ediff-insert-dirs-in-meta-buffer meta-list) | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
835 (if (and ediff-autostore-merges (ediff-merge-metajob) |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
836 (ediff-nonempty-string-p merge-autostore-dir)) |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
837 (insert (format |
20206 | 838 "\nMerge results are automatically stored in:\n\t%s\n" |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
839 merge-autostore-dir))) |
13130 | 840 (insert "\n |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
841 Size Last modified Name |
20206 | 842 ---------------------------------------------- |
13130 | 843 |
844 ") | |
845 | |
846 ;; discard info on directories and regexp | |
847 (setq meta-list (cdr meta-list) | |
848 tmp-list meta-list) | |
849 (while (and tmp-list empty) | |
850 (if (and (car tmp-list) | |
851 (not (eq (ediff-get-session-status (car tmp-list)) ?I))) | |
852 (setq empty nil)) | |
853 (setq tmp-list (cdr tmp-list))) | |
854 | |
855 (if empty | |
856 (insert | |
857 " ****** ****** This session group has no members\n")) | |
858 | |
859 ;; now organize file names like this: | |
860 ;; use-mark sizeA dateA sizeB dateB filename | |
861 ;; make sure directories are displayed with a trailing slash. | |
862 (while meta-list | |
863 (setq elt (car meta-list) | |
864 meta-list (cdr meta-list) | |
865 sessionNum (1+ sessionNum)) | |
866 (if (eq (ediff-get-session-status elt) ?I) | |
867 () | |
20206 | 868 (ediff-insert-session-info-in-meta-buffer elt sessionNum))) |
13130 | 869 (set-buffer-modified-p nil) |
870 (goto-char point) | |
871 meta-buf))) | |
872 | |
20206 | 873 (defun ediff-update-markers-in-dir-meta-buffer (meta-list) |
874 (let ((meta-buf (ediff-get-group-buffer meta-list)) | |
875 session-info point overl buffer-read-only) | |
876 (ediff-with-current-buffer meta-buf | |
877 (setq point (point)) | |
878 (goto-char (point-min)) | |
879 (ediff-next-meta-item1) | |
880 (while (not (bobp)) | |
881 (setq session-info (ediff-get-meta-info meta-buf (point) 'no-error) | |
882 overl (ediff-get-meta-overlay-at-pos (point))) | |
883 (if session-info | |
884 (progn | |
885 (cond ((eq (ediff-get-session-status session-info) ?I) | |
886 ;; Do hiding | |
887 (if overl (ediff-overlay-put overl 'invisible t))) | |
888 ((and (eq (ediff-get-session-status session-info) ?H) | |
889 overl (ediff-overlay-get overl 'invisible)) | |
890 ;; Do unhiding | |
891 (ediff-overlay-put overl 'invisible nil)) | |
892 (t (ediff-replace-session-activity-marker-in-meta-buffer | |
893 (point) | |
894 (ediff-get-session-activity-marker session-info)) | |
895 (ediff-replace-session-status-in-meta-buffer | |
896 (point) | |
897 (ediff-get-session-status session-info)))))) | |
898 (ediff-next-meta-item1) ; advance to the next item | |
899 ) ; end while | |
900 (set-buffer-modified-p nil) | |
901 (goto-char point)) | |
902 meta-buf)) | |
903 | |
904 (defun ediff-update-session-marker-in-dir-meta-buffer (session-num) | |
905 (let (buffer-meta-overlays session-info overl buffer-read-only) | |
906 (setq overl | |
907 (if ediff-xemacs-p | |
908 (map-extents | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
909 (lambda (ext maparg) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
910 (if (and |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
911 (ediff-overlay-get ext 'ediff-meta-info) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
912 (eq (ediff-overlay-get ext 'ediff-meta-session-number) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
913 session-num)) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
914 ext))) |
20206 | 915 ;; Emacs doesn't have map-extents, so try harder |
916 ;; Splice overlay lists to get all buffer overlays | |
917 (setq buffer-meta-overlays (overlay-lists) | |
918 buffer-meta-overlays (append (car buffer-meta-overlays) | |
919 (cdr buffer-meta-overlays))) | |
920 (car | |
921 (delq nil | |
922 (mapcar | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
923 (lambda (overl) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
924 (if (and |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
925 (ediff-overlay-get overl 'ediff-meta-info) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
926 (eq (ediff-overlay-get |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
927 overl 'ediff-meta-session-number) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
928 session-num)) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
929 overl)) |
20206 | 930 buffer-meta-overlays))))) |
931 (or overl | |
932 (error | |
933 "Bug in ediff-update-session-marker-in-dir-meta-buffer: no overlay with given number %S" | |
934 session-num)) | |
935 (setq session-info (ediff-overlay-get overl 'ediff-meta-info)) | |
936 (goto-char (ediff-overlay-start overl)) | |
937 (ediff-replace-session-activity-marker-in-meta-buffer | |
938 (point) | |
939 (ediff-get-session-activity-marker session-info)) | |
940 (ediff-replace-session-status-in-meta-buffer | |
941 (point) | |
942 (ediff-get-session-status session-info))) | |
943 (ediff-next-meta-item1)) | |
944 | |
945 | |
946 | |
13130 | 947 ;; Check if this is a problematic session. |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
948 ;; Return nil if not. Otherwise, return symbol representing the problem |
13130 | 949 ;; 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
|
950 ;; 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
|
951 ;; suitable ancestor file in the ancestor directory |
13130 | 952 (defun ediff-problematic-session-p (session) |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
953 (let ((f1 (ediff-get-session-objA-name session)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
954 (f2 (ediff-get-session-objB-name session)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
955 (f3 (ediff-get-session-objC-name session))) |
13130 | 956 (cond ((and (stringp f1) (not (file-directory-p f1)) |
957 (stringp f2) (not (file-directory-p f2)) | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
958 ;; either invalid file name or a directory |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
959 (or (not (stringp f3)) (file-directory-p f3)) |
13130 | 960 (ediff-ancestor-metajob)) |
961 ;; more may be added later | |
962 'ancestor-is-dir) | |
963 (t nil)))) | |
964 | |
20206 | 965 (defun ediff-meta-insert-file-info1 (fileinfo) |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
966 (let ((fname (car fileinfo)) |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
967 (feq (ediff-get-file-eqstatus fileinfo)) |
20206 | 968 (max-filename-width (if ediff-meta-truncate-filenames |
969 (- (window-width) 41) | |
970 500)) | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
971 file-modtime file-size) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
972 (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
|
973 ((not (ediff-file-remote-p fname)) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
974 (if (file-exists-p fname) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
975 ;; set real size and modtime |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
976 (setq file-size (ediff-file-size fname) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
977 file-modtime (ediff-file-modtime fname)) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
978 (setq file-size -2))) ; file doesn't exist |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
979 ( t (setq file-size -1))) ; remote file |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
980 (if (stringp fname) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
981 (insert |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
982 (format |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
983 "%s %s %-20s %s\n" |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
984 (if feq "=" " ") ; equality indicator |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
985 (format "%10s" (cond ((= file-size -1) "--") |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
986 ((< file-size -1) "--") |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
987 (t file-size))) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
988 (cond ((= file-size -1) "*remote file*") |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
989 ((< file-size -1) "*file doesn't exist*") |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
990 (t (ediff-format-date (decode-time file-modtime)))) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
991 |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
992 ;; 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
|
993 ;; abbreviate the file name, if file exists |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
994 (if (and (not (stringp fname)) (< file-size -1)) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
995 "-------" ; file doesn't exist |
20206 | 996 (ediff-truncate-string-left |
997 (ediff-abbreviate-file-name fname) | |
998 max-filename-width))))))) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
999 |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1000 (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
|
1001 (5 . "May") (6 . "Jun") (7 . "Jul") (8 . "Aug") |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1002 (9 . "Sep") (10 . "Oct") (11 . "Nov") (12 . "Dec")) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1003 "Months' associative array.") |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1004 |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1005 ;; returns 2char string |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1006 (defsubst ediff-fill-leading-zero (num) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1007 (if (< num 10) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1008 (format "0%d" num) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1009 (number-to-string num))) |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1010 |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1011 ;; TIME is like the output of decode-time |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1012 (defun ediff-format-date (time) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1013 (format "%s %2d %4d %s:%s:%s" |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1014 (cdr (assoc (nth 4 time) ediff-months)) ; month |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1015 (nth 3 time) ; day |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1016 (nth 5 time) ; year |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1017 (ediff-fill-leading-zero (nth 2 time)) ; hour |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1018 (ediff-fill-leading-zero (nth 1 time)) ; min |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1019 (ediff-fill-leading-zero (nth 0 time)) ; sec |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1020 )) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1021 |
20206 | 1022 ;; Draw the directories |
1023 (defun ediff-insert-dirs-in-meta-buffer (meta-list) | |
1024 (let* ((dir1 (ediff-abbreviate-file-name (ediff-get-group-objA meta-list))) | |
1025 (dir2 (ediff-get-group-objB meta-list)) | |
1026 (dir2 (if (stringp dir2) (ediff-abbreviate-file-name dir2))) | |
1027 (dir3 (ediff-get-group-objC meta-list)) | |
1028 (dir3 (if (stringp dir3) (ediff-abbreviate-file-name dir3)))) | |
1029 (insert "*** Directory A: " dir1 "\n") | |
1030 (if dir2 (insert "*** Directory B: " dir2 "\n")) | |
1031 (if dir3 (insert "*** Directory C: " dir3 "\n")) | |
1032 (insert "\n"))) | |
1033 | |
13130 | 1034 (defun ediff-draw-dir-diffs (diff-list) |
1035 (if (null diff-list) (error "Lost difference info on these directories")) | |
1036 (let* ((buf-name (ediff-unique-buffer-name | |
1037 "*Ediff File Group Differences" "*")) | |
1038 (regexp (ediff-get-group-regexp diff-list)) | |
1039 (dir1 (ediff-abbreviate-file-name (ediff-get-group-objA diff-list))) | |
1040 (dir2 (ediff-abbreviate-file-name (ediff-get-group-objB diff-list))) | |
1041 (dir3 (ediff-get-group-objC diff-list)) | |
1042 (dir3 (if (stringp dir3) (ediff-abbreviate-file-name dir3))) | |
1043 (meta-buf (ediff-get-group-buffer diff-list)) | |
1044 (underline (make-string 26 ?-)) | |
1045 file code | |
1046 buffer-read-only) | |
1047 ;; skip the directory part | |
1048 (setq diff-list (cdr diff-list)) | |
1049 (setq ediff-dir-diffs-buffer (get-buffer-create buf-name)) | |
19047 | 1050 (ediff-with-current-buffer ediff-dir-diffs-buffer |
13130 | 1051 (use-local-map ediff-dir-diffs-buffer-map) |
1052 (erase-buffer) | |
1053 (setq ediff-meta-buffer meta-buf) | |
1054 (insert "\t\t*** Directory Differences ***\n") | |
1055 (insert " | |
1056 Useful commands: | |
1057 `q': hide this buffer | |
20206 | 1058 n,SPC: next line |
1059 p,DEL: previous line\n\n") | |
13130 | 1060 |
1061 (if (and (stringp regexp) (> (length regexp) 0)) | |
18054 | 1062 (insert |
1063 (format "\n*** Filter-through regular expression: %s\n" regexp))) | |
13130 | 1064 (insert "\n") |
1065 (insert (format "\n%-27s%-26s" | |
1066 (ediff-truncate-string-left | |
1067 (ediff-abbreviate-file-name | |
1068 (file-name-as-directory dir1)) | |
1069 25) | |
1070 (ediff-truncate-string-left | |
1071 (ediff-abbreviate-file-name | |
1072 (file-name-as-directory dir2)) | |
1073 25))) | |
1074 (if dir3 | |
1075 (insert (format " %-25s\n" | |
1076 (ediff-truncate-string-left | |
1077 (ediff-abbreviate-file-name | |
1078 (file-name-as-directory dir3)) | |
1079 25))) | |
1080 (insert "\n")) | |
1081 (insert (format "%s%s" underline underline)) | |
1082 (if (stringp dir3) | |
1083 (insert (format "%s\n\n" underline)) | |
1084 (insert "\n\n")) | |
1085 | |
1086 (if (null diff-list) | |
1087 (insert "\n\t*** No differences ***\n")) | |
1088 | |
1089 (while diff-list | |
1090 (setq file (car (car diff-list)) | |
1091 code (cdr (car diff-list)) | |
1092 diff-list (cdr diff-list)) | |
1093 (if (= (mod code 2) 0) ; dir1 | |
1094 (insert (format "%-27s" | |
1095 (ediff-truncate-string-left | |
1096 (ediff-abbreviate-file-name | |
1097 (if (file-directory-p (concat dir1 file)) | |
1098 (file-name-as-directory file) | |
1099 file)) | |
1100 24))) | |
1101 (insert (format "%-27s" "---"))) | |
1102 (if (= (mod code 3) 0) ; dir2 | |
1103 (insert (format "%-26s" | |
1104 (ediff-truncate-string-left | |
1105 (ediff-abbreviate-file-name | |
1106 (if (file-directory-p (concat dir2 file)) | |
1107 (file-name-as-directory file) | |
1108 file)) | |
1109 24))) | |
1110 (insert (format "%-26s" "---"))) | |
1111 (if (stringp dir3) | |
1112 (if (= (mod code 5) 0) ; dir3 | |
1113 (insert (format " %-25s" | |
1114 (ediff-truncate-string-left | |
1115 (ediff-abbreviate-file-name | |
1116 (if (file-directory-p (concat dir3 file)) | |
1117 (file-name-as-directory file) | |
1118 file)) | |
1119 24))) | |
1120 (insert (format " %-25s" "---")))) | |
1121 (insert "\n")) | |
1122 (setq buffer-read-only t) | |
1123 (set-buffer-modified-p nil)) ; eval in diff buffer | |
1124 )) | |
1125 | |
1126 (defun ediff-bury-dir-diffs-buffer () | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1127 "Bury the directory difference buffer. Display the meta buffer instead." |
13130 | 1128 (interactive) |
1129 (let ((buf ediff-meta-buffer) | |
1130 wind) | |
1131 (bury-buffer) | |
1132 (if (setq wind (ediff-get-visible-buffer-window buf)) | |
1133 (select-window wind) | |
1134 (set-window-buffer (selected-window) buf)))) | |
1135 | |
1136 ;; executes in dir session group buffer | |
1137 ;; show buffer differences | |
1138 (defun ediff-show-dir-diffs () | |
1139 "Display differences among the directories involved in session group." | |
1140 (interactive) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1141 (if (ediff-one-filegroup-metajob) |
13130 | 1142 (error "This command is inapplicable in the present context")) |
1143 (or (ediff-buffer-live-p ediff-dir-diffs-buffer) | |
1144 (ediff-draw-dir-diffs ediff-dir-difference-list)) | |
1145 (let ((buf ediff-dir-diffs-buffer)) | |
1146 (other-window 1) | |
1147 (set-window-buffer (selected-window) buf) | |
1148 (goto-char (point-min)))) | |
1149 | |
1150 (defun ediff-up-meta-hierarchy () | |
1151 "Go to the parent session group buffer." | |
1152 (interactive) | |
1153 (if (ediff-buffer-live-p ediff-parent-meta-buffer) | |
20206 | 1154 (ediff-show-meta-buffer |
1155 ediff-parent-meta-buffer ediff-meta-session-number) | |
13130 | 1156 (error "This session group has no parent"))) |
1157 | |
1158 | |
1159 ;; argument is ignored | |
1160 (defun ediff-redraw-registry-buffer (&optional ignore) | |
19047 | 1161 (ediff-with-current-buffer ediff-registry-buffer |
13130 | 1162 (let ((point (point)) |
1163 elt bufAname bufBname bufCname cur-diff total-diffs pt | |
1164 job-name meta-list registry-list buffer-read-only) | |
1165 (erase-buffer) | |
20206 | 1166 ;; delete phony overlays that used to represent sessions before the buff |
1167 ;; was redrawn | |
1168 (if ediff-emacs-p | |
1169 (mapcar 'delete-overlay (overlays-in 1 1)) | |
1170 (map-extents 'delete-extent)) | |
1171 | |
13130 | 1172 (insert "This is a registry of all active Ediff sessions. |
1173 | |
1174 Useful commands: | |
1175 button2, `v', RET over a session record: switch to that session | |
20206 | 1176 M over a session record: display the associated session group |
1177 R in any Ediff session: display session registry | |
1178 n,SPC: next session | |
1179 p,DEL: previous session | |
1180 E: browse Ediff on-line manual | |
1181 q: bury registry | |
13130 | 1182 |
1183 | |
1184 \t\tActive Ediff Sessions: | |
1185 \t\t---------------------- | |
1186 | |
1187 ") | |
1188 ;; purge registry list from dead buffers | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1189 (mapcar (lambda (elt) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1190 (if (not (ediff-buffer-live-p elt)) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1191 (setq ediff-session-registry |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1192 (delq elt ediff-session-registry)))) |
13130 | 1193 ediff-session-registry) |
1194 | |
1195 (if (null ediff-session-registry) | |
1196 (insert " ******* No active Ediff sessions *******\n")) | |
1197 | |
1198 (setq registry-list ediff-session-registry) | |
1199 (while registry-list | |
1200 (setq elt (car registry-list) | |
1201 registry-list (cdr registry-list)) | |
1202 | |
1203 (if (ediff-buffer-live-p elt) | |
19047 | 1204 (if (ediff-with-current-buffer elt |
13130 | 1205 (setq job-name ediff-metajob-name |
1206 meta-list ediff-meta-list) | |
1207 (and ediff-metajob-name | |
1208 (not (eq ediff-metajob-name 'ediff-registry)))) | |
1209 (progn | |
1210 (setq pt (point)) | |
1211 (insert (format " *group*\t%s: %s\n" | |
1212 (buffer-name elt) | |
1213 (ediff-abbrev-jobname job-name))) | |
1214 (insert (format "\t\t %s %s %s\n" | |
1215 (ediff-abbreviate-file-name | |
1216 (ediff-get-group-objA meta-list)) | |
1217 (ediff-abbreviate-file-name | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1218 (if (stringp |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1219 (ediff-get-group-objB meta-list)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1220 (ediff-get-group-objB meta-list) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1221 "")) |
13130 | 1222 (ediff-abbreviate-file-name |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1223 (if (stringp |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1224 (ediff-get-group-objC meta-list)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1225 (ediff-get-group-objC meta-list) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1226 "")))) |
13130 | 1227 (ediff-set-meta-overlay pt (point) elt)) |
1228 (progn | |
19047 | 1229 (ediff-with-current-buffer elt |
13130 | 1230 (setq bufAname (if (ediff-buffer-live-p ediff-buffer-A) |
1231 (buffer-name ediff-buffer-A) | |
1232 "!!!killed buffer!!!") | |
1233 bufBname (if (ediff-buffer-live-p ediff-buffer-B) | |
1234 (buffer-name ediff-buffer-B) | |
1235 "!!!killed buffer!!!") | |
1236 bufCname (cond ((not (ediff-3way-job)) | |
1237 "") | |
1238 ((ediff-buffer-live-p ediff-buffer-C) | |
1239 (buffer-name ediff-buffer-C)) | |
1240 (t "!!!killed buffer!!!"))) | |
1241 (setq total-diffs (format "%-4d" ediff-number-of-differences) | |
1242 cur-diff | |
1243 (cond ((= ediff-current-difference -1) " _") | |
1244 ((= ediff-current-difference | |
1245 ediff-number-of-differences) | |
1246 " $") | |
1247 (t (format | |
1248 "%4d" (1+ ediff-current-difference)))) | |
1249 job-name ediff-job-name)) | |
1250 ;; back in the meta buf | |
1251 (setq pt (point)) | |
1252 (insert cur-diff "/" total-diffs "\t" | |
1253 (buffer-name elt) | |
1254 (format ": %s" (ediff-abbrev-jobname job-name))) | |
1255 (insert | |
1256 "\n\t\t " bufAname " " bufBname " " bufCname "\n") | |
1257 (ediff-set-meta-overlay pt (point) elt)))) | |
1258 ) ; while | |
1259 (set-buffer-modified-p nil) | |
1260 (goto-char point) | |
1261 ))) | |
1262 | |
20206 | 1263 ;; Sets overlay around a meta record with 'ediff-meta-info property PROP |
1264 ;; If optional SESSION-NUMBER, make it a property of the overlay, | |
1265 ;; ediff-meta-session-number | |
1266 (defun ediff-set-meta-overlay (b e prop &optional session-number hidden) | |
13130 | 1267 (let (overl) |
1268 (setq overl (ediff-make-overlay b e)) | |
1269 (if ediff-emacs-p | |
1270 (ediff-overlay-put overl 'mouse-face 'highlight) | |
1271 (ediff-overlay-put overl 'highlight t)) | |
20206 | 1272 (ediff-overlay-put overl 'ediff-meta-info prop) |
1273 (ediff-overlay-put overl 'invisible hidden) | |
1274 (if (numberp session-number) | |
1275 (ediff-overlay-put overl 'ediff-meta-session-number session-number)))) | |
13130 | 1276 |
22286 | 1277 (defun ediff-mark-for-hiding-at-pos (unmark) |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1278 "Mark session for hiding. With prefix arg, unmark." |
13130 | 1279 (interactive "P") |
1280 (let* ((pos (ediff-event-point last-command-event)) | |
1281 (meta-buf (ediff-event-buffer last-command-event)) | |
1282 ;; ediff-get-meta-info gives error if meta-buf or pos are invalid | |
1283 (info (ediff-get-meta-info meta-buf pos)) | |
20206 | 1284 (session-number (ediff-get-session-number-at-pos pos))) |
22286 | 1285 (ediff-mark-session-for-hiding info unmark) |
1286 (ediff-next-meta-item 1) | |
1287 (save-excursion | |
1288 (ediff-update-meta-buffer meta-buf nil session-number)) | |
13130 | 1289 )) |
1290 | |
22286 | 1291 ;; Returns whether session was marked or unmarked |
1292 (defun ediff-mark-session-for-hiding (info unmark) | |
1293 (let ((session-buf (ediff-get-session-buffer info)) | |
1294 ignore) | |
1295 (cond ((eq unmark 'mark) (setq unmark nil)) | |
1296 ((eq (ediff-get-session-status info) ?H) (setq unmark t)) | |
1297 (unmark ; says unmark, but the marker is different from H | |
1298 (setq ignore t))) | |
1299 (cond (ignore) | |
1300 (unmark (ediff-set-session-status info nil)) | |
1301 ;;; (if (ediff-buffer-live-p session-buf) | |
1302 ;;; (error "Can't hide active session, %s" (buffer-name session-buf))) | |
1303 (t (ediff-set-session-status info ?H)))) | |
1304 unmark) | |
1305 | |
1306 | |
1307 (defun ediff-mark-for-operation-at-pos (unmark) | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1308 "Mark session for a group operation. With prefix arg, unmark." |
13130 | 1309 (interactive "P") |
1310 (let* ((pos (ediff-event-point last-command-event)) | |
1311 (meta-buf (ediff-event-buffer last-command-event)) | |
1312 ;; ediff-get-meta-info gives error if meta-buf or pos are invalid | |
20206 | 1313 (info (ediff-get-meta-info meta-buf pos)) |
1314 (session-number (ediff-get-session-number-at-pos pos))) | |
22286 | 1315 (ediff-mark-session-for-operation info unmark) |
1316 (ediff-next-meta-item 1) | |
1317 (save-excursion | |
1318 (ediff-update-meta-buffer meta-buf nil session-number)) | |
13130 | 1319 )) |
1320 | |
22286 | 1321 |
1322 ;; returns whether session was unmarked. | |
1323 ;; remember: this is a toggle op | |
1324 (defun ediff-mark-session-for-operation (info unmark) | |
1325 (let (ignore) | |
1326 (cond ((eq unmark 'mark) (setq unmark nil)) | |
1327 ((eq (ediff-get-session-status info) ?*) (setq unmark t)) | |
1328 (unmark ; says unmark, but the marker is different from * | |
1329 (setq ignore t))) | |
1330 (cond (ignore) | |
1331 (unmark (ediff-set-session-status info nil)) | |
1332 (t (ediff-set-session-status info ?*)))) | |
1333 unmark) | |
1334 | |
1335 | |
13130 | 1336 (defun ediff-hide-marked-sessions (unhide) |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1337 "Hide marked sessions. With prefix arg, unhide." |
13130 | 1338 (interactive "P") |
1339 (let ((grp-buf (ediff-get-group-buffer ediff-meta-list)) | |
1340 (meta-list (cdr ediff-meta-list)) | |
1341 (from (if unhide ?I ?H)) | |
1342 (to (if unhide ?H ?I)) | |
1343 (numMarked 0) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1344 active-sessions-exist session-buf elt) |
13130 | 1345 (while meta-list |
1346 (setq elt (car meta-list) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1347 meta-list (cdr meta-list) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1348 session-buf (ediff-get-session-buffer elt)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1349 |
13130 | 1350 (if (eq (ediff-get-session-status elt) from) |
1351 (progn | |
1352 (setq numMarked (1+ numMarked)) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1353 (if (and (eq to ?I) (buffer-live-p session-buf)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1354 ;; shouldn't hide active sessions |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1355 (setq active-sessions-exist t) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1356 (ediff-set-session-status elt to))))) |
13130 | 1357 (if (> numMarked 0) |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1358 (ediff-update-meta-buffer grp-buf 'must-redraw) |
13130 | 1359 (beep) |
1360 (if unhide | |
1361 (message "Nothing to reveal...") | |
1362 (message "Nothing to hide..."))) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1363 (if active-sessions-exist |
20206 | 1364 (message "Note: Ediff didn't hide active sessions!")) |
13130 | 1365 )) |
1366 | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1367 ;; Apply OPERATION to marked sessions. Operation expects one argument of type |
13130 | 1368 ;; meta-list member (not the first one), i.e., a regular session description. |
1369 ;; Returns number of marked sessions on which operation was performed | |
1370 (defun ediff-operate-on-marked-sessions (operation) | |
1371 (let ((grp-buf (ediff-get-group-buffer ediff-meta-list)) | |
1372 (meta-list (cdr ediff-meta-list)) | |
1373 (marksym ?*) | |
1374 (numMarked 0) | |
1375 (sessionNum 0) | |
19774 | 1376 (diff-buffer ediff-meta-diff-buffer) |
1377 session-buf elt) | |
13130 | 1378 (while meta-list |
1379 (setq elt (car meta-list) | |
1380 meta-list (cdr meta-list) | |
1381 sessionNum (1+ sessionNum)) | |
19774 | 1382 (cond ((eq (ediff-get-session-status elt) marksym) |
1383 (save-excursion | |
1384 (setq numMarked (1+ numMarked)) | |
1385 (funcall operation elt sessionNum))) | |
1386 ((and (ediff-meta-session-p elt) | |
1387 (ediff-buffer-live-p | |
1388 (setq session-buf (ediff-get-session-buffer elt)))) | |
1389 (setq numMarked | |
1390 (+ numMarked | |
1391 (ediff-with-current-buffer session-buf | |
1392 ;; pass meta-diff along | |
1393 (setq ediff-meta-diff-buffer diff-buffer) | |
1394 ;; collect diffs in child group | |
1395 (ediff-operate-on-marked-sessions operation))))))) | |
20206 | 1396 (ediff-update-meta-buffer grp-buf 'must-redraw) ; just in case |
13130 | 1397 numMarked |
1398 )) | |
1399 | |
1400 (defun ediff-append-custom-diff (session sessionNum) | |
1401 (or (ediff-collect-diffs-metajob) | |
19774 | 1402 (error "Hmm, I'd hate to do it to you ...")) |
13130 | 1403 (let ((session-buf (ediff-get-session-buffer session)) |
1404 (meta-diff-buff ediff-meta-diff-buffer) | |
1405 (metajob ediff-metajob-name) | |
1406 tmp-buf custom-diff-buf) | |
1407 (if (ediff-buffer-live-p session-buf) | |
19047 | 1408 (ediff-with-current-buffer session-buf |
13130 | 1409 (if (eq ediff-control-buffer session-buf) ; individual session |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1410 (progn |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1411 (ediff-compute-custom-diffs-maybe) |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1412 (setq custom-diff-buf ediff-custom-diff-buffer))))) |
13130 | 1413 |
1414 (or (ediff-buffer-live-p meta-diff-buff) | |
1415 (error "Ediff: something wrong--no multiple diffs buffer")) | |
1416 | |
1417 (cond ((ediff-buffer-live-p custom-diff-buf) | |
1418 (save-excursion | |
1419 (set-buffer meta-diff-buff) | |
1420 (goto-char (point-max)) | |
1421 (insert-buffer custom-diff-buf) | |
1422 (insert "\n"))) | |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1423 ((memq metajob '(ediff-directories |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1424 ediff-merge-directories |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1425 ediff-merge-directories-with-ancestor)) |
13130 | 1426 ;; get diffs by calling shell command on ediff-custom-diff-program |
1427 (save-excursion | |
1428 (set-buffer (setq tmp-buf (get-buffer-create ediff-tmp-buffer))) | |
1429 (erase-buffer) | |
1430 (shell-command | |
1431 (format "%s %s %s %s" | |
1432 ediff-custom-diff-program ediff-custom-diff-options | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1433 (ediff-get-session-objA-name session) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1434 (ediff-get-session-objB-name session)) |
13130 | 1435 t)) |
1436 (save-excursion | |
1437 (set-buffer meta-diff-buff) | |
1438 (goto-char (point-max)) | |
1439 (insert-buffer tmp-buf) | |
1440 (insert "\n"))) | |
1441 (t | |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1442 (error "Can't make context diff for Session %d" sessionNum ))) |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1443 )) |
13130 | 1444 |
1445 (defun ediff-collect-custom-diffs () | |
1446 "Collect custom diffs of marked sessions in buffer `*Ediff Multifile Diffs*'. | |
1447 This operation is defined only for `ediff-directories' and | |
1448 `ediff-directory-revisions', since its intent is to produce | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1449 multifile patches. For `ediff-directory-revisions', we insist that |
13130 | 1450 all marked sessions must be active." |
1451 (interactive) | |
1452 (or (ediff-buffer-live-p ediff-meta-diff-buffer) | |
1453 (setq ediff-meta-diff-buffer | |
1454 (get-buffer-create | |
1455 (ediff-unique-buffer-name "*Ediff Multifile Diffs" "*")))) | |
19047 | 1456 (ediff-with-current-buffer ediff-meta-diff-buffer |
13130 | 1457 (erase-buffer)) |
1458 (if (> (ediff-operate-on-marked-sessions 'ediff-append-custom-diff) 0) | |
1459 ;; did something | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1460 (progn |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1461 (display-buffer ediff-meta-diff-buffer 'not-this-window) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1462 (ediff-with-current-buffer ediff-meta-diff-buffer |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1463 (set-buffer-modified-p nil) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1464 (setq buffer-read-only t))) |
13130 | 1465 (beep) |
1466 (message "No marked sessions found"))) | |
1467 | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1468 (defun ediff-meta-show-patch () |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1469 "Show the multi-file patch associated with this group session." |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1470 (interactive) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1471 (let* ((pos (ediff-event-point last-command-event)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1472 (meta-buf (ediff-event-buffer last-command-event)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1473 (info (ediff-get-meta-info meta-buf pos 'noerror)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1474 (patchbuffer ediff-meta-patchbufer)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1475 (if (ediff-buffer-live-p patchbuffer) |
19047 | 1476 (ediff-with-current-buffer patchbuffer |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1477 (save-restriction |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1478 (if (not info) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1479 (widen) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1480 (narrow-to-region |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1481 (ediff-get-session-objB-name info) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1482 (ediff-get-session-objC-name info))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1483 (set-buffer (get-buffer-create ediff-tmp-buffer)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1484 (erase-buffer) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1485 (insert-buffer patchbuffer) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1486 (display-buffer ediff-tmp-buffer 'not-this-window) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1487 )) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1488 (error "The patch buffer wasn't found")))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1489 |
13130 | 1490 |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1491 ;; 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
|
1492 (defun ediff-filegroup-action () |
13130 | 1493 "Execute appropriate action for the selected session." |
1494 (interactive) | |
1495 (let* ((pos (ediff-event-point last-command-event)) | |
1496 (meta-buf (ediff-event-buffer last-command-event)) | |
1497 ;; ediff-get-meta-info gives error if meta-buf or pos are invalid | |
1498 (info (ediff-get-meta-info meta-buf pos)) | |
20206 | 1499 (session-buf (ediff-get-session-buffer info)) |
20343 | 1500 (session-number (ediff-get-session-number-at-pos pos meta-buf)) |
20206 | 1501 merge-autostore-dir file1 file2 file3 regexp) |
13130 | 1502 |
20206 | 1503 (setq file1 (ediff-get-session-objA-name info) |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1504 file2 (ediff-get-session-objB-name info) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1505 file3 (ediff-get-session-objC-name info)) |
13130 | 1506 |
1507 ;; make sure we don't start on hidden sessions | |
1508 ;; ?H means marked for hiding. ?I means invalid (hidden). | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1509 (if (memq (ediff-get-session-status info) '(?I)) |
13130 | 1510 (progn |
1511 (beep) | |
1512 (if (y-or-n-p "This session is marked as hidden, unmark? ") | |
1513 (progn | |
1514 (ediff-set-session-status info nil) | |
20206 | 1515 (ediff-update-meta-buffer meta-buf nil session-number)) |
13130 | 1516 (error "Aborted")))) |
1517 | |
19047 | 1518 (ediff-with-current-buffer meta-buf |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1519 (setq merge-autostore-dir |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1520 (ediff-get-group-merge-autostore-dir ediff-meta-list)) |
13130 | 1521 (goto-char pos) ; if the user clicked on session--move point there |
1522 ;; First handle sessions involving directories (which are themselves | |
1523 ;; session groups) | |
1524 ;; After that handle individual sessions | |
19774 | 1525 (cond ((ediff-meta-session-p info) |
13130 | 1526 ;; do ediff/ediff-merge on subdirectories |
1527 (if (ediff-buffer-live-p session-buf) | |
1528 (ediff-show-meta-buffer session-buf) | |
1529 (setq regexp (read-string "Filter through regular expression: " | |
1530 nil 'ediff-filtering-regexp-history)) | |
1531 (ediff-directories-internal | |
1532 file1 file2 file3 regexp | |
1533 ediff-session-action-function | |
1534 ediff-metajob-name | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1535 ;; make it update (car info) after startup |
26585
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1536 `(list (lambda () |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1537 ;; child session group should know its parent |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1538 (setq ediff-parent-meta-buffer |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1539 (quote ,ediff-meta-buffer) |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1540 ediff-meta-session-number |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1541 ,session-number) |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1542 ;; and parent will know its child |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1543 (setcar (quote ,info) ediff-meta-buffer)))))) |
13130 | 1544 |
1545 ;; Do ediff-revision on a subdirectory | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1546 ((and (ediff-one-filegroup-metajob) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1547 (ediff-revision-metajob) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1548 (file-directory-p file1)) |
13130 | 1549 (if (ediff-buffer-live-p session-buf) |
1550 (ediff-show-meta-buffer session-buf) | |
1551 (setq regexp (read-string "Filter through regular expression: " | |
1552 nil 'ediff-filtering-regexp-history)) | |
1553 (ediff-directory-revisions-internal | |
1554 file1 regexp | |
1555 ediff-session-action-function ediff-metajob-name | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1556 ;; make it update (car info) after startup |
26585
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1557 `(list (lambda () |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1558 ;; child session group should know its parent and |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1559 ;; its number |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1560 (setq ediff-parent-meta-buffer |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1561 (quote ,ediff-meta-buffer) |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1562 ediff-meta-session-number |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1563 ,session-number) |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1564 ;; and parent will know its child |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1565 (setcar (quote ,info) ediff-meta-buffer)))))) |
13130 | 1566 |
1567 ;; From here on---only individual session handlers | |
1568 | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1569 ;; handle an individual session with a live control buffer |
13130 | 1570 ((ediff-buffer-live-p session-buf) |
19047 | 1571 (ediff-with-current-buffer session-buf |
13130 | 1572 (setq ediff-mouse-pixel-position (mouse-pixel-position)) |
1573 (ediff-recenter 'no-rehighlight))) | |
1574 | |
1575 ((ediff-problematic-session-p info) | |
1576 (beep) | |
1577 (if (y-or-n-p | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1578 "This session has no ancestor. Merge without the ancestor? ") |
13130 | 1579 (ediff-merge-files |
1580 file1 file2 | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1581 ;; provide startup hooks |
26585
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1582 `(list (lambda () |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1583 (add-hook |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1584 'ediff-after-quit-hook-internal |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1585 (lambda () |
26585
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1586 (if (ediff-buffer-live-p ,(current-buffer)) |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1587 (ediff-show-meta-buffer |
26585
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1588 ,(current-buffer) ,session-number))) |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1589 nil 'local) |
26585
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1590 (setq ediff-meta-buffer ,(current-buffer) |
20206 | 1591 ediff-meta-session-number |
26585
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1592 ,session-number) |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1593 (setq ediff-merge-store-file |
26585
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1594 ,(if (ediff-nonempty-string-p |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1595 merge-autostore-dir) |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1596 (concat |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1597 merge-autostore-dir |
29165
641e43bad886
2000-05-24 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
1598 ediff-merge-filename-prefix |
26585
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1599 (file-name-nondirectory file1)) |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1600 )) |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1601 ;; make ediff-startup pass |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1602 ;; ediff-control-buffer back to the meta |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1603 ;; level; see below |
13130 | 1604 (setcar |
26585
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1605 (quote ,info) ediff-control-buffer)))) |
13130 | 1606 (error "Aborted"))) |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1607 ((ediff-one-filegroup-metajob) ; needs 1 file arg |
13130 | 1608 (funcall ediff-session-action-function |
1609 file1 | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1610 ;; provide startup hooks |
26585
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1611 `(list (lambda () |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1612 (add-hook |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1613 'ediff-after-quit-hook-internal |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1614 (lambda () |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1615 (if (ediff-buffer-live-p |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1616 ,(current-buffer)) |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1617 (ediff-show-meta-buffer |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1618 ,(current-buffer) |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1619 ,session-number))) |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1620 nil 'local) |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1621 (setq ediff-meta-buffer ,(current-buffer) |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1622 ediff-meta-session-number |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1623 ,session-number) |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1624 (setq ediff-merge-store-file |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1625 ,(if (ediff-nonempty-string-p |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1626 merge-autostore-dir) |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1627 (concat |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1628 merge-autostore-dir |
29165
641e43bad886
2000-05-24 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
1629 ediff-merge-filename-prefix |
26585
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1630 (file-name-nondirectory file1))) ) |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1631 ;; make ediff-startup pass |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1632 ;; ediff-control-buffer back to the meta |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1633 ;; level; see below |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1634 (setcar |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1635 (quote ,info) ediff-control-buffer))))) |
13130 | 1636 ((not (ediff-metajob3)) ; need 2 file args |
1637 (funcall ediff-session-action-function | |
1638 file1 file2 | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1639 ;; provide startup hooks |
26585
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1640 `(list (lambda () |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1641 (add-hook |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1642 'ediff-after-quit-hook-internal |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1643 (lambda () |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1644 (if (ediff-buffer-live-p |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1645 ,(current-buffer)) |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1646 (ediff-show-meta-buffer |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1647 ,(current-buffer) |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1648 ,session-number))) |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1649 nil 'local) |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1650 (setq ediff-meta-buffer ,(current-buffer) |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1651 ediff-meta-session-number |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1652 ,session-number) |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1653 (setq ediff-merge-store-file |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1654 ,(if (ediff-nonempty-string-p |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1655 merge-autostore-dir) |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1656 (concat |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1657 merge-autostore-dir |
29165
641e43bad886
2000-05-24 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
1658 ediff-merge-filename-prefix |
26585
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1659 (file-name-nondirectory file1))) ) |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1660 ;; make ediff-startup pass |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1661 ;; ediff-control-buffer back to the meta |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1662 ;; level; see below |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1663 (setcar |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1664 (quote ,info) ediff-control-buffer))))) |
13130 | 1665 ((ediff-metajob3) ; need 3 file args |
1666 (funcall ediff-session-action-function | |
1667 file1 file2 file3 | |
1668 ;; arrange startup hooks | |
26585
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1669 `(list (lambda () |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1670 (add-hook |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1671 'ediff-after-quit-hook-internal |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1672 (lambda () |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1673 (if (ediff-buffer-live-p |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1674 ,(current-buffer)) |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1675 (ediff-show-meta-buffer |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1676 ,(current-buffer) |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1677 ,session-number))) |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1678 nil 'local) |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1679 (setq ediff-merge-store-file |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1680 ,(if (ediff-nonempty-string-p |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1681 merge-autostore-dir) |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1682 (concat |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1683 merge-autostore-dir |
29165
641e43bad886
2000-05-24 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26585
diff
changeset
|
1684 ediff-merge-filename-prefix |
26585
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1685 (file-name-nondirectory file1))) ) |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1686 (setq ediff-meta-buffer , (current-buffer) |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1687 ediff-meta-session-number |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1688 ,session-number) |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1689 ;; this arranges that ediff-startup will pass |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1690 ;; the value of ediff-control-buffer back to |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1691 ;; the meta level, to the record in the meta |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1692 ;; list containing the information about the |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1693 ;; session associated with that |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1694 ;; ediff-control-buffer |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1695 (setcar |
3ec5a485d0ab
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
26263
diff
changeset
|
1696 (quote ,info) ediff-control-buffer))))) |
13130 | 1697 ) ; cond |
1698 ) ; eval in meta-buf | |
1699 )) | |
1700 | |
1701 (defun ediff-registry-action () | |
1702 "Switch to a selected session." | |
1703 (interactive) | |
1704 (let* ((pos (ediff-event-point last-command-event)) | |
1705 (buf (ediff-event-buffer last-command-event)) | |
1706 (ctl-buf (ediff-get-meta-info buf pos))) | |
1707 | |
1708 (if (ediff-buffer-live-p ctl-buf) | |
1709 ;; check if this is ediff-control-buffer or ediff-meta-buffer | |
19047 | 1710 (if (ediff-with-current-buffer ctl-buf |
13130 | 1711 (eq (key-binding "q") 'ediff-quit-meta-buffer)) |
1712 ;; it's a meta-buffer -- last action should just display it | |
20206 | 1713 (ediff-show-meta-buffer ctl-buf t) |
13130 | 1714 ;; it's a session buffer -- invoke go back to session |
19047 | 1715 (ediff-with-current-buffer ctl-buf |
13130 | 1716 (setq ediff-mouse-pixel-position (mouse-pixel-position)) |
1717 (ediff-recenter 'no-rehighlight))) | |
1718 (beep) | |
1719 (message "You've selected a stale session --- try again") | |
1720 (ediff-update-registry)) | |
19047 | 1721 (ediff-with-current-buffer buf |
13130 | 1722 (goto-char pos)) |
1723 )) | |
1724 | |
1725 | |
20206 | 1726 ;; If session number is t, means don't update meta buffer |
1727 (defun ediff-show-meta-buffer (&optional meta-buf session-number) | |
13130 | 1728 "Show the session group buffer." |
1729 (interactive) | |
33019
6306740f6938
2000-10-29 Michael Kifer <kifer@cs.sunysb.edu>
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
29165
diff
changeset
|
1730 (run-hooks 'ediff-before-directory-setup-hooks) |
13130 | 1731 (let (wind frame silent) |
1732 (if meta-buf (setq silent t)) | |
1733 | |
1734 (setq meta-buf (or meta-buf ediff-meta-buffer)) | |
1735 (cond ((not (bufferp meta-buf)) | |
1736 (error "This Ediff session is not part of a session group")) | |
1737 ((not (ediff-buffer-live-p meta-buf)) | |
1738 (error | |
1739 "Can't find this session's group panel -- session itself is ok"))) | |
1740 | |
20206 | 1741 (cond ((numberp session-number) |
1742 (ediff-update-meta-buffer meta-buf nil session-number)) | |
1743 ;; if session-number is t, don't update | |
1744 (session-number) | |
1745 (t (ediff-cleanup-meta-buffer meta-buf))) | |
1746 | |
19047 | 1747 (ediff-with-current-buffer meta-buf |
13130 | 1748 (save-excursion |
1749 (cond ((setq wind (ediff-get-visible-buffer-window meta-buf)) | |
1750 (or silent | |
1751 (message | |
1752 "Already showing the group panel for this session")) | |
1753 (set-window-buffer wind meta-buf) | |
1754 (select-window wind)) | |
1755 ((window-live-p (setq wind ediff-window-C)) ;in merge--merge buf | |
1756 (set-window-buffer ediff-window-C meta-buf) | |
1757 (select-window wind)) | |
1758 ((window-live-p (setq wind ediff-window-A)) | |
1759 (set-window-buffer ediff-window-A meta-buf) | |
1760 (select-window wind)) | |
1761 ((window-live-p (setq wind ediff-window-B)) | |
1762 (set-window-buffer ediff-window-B meta-buf) | |
1763 (select-window wind)) | |
1764 ((and | |
1765 (setq wind | |
1766 (ediff-get-visible-buffer-window ediff-registry-buffer)) | |
1767 (ediff-window-display-p)) | |
1768 (select-window wind) | |
1769 (other-window 1) | |
1770 (set-window-buffer (selected-window) meta-buf)) | |
1771 (t (ediff-skip-unsuitable-frames 'ok-unsplittable) | |
1772 (set-window-buffer (selected-window) meta-buf))) | |
1773 )) | |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1774 (if (and (ediff-window-display-p) |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1775 (window-live-p |
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1776 (setq wind (ediff-get-visible-buffer-window meta-buf)))) |
13130 | 1777 (progn |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1778 (setq frame (window-frame wind)) |
13130 | 1779 (raise-frame frame) |
1780 (ediff-reset-mouse frame))) | |
1781 (run-hooks 'ediff-show-session-group-hook) | |
1782 )) | |
1783 | |
20206 | 1784 (defun ediff-show-current-session-meta-buffer () |
1785 (interactive) | |
1786 (ediff-show-meta-buffer nil ediff-meta-session-number)) | |
1787 | |
13130 | 1788 (defun ediff-show-meta-buff-from-registry () |
1789 "Display the session group buffer for a selected session group." | |
1790 (interactive) | |
1791 (let* ((pos (ediff-event-point last-command-event)) | |
1792 (meta-buf (ediff-event-buffer last-command-event)) | |
1793 (info (ediff-get-meta-info meta-buf pos)) | |
1794 (meta-or-session-buf info)) | |
19047 | 1795 (ediff-with-current-buffer meta-or-session-buf |
20206 | 1796 (ediff-show-meta-buffer nil t)))) |
13130 | 1797 |
1798 ;;;###autoload | |
1799 (defun ediff-show-registry () | |
1800 "Display Ediff's registry." | |
1801 (interactive) | |
1802 (ediff-update-registry) | |
1803 (if (not (ediff-buffer-live-p ediff-registry-buffer)) | |
1804 (error "No active Ediff sessions or corrupted session registry")) | |
1805 (let (wind frame) | |
1806 ;; 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
|
1807 ;; explicitly |
19047 | 1808 (ediff-with-current-buffer ediff-registry-buffer |
13130 | 1809 (save-excursion |
1810 (cond ((setq wind | |
1811 (ediff-get-visible-buffer-window ediff-registry-buffer)) | |
1812 (message "Already showing the registry") | |
1813 (set-window-buffer wind ediff-registry-buffer) | |
1814 (select-window wind)) | |
1815 ((window-live-p ediff-window-C) | |
1816 (set-window-buffer ediff-window-C ediff-registry-buffer) | |
1817 (select-window ediff-window-C)) | |
1818 ((window-live-p ediff-window-A) | |
1819 (set-window-buffer ediff-window-A ediff-registry-buffer) | |
1820 (select-window ediff-window-A)) | |
1821 ((window-live-p ediff-window-B) | |
1822 (set-window-buffer ediff-window-B ediff-registry-buffer) | |
1823 (select-window ediff-window-B)) | |
1824 ((and (setq wind | |
1825 (ediff-get-visible-buffer-window ediff-meta-buffer)) | |
1826 (ediff-window-display-p)) | |
1827 (select-window wind) | |
1828 (other-window 1) | |
1829 (set-window-buffer (selected-window) ediff-registry-buffer)) | |
1830 (t (ediff-skip-unsuitable-frames 'ok-unsplittable) | |
1831 (set-window-buffer (selected-window) ediff-registry-buffer))) | |
1832 )) | |
1833 (if (ediff-window-display-p) | |
1834 (progn | |
1835 (setq frame | |
1836 (window-frame | |
1837 (ediff-get-visible-buffer-window ediff-registry-buffer))) | |
1838 (raise-frame frame) | |
1839 (ediff-reset-mouse frame))) | |
1840 (run-hooks 'ediff-show-registry-hook) | |
1841 )) | |
1842 | |
1843 ;;;###autoload | |
1844 (defalias 'eregistry 'ediff-show-registry) | |
1845 | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1846 ;; If meta-buf doesn't exist, it is created. In that case, id doesn't have a |
13130 | 1847 ;; parent meta-buf |
1848 ;; Check if META-BUF exists before calling this function | |
20206 | 1849 ;; Optional MUST-REDRAW, if non-nil, would force redrawal of the whole meta |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1850 ;; buffer. Otherwise, it will just go over the buffer and update activity marks |
20206 | 1851 ;; and session status. |
1852 ;; SESSION-NUMBER, if specified, says which session caused the update. | |
1853 (defun ediff-update-meta-buffer (meta-buf &optional must-redraw session-number) | |
1854 (if (ediff-buffer-live-p meta-buf) | |
1855 (ediff-with-current-buffer meta-buf | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1856 (let (overl) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1857 (cond (must-redraw ; completely redraw the meta buffer |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1858 (funcall ediff-meta-redraw-function ediff-meta-list)) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1859 ((numberp session-number) ; redraw only for the given session |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1860 (ediff-update-session-marker-in-dir-meta-buffer |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1861 session-number)) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1862 (t ; update what changed only, but scan the entire meta buffer |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1863 (ediff-update-markers-in-dir-meta-buffer ediff-meta-list))) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1864 (setq overl (ediff-get-meta-overlay-at-pos (point))) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1865 ;; skip the invisible sessions |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1866 (while (and overl (ediff-overlay-get overl 'invisible)) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1867 (ediff-next-meta-item1) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1868 (setq overl (ediff-get-meta-overlay-at-pos (point)))) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1869 )))) |
13130 | 1870 |
1871 (defun ediff-update-registry () | |
19047 | 1872 (ediff-with-current-buffer (current-buffer) |
13130 | 1873 (if (ediff-buffer-live-p ediff-registry-buffer) |
1874 (ediff-redraw-registry-buffer) | |
1875 (ediff-prepare-meta-buffer | |
1876 'ediff-registry-action | |
1877 ediff-session-registry | |
1878 "*Ediff Registry" | |
1879 'ediff-redraw-registry-buffer | |
1880 'ediff-registry)) | |
1881 )) | |
1882 | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1883 ;; If meta-buf exists, it is redrawn along with parent. |
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1884 ;; Otherwise, nothing happens. |
13130 | 1885 (defun ediff-cleanup-meta-buffer (meta-buffer) |
1886 (if (ediff-buffer-live-p meta-buffer) | |
19047 | 1887 (ediff-with-current-buffer meta-buffer |
13130 | 1888 (ediff-update-meta-buffer meta-buffer) |
1889 (if (ediff-buffer-live-p ediff-parent-meta-buffer) | |
20206 | 1890 (ediff-update-meta-buffer |
1891 ediff-parent-meta-buffer nil ediff-meta-session-number))))) | |
13130 | 1892 |
20206 | 1893 ;; t if no session is in progress |
13130 | 1894 (defun ediff-safe-to-quit (meta-buffer) |
1895 (if (ediff-buffer-live-p meta-buffer) | |
1896 (let ((lis ediff-meta-list) | |
1897 (cont t) | |
1898 buffer-read-only) | |
20206 | 1899 ;;(ediff-update-meta-buffer meta-buffer) |
19047 | 1900 (ediff-with-current-buffer meta-buffer |
13130 | 1901 (setq lis (cdr lis)) ; discard the description part of meta-list |
1902 (while (and cont lis) | |
1903 (if (ediff-buffer-live-p | |
1904 (ediff-get-group-buffer lis)) ; in progress | |
1905 (setq cont nil)) | |
1906 (setq lis (cdr lis))) | |
1907 cont)))) | |
1908 | |
1909 (defun ediff-quit-meta-buffer () | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1910 "If the group has no active session, delete the meta buffer. |
13130 | 1911 If no session is in progress, ask to confirm before deleting meta buffer. |
1912 Otherwise, bury the meta buffer. | |
1913 If this is a session registry buffer then just bury it." | |
1914 (interactive) | |
1915 (let* ((buf (current-buffer)) | |
1916 (dir-diffs-buffer ediff-dir-diffs-buffer) | |
1917 (meta-diff-buffer ediff-meta-diff-buffer) | |
20206 | 1918 (session-number ediff-meta-session-number) |
13130 | 1919 (parent-buf ediff-parent-meta-buffer) |
1920 (dont-show-registry (eq buf ediff-registry-buffer))) | |
1921 (if dont-show-registry | |
1922 (bury-buffer) | |
20206 | 1923 ;;(ediff-cleanup-meta-buffer buf) |
13130 | 1924 (cond ((and (ediff-safe-to-quit buf) |
1925 (y-or-n-p "Quit this session group? ")) | |
16248
b2fae8abc5b0
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
15480
diff
changeset
|
1926 (run-hooks 'ediff-quit-session-group-hook) |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1927 (message "") |
13130 | 1928 (ediff-dispose-of-meta-buffer buf)) |
1929 ((ediff-safe-to-quit buf) | |
1930 (bury-buffer)) | |
1931 (t | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1932 (error |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
1933 "This session group has active sessions---cannot exit"))) |
20206 | 1934 (ediff-update-meta-buffer parent-buf nil session-number) |
13130 | 1935 (ediff-kill-buffer-carefully dir-diffs-buffer) |
1936 (ediff-kill-buffer-carefully meta-diff-buffer) | |
1937 (if (ediff-buffer-live-p parent-buf) | |
1938 (progn | |
1939 (setq dont-show-registry t) | |
20206 | 1940 (ediff-show-meta-buffer parent-buf session-number))) |
13130 | 1941 ) |
1942 (or dont-show-registry | |
1943 (ediff-show-registry)))) | |
1944 | |
1945 (defun ediff-dispose-of-meta-buffer (buf) | |
1946 (setq ediff-session-registry (delq buf ediff-session-registry)) | |
19047 | 1947 (ediff-with-current-buffer buf |
13130 | 1948 (if (ediff-buffer-live-p ediff-dir-diffs-buffer) |
1949 (kill-buffer ediff-dir-diffs-buffer))) | |
1950 (kill-buffer buf)) | |
1951 | |
1952 | |
14582
c768f6d7daaa
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14169
diff
changeset
|
1953 ;; Obtain information on a meta record where the user clicked or typed |
13130 | 1954 ;; BUF is the buffer where this happened and POINT is the position |
1955 ;; If optional NOERROR arg is given, don't report error and return nil if no | |
1956 ;; meta info is found on line. | |
1957 (defun ediff-get-meta-info (buf point &optional noerror) | |
1958 (let (result olist tmp) | |
1959 (if (and point (ediff-buffer-live-p buf)) | |
19047 | 1960 (ediff-with-current-buffer buf |
13130 | 1961 (if ediff-xemacs-p |
1962 (setq result | |
1963 (if (setq tmp (extent-at point buf 'ediff-meta-info)) | |
1964 (ediff-overlay-get tmp 'ediff-meta-info))) | |
1965 (setq olist (overlays-at point)) | |
1966 (setq olist | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
1967 (mapcar (lambda (elt) (overlay-get elt 'ediff-meta-info)) |
13130 | 1968 olist)) |
1969 (while (and olist (null (car olist)) | |
1970 (overlay-get (car olist) 'invisible)) | |
1971 (setq olist (cdr olist))) | |
1972 (setq result (car olist))))) | |
1973 (if result | |
1974 result | |
1975 (if noerror | |
1976 nil | |
1977 (ediff-update-registry) | |
1978 (error "No session info in this line"))))) | |
1979 | |
20206 | 1980 |
1981 (defun ediff-get-meta-overlay-at-pos (point) | |
1982 (if ediff-xemacs-p | |
1983 (extent-at point (current-buffer) 'ediff-meta-info) | |
1984 (let* ((overl-list (overlays-at point)) | |
1985 (overl (car overl-list))) | |
1986 (while (and overl (null (overlay-get overl 'ediff-meta-info))) | |
1987 (setq overl-list (cdr overl-list) | |
1988 overl (car overl-list))) | |
1989 overl))) | |
1990 | |
20343 | 1991 (defsubst ediff-get-session-number-at-pos (point &optional meta-buffer) |
1992 (setq meta-buffer (if (ediff-buffer-live-p meta-buffer) | |
1993 meta-buffer | |
1994 (current-buffer))) | |
1995 (ediff-with-current-buffer meta-buffer | |
1996 (ediff-overlay-get | |
1997 (ediff-get-meta-overlay-at-pos point) 'ediff-meta-session-number))) | |
20206 | 1998 |
1999 | |
2000 ;; Return location of the next meta overlay after point | |
13130 | 2001 (defun ediff-next-meta-overlay-start (point) |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2002 (if (eobp) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2003 (goto-char (point-min)) |
20206 | 2004 (let ((overl (ediff-get-meta-overlay-at-pos point))) |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2005 (if ediff-xemacs-p |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2006 (progn |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2007 (if overl |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2008 (setq overl (next-extent overl)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2009 (setq overl (next-extent (current-buffer)))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2010 (if overl |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2011 (extent-start-position overl) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2012 (point-max))) |
20206 | 2013 (if overl |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2014 ;; 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
|
2015 (overlay-end overl) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2016 (next-overlay-change point)))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2017 )) |
13130 | 2018 |
20206 | 2019 |
13130 | 2020 (defun ediff-previous-meta-overlay-start (point) |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2021 (if (bobp) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2022 (goto-char (point-max)) |
20206 | 2023 (let ((overl (ediff-get-meta-overlay-at-pos point))) |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2024 (if ediff-xemacs-p |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2025 (progn |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2026 (if overl |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2027 (setq overl (previous-extent overl)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2028 (setq overl (previous-extent (current-buffer)))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2029 (if overl |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2030 (extent-start-position overl) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2031 (point-min))) |
20206 | 2032 (if overl (setq point (overlay-start overl))) |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2033 ;; to get to the beginning of prev overlay |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2034 (if (not (bobp)) |
20206 | 2035 ;; trick to overcome an emacs bug--doesn't always find previous |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2036 ;; overlay change correctly |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2037 (setq point (1- point))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2038 (setq point (previous-overlay-change point)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2039 ;; If we are not over an overlay after subtracting 1, it means we are |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
2040 ;; in the description area preceding session records. In this case, |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2041 ;; goto the top of the registry buffer. |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2042 (or (car (overlays-at point)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2043 (setq point (point-min))) |
20206 | 2044 point)))) |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2045 |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2046 ;; 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
|
2047 ;; buffer. |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2048 (defun ediff-patch-file-form-meta (file &optional startup-hooks) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2049 (let* ((pos (ediff-event-point last-command-event)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2050 (meta-buf (ediff-event-buffer last-command-event)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2051 ;; 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
|
2052 (info (ediff-get-meta-info meta-buf pos)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2053 (meta-patchbuf ediff-meta-patchbufer) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2054 session-buf beg-marker end-marker) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2055 |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2056 (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
|
2057 (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
|
2058 (setq session-buf (ediff-get-session-buffer info) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2059 beg-marker (ediff-get-session-objB-name info) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2060 end-marker (ediff-get-session-objC-name info)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2061 |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2062 (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
|
2063 (null session-buf) ; or it is a virgin session |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2064 (error |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2065 "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
|
2066 |
19047 | 2067 (ediff-with-current-buffer meta-patchbuf |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2068 (save-restriction |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2069 (widen) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2070 (narrow-to-region beg-marker end-marker) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2071 (ediff-patch-file-internal meta-patchbuf file startup-hooks))))) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2072 |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2073 |
22286 | 2074 (defun ediff-unmark-all-for-operation () |
2075 "Unmark all sessions marked for operation." | |
2076 (interactive) | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
2077 (let ((list (cdr ediff-meta-list)) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
2078 elt) |
22286 | 2079 (while (setq elt (car list)) |
2080 (ediff-mark-session-for-operation elt 'unmark) | |
2081 (setq list (cdr list)))) | |
2082 (ediff-update-meta-buffer (current-buffer) 'must-redraw)) | |
2083 | |
2084 (defun ediff-unmark-all-for-hiding () | |
2085 "Unmark all sessions marked for hiding." | |
2086 (interactive) | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
2087 (let ((list (cdr ediff-meta-list)) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
2088 elt) |
22286 | 2089 (while (setq elt (car list)) |
2090 (ediff-mark-session-for-hiding elt 'unmark) | |
2091 (setq list (cdr list)))) | |
2092 (ediff-update-meta-buffer (current-buffer) 'must-redraw)) | |
2093 | |
2094 | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2095 (defun ediff-meta-mark-equal-files () |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2096 "Run though the session list and mark identical files. |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2097 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
|
2098 (interactive) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2099 (let ((list (cdr ediff-meta-list)) |
22286 | 2100 marked1 marked2 marked3 |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2101 fileinfo1 fileinfo2 fileinfo3 elt) |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
2102 (message "Comparing files ...") |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2103 (while (setq elt (car list)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2104 (setq fileinfo1 (ediff-get-session-objA elt) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2105 fileinfo2 (ediff-get-session-objB elt) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2106 fileinfo3 (ediff-get-session-objC elt)) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2107 (ediff-set-file-eqstatus fileinfo1 nil) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2108 (ediff-set-file-eqstatus fileinfo2 nil) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2109 (ediff-set-file-eqstatus fileinfo3 nil) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2110 |
22286 | 2111 (setq marked1 t |
2112 marked2 t | |
2113 marked3 t) | |
2114 (or (ediff-mark-if-equal fileinfo1 fileinfo2) | |
2115 (setq marked1 nil)) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2116 (if (ediff-metajob3) |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2117 (progn |
22286 | 2118 (or (ediff-mark-if-equal fileinfo1 fileinfo3) |
2119 (setq marked2 nil)) | |
2120 (or (ediff-mark-if-equal fileinfo2 fileinfo3) | |
2121 (setq marked3 nil)))) | |
2122 (if (and marked1 marked2 marked3) | |
2123 (cond ((eq last-command-char ?h) | |
2124 (ediff-mark-session-for-hiding elt 'mark)) | |
2125 ((eq last-command-char ?m) | |
2126 (ediff-mark-session-for-operation elt 'mark)) | |
2127 )) | |
26263
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
2128 (setq list (cdr list))) |
4f315ca65976
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
22286
diff
changeset
|
2129 (message "Comparing files ... Done")) |
20206 | 2130 (ediff-update-meta-buffer (current-buffer) 'must-redraw)) |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2131 |
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2132 ;; mark files 1 and 2 as equal, if they are. |
22286 | 2133 ;; returns t, if something was marked |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2134 (defun ediff-mark-if-equal (fileinfo1 fileinfo2) |
20206 | 2135 (let ((f1 (car fileinfo1)) |
2136 (f2 (car fileinfo2))) | |
22286 | 2137 (cond ((file-directory-p f1) nil) |
2138 ((file-directory-p f2) nil) | |
2139 ((ediff-same-file-contents f1 f2) | |
2140 (ediff-set-file-eqstatus fileinfo1 t) | |
2141 (ediff-set-file-eqstatus fileinfo2 t) | |
2142 t)) | |
2143 )) | |
15480
43a3308fcf61
*** empty log message ***
Michael Kifer <kifer@cs.stonybrook.edu>
parents:
14582
diff
changeset
|
2144 |
13130 | 2145 |
2146 | |
2147 ;;; Local Variables: | |
2148 ;;; eval: (put 'ediff-defvar-local 'lisp-indent-hook 'defun) | |
19047 | 2149 ;;; eval: (put 'ediff-with-current-buffer 'lisp-indent-hook 1) |
2150 ;;; eval: (put 'ediff-with-current-buffer 'edebug-form-spec '(form body)) | |
13130 | 2151 ;;; End: |
2152 | |
13607
71a4a349d998
Renamed from ediff-meta.el. Changed provide.
Richard M. Stallman <rms@gnu.org>
parents:
13216
diff
changeset
|
2153 ;;; ediff-mult.el ends here |