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