comparison lisp/ediff-mult.el @ 39488:3856a43ac2bb

2001-09-27 Michael Kifer <kifer@cs.sunysb.edu> * ediff-mult.el (ediff-get-meta-info): Installed Gerd's changes. Added comments.
author Michael Kifer <kifer@cs.stonybrook.edu>
date Fri, 28 Sep 2001 03:06:09 +0000
parents a8be9f0afdee
children 3ce98f3e0608
comparison
equal deleted inserted replaced
39487:b21317213c81 39488:3856a43ac2bb
24 ;;; Commentary: 24 ;;; Commentary:
25 25
26 ;; Users are encouraged to add functionality to this file. 26 ;; Users are encouraged to add functionality to this file.
27 ;; The present file contains all the infrastructure needed for that. 27 ;; The present file contains all the infrastructure needed for that.
28 ;; 28 ;;
29 ;; Generally, to to implement a new multisession capability within Ediff, 29 ;; Generally, to implement a new multisession capability within Ediff,
30 ;; you need to tell it 30 ;; you need to tell it
31 ;; 31 ;;
32 ;; 1. How to display the session group buffer. 32 ;; 1. How to display the session group buffer.
33 ;; This function must indicate which Ediff sessions are active (+) and 33 ;; This function must indicate which Ediff sessions are active (+) and
34 ;; which are finished (-). 34 ;; which are finished (-).
47 ;; elements must describe individual sessions. 47 ;; elements must describe individual sessions.
48 ;; This descriptor must be a list of two, three, or four elements (nil 48 ;; This descriptor must be a list of two, three, or four elements (nil
49 ;; or string). The function ediff-redraw-registry-buffer displays the 49 ;; or string). The function ediff-redraw-registry-buffer displays the
50 ;; second through last of these in the registry buffer. 50 ;; second through last of these in the registry buffer.
51 ;; Also, keep in mind that the function ediff-prepare-meta-buffer 51 ;; Also, keep in mind that the function ediff-prepare-meta-buffer
52 ;; (which see) prepends the session group buffer to the descriptor and 52 ;; (which see) prepends the session group buffer to the descriptor, and
53 ;; nil in front of each subsequent list (i.e., the above list 53 ;; nil in front of each subsequent list (i.e., the above list
54 ;; will become 54 ;; will become
55 ;; ((meta-buf descriptor) (nil obj1 obj2 obj3) (nil ...) ...) 55 ;; ((meta-buf descriptor) (nil obj1 obj2 obj3) (nil ...) ...)
56 ;; Ediff expects that your function (in 2 above) will arrange to 56 ;; Ediff expects that your function (in 2 above) will arrange to
57 ;; replace this prepended nil (via setcar) with the actual ediff 57 ;; replace this prepended nil (via setcar) with the actual ediff
223 ;; Buffer holding the multi-file patch. Local to the meta buffer 223 ;; Buffer holding the multi-file patch. Local to the meta buffer
224 (ediff-defvar-local ediff-meta-patchbufer nil "") 224 (ediff-defvar-local ediff-meta-patchbufer nil "")
225 225
226 ;;; API for ediff-meta-list 226 ;;; API for ediff-meta-list
227 227
228 ;; Structure of the meta-list:
229 ;; (HEADER SESSION1 SESSION2 ...)
230 ;; HEADER: (GROUP-BUF REGEXP OBJA OBJB OBJC SAVE-DIR)
231 ;; OBJA - first directory
232 ;; OBJB - second directory
233 ;; OBJC - third directory
234 ;; SESSION1/2/... are described below
228 ;; group buffer/regexp 235 ;; group buffer/regexp
229 (defsubst ediff-get-group-buffer (meta-list) 236 (defsubst ediff-get-group-buffer (meta-list)
230 (nth 0 (car meta-list))) 237 (nth 0 (car meta-list)))
231 238
232 (defsubst ediff-get-group-regexp (meta-list) 239 (defsubst ediff-get-group-regexp (meta-list)
239 (defsubst ediff-get-group-objC (meta-list) 246 (defsubst ediff-get-group-objC (meta-list)
240 (nth 4 (car meta-list))) 247 (nth 4 (car meta-list)))
241 (defsubst ediff-get-group-merge-autostore-dir (meta-list) 248 (defsubst ediff-get-group-merge-autostore-dir (meta-list)
242 (nth 5 (car meta-list))) 249 (nth 5 (car meta-list)))
243 250
251 ;; ELT is a session meta descriptor (what is being preserved as
252 ;; 'ediff-meta-info)
253 ;; The structure is: (SESSION-CTL-BUFFER STATUS OBJA OBJB OBJC)
254 ;; STATUS is ?I, ?*, ?H
255 ;; OBJA/B/C is (FILENAME EQSTATUS)
256 ;; EQSTATUS is ?= or nil (?= means that this file is equal to some other
257 ;; file in this session)
244 ;; session buffer 258 ;; session buffer
245 (defsubst ediff-get-session-buffer (elt) 259 (defsubst ediff-get-session-buffer (elt)
246 (nth 0 elt)) 260 (nth 0 elt))
247 (defsubst ediff-get-session-status (elt) 261 (defsubst ediff-get-session-status (elt)
248 (nth 1 elt)) 262 (nth 1 elt))
1261 ))) 1275 )))
1262 1276
1263 ;; Sets overlay around a meta record with 'ediff-meta-info property PROP 1277 ;; Sets overlay around a meta record with 'ediff-meta-info property PROP
1264 ;; If optional SESSION-NUMBER, make it a property of the overlay, 1278 ;; If optional SESSION-NUMBER, make it a property of the overlay,
1265 ;; ediff-meta-session-number 1279 ;; ediff-meta-session-number
1280 ;; PROP is either the ctl or meta buffer (used when we work with the registry)
1281 ;; or a session meta descriptor of the form
1282 ;; (SESSION-CTL-BUFFER STATUS OBJA OBJB OBJC)
1266 (defun ediff-set-meta-overlay (b e prop &optional session-number hidden) 1283 (defun ediff-set-meta-overlay (b e prop &optional session-number hidden)
1267 (let (overl) 1284 (let (overl)
1268 (setq overl (ediff-make-overlay b e)) 1285 (setq overl (ediff-make-overlay b e))
1269 (if ediff-emacs-p 1286 (if ediff-emacs-p
1270 (ediff-overlay-put overl 'mouse-face 'highlight) 1287 (ediff-overlay-put overl 'mouse-face 'highlight)
1962 (setq result 1979 (setq result
1963 (if (setq tmp (extent-at point buf 'ediff-meta-info)) 1980 (if (setq tmp (extent-at point buf 'ediff-meta-info))
1964 (ediff-overlay-get tmp 'ediff-meta-info))) 1981 (ediff-overlay-get tmp 'ediff-meta-info)))
1965 (setq olist (overlays-at point)) 1982 (setq olist (overlays-at point))
1966 (setq olist 1983 (setq olist
1967 (mapcar (lambda (elt) (overlay-get elt 'ediff-meta-info)) 1984 (mapcar (lambda (elt)
1985 (unless (overlay-get elt 'invisible)
1986 (overlay-get elt 'ediff-meta-info)))
1968 olist)) 1987 olist))
1969 (while (and olist 1988 (while (and olist (null (car olist)))
1970 (or (null (car olist))
1971 (and (overlayp (car olist))
1972 (overlay-get (car olist) 'invisible))))
1973 (setq olist (cdr olist))) 1989 (setq olist (cdr olist)))
1974 (setq result (car olist))))) 1990 (setq result (car olist)))))
1975 (if result 1991 (if result
1976 result 1992 result
1977 (if noerror 1993 (if noerror