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