-;;; ediff-meta.el --- support for multi-file/multi-buffer processing in Ediff
-;;; Copyright (C) 1995 Free Software Foundation, Inc.
+;;; ediff-mult.el --- support for multi-file/multi-buffer processing in Ediff
+
+;; Copyright (C) 1995 Free Software Foundation, Inc.
;; Author: Michael Kifer <kifer@cs.sunysb.edu>
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING. If not, write to
-;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+;; along with GNU Emacs; see the file COPYING. If not, write to the
+;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
-;;; Notes:
-;;
-;; Users are strongly encourage to add functionality to this file.
+;;; Commentary:
+
+;; Users are strongly encouraged to add functionality to this file.
;; In particular, epatch needs to be enhanced to work with multi-file
;; patches. The present file contains all the infrastructure needed for that.
;;
;; Actually, the format of this list is pretty much up to the
;; developer. The only thing is that it must be a list of lists.
;; Also, keep in mind that the function ediff-prepare-meta-buffer
-;; (which see) prepends nil in fron of each list (i.e., the above list
+;; (which see) prepends nil in front of each list (i.e., the above list
;; will become ((nil obj1 obj2 ...) (nil ...) ...).
;; Ediff expects that your function (in 2 above) will arrange to
;; replace this prepended nil (via setcar) with the actual ediff
;; that do the layout of the meta- and differences buffers and of
;; ediff-dir-action.
+;;; Code:
+
(require 'ediff-init)
;; meta-buffer
;; ((dir1 dir2 dir3) (file . num) (file . num)...)
;; where num encodes the set of dirs where the file is found:
;; 2 - only dir1; 3 - only dir2; 5 - only dir3; 6 - dir1&2; 10 - dir1&3; etc.
-(defun ediff-intersect-directories (jobname diff-var regexp dir1 dir2
- &optional dir3 comparison-func)
- (require 'cl)
+(defun ediff-intersect-directories (jobname
+ diff-var regexp dir1 dir2
+ &optional dir3 comparison-func)
(setq comparison-func (or comparison-func 'string=))
(let (lis1 lis2 lis3 common auxdir1 auxdir2 auxdir3 difflist)
(setq lis1 (delete "." lis1)
lis1 (delete ".." lis1))
- (setq common (intersection lis1 lis2 :test comparison-func))
+ (setq common (ediff-intersection lis1 lis2 comparison-func))
;; get rid of files that are directories in dir1 but not dir2
(mapcar (function (lambda (elt)
(if (Xor (file-directory-p (concat auxdir1 elt))
(setq common (delq elt common)))))
common)
;; intersect with the third dir
- (if lis3 (setq common (intersection common lis3 :test comparison-func)))
+ (if lis3 (setq common (ediff-intersection common lis3 comparison-func)))
(if (ediff-comparison-metajob3 jobname)
(mapcar (function (lambda (elt)
(if (Xor (file-directory-p (concat auxdir1 elt))
(setq common (delq elt common)))))
common))
- ;; trying to avoid side effects of sorting
- (setq common (sort (copy-list common) 'string-lessp))
+ ;; copying is needed because sort sorts via side effects
+ (setq common (sort (ediff-copy-list common) 'string-lessp))
;; compute difference list
- (setq difflist (set-difference
- (union (union lis1 lis2 :test comparison-func)
- lis3
- :test comparison-func)
+ (setq difflist (ediff-set-difference
+ (ediff-union (ediff-union lis1 lis2 comparison-func)
+ lis3
+ comparison-func)
common
- :test comparison-func)
+ comparison-func)
difflist (delete "." difflist)
- ;; copy-list needed because sort sorts it by side effects
- difflist (sort (copy-list (delete ".." difflist)) 'string-lessp))
+ ;; copying is needed because sort sorts via side effects
+ difflist (sort (ediff-copy-list (delete ".." difflist))
+ 'string-lessp))
(setq difflist (mapcar (function (lambda (elt) (cons elt 1))) difflist))
;; find directory files that are under revision.
;; display subdirectories, too, since we may visit them recursively.
(defun ediff-get-directory-files-under-revision (jobname regexp dir1)
- (require 'cl)
(let (lis1 elt common auxdir1)
(setq auxdir1 (file-name-as-directory dir1)
lis1 (directory-files auxdir1 nil regexp))
(cond ((file-directory-p (concat auxdir1 elt))
(setq common (cons elt common)))
((file-exists-p (concat auxdir1 elt ",v"))
- (setq common (cons elt common))))
+ (setq common (cons elt common)))
+ ((file-exists-p (concat auxdir1 "RCS/" elt ",v"))
+ (setq common (cons elt common)))
+ ) ; cond
) ; while
(setq common (delete "." common)
common (delete ".." common))
- ;; trying to avoid side effects of sorting
- (setq common (sort (copy-list common) 'string-lessp))
+ ;; copying is needed because sort sorts via side effects
+ (setq common (sort (ediff-copy-list common) 'string-lessp))
;; return result
(cons (list regexp auxdir1 nil nil)
(if (ediff-buffer-live-p session-buf)
(ediff-eval-in-buffer session-buf
(if (eq ediff-control-buffer session-buf) ; individual session
- (setq custom-diff-buf ediff-custom-diff-buffer))))
+ (progn
+ (ediff-compute-custom-diffs-maybe)
+ (setq custom-diff-buf ediff-custom-diff-buffer)))))
(or (ediff-buffer-live-p meta-diff-buff)
(error "Ediff: something wrong--no multiple diffs buffer"))
(goto-char (point-max))
(insert-buffer custom-diff-buf)
(insert "\n")))
- ((eq metajob 'ediff-directories)
+ ((memq metajob '(ediff-directories
+ ediff-merge-directories
+ ediff-merge-directories-with-ancestor))
;; get diffs by calling shell command on ediff-custom-diff-program
(save-excursion
(set-buffer (setq tmp-buf (get-buffer-create ediff-tmp-buffer)))
(insert-buffer tmp-buf)
(insert "\n")))
(t
- (error
- "Session %d is marked but inactive--can't make its diff"
- sessionNum)))
- ))
+ (error "Can't make context diff for Session %d" sessionNum )))
+ ))
(defun ediff-collect-custom-diffs ()
"Collect custom diffs of marked sessions in buffer `*Ediff Multifile Diffs*'.
(t (ediff-skip-unsuitable-frames 'ok-unsplittable)
(set-window-buffer (selected-window) meta-buf)))
))
- (if (ediff-window-display-p)
+ (if (and (ediff-window-display-p)
+ (window-live-p
+ (setq wind (ediff-get-visible-buffer-window meta-buf))))
(progn
- (setq frame
- (window-frame (ediff-get-visible-buffer-window meta-buf)))
+ (setq frame (window-frame wind))
(raise-frame frame)
(ediff-reset-mouse frame)))
(run-hooks 'ediff-show-session-group-hook)
(error "No active Ediff sessions or corrupted session registry"))
(let (wind frame)
;; for some reason, point moves in ediff-registry-buffer, so we preserve it
- ;; explicity
+ ;; explicitly
(ediff-eval-in-buffer ediff-registry-buffer
(save-excursion
(cond ((setq wind
(bury-buffer)
(beep)
(message
- "Group has active sessions, panel not deleted")))
+ "Session group suspended, not deleted (has active sessions)")))
(ediff-cleanup-meta-buffer parent-buf)
(ediff-kill-buffer-carefully dir-diffs-buffer)
(ediff-kill-buffer-carefully meta-diff-buffer)
(kill-buffer buf))
-;; obtain information on a meta record where the user clicked or typed
+;; Obtain information on a meta record where the user clicked or typed
;; BUF is the buffer where this happened and POINT is the position
;; If optional NOERROR arg is given, don't report error and return nil if no
;; meta info is found on line.
;;; eval: (put 'ediff-eval-in-buffer 'lisp-indent-hook 1)
;;; End:
-(provide 'ediff-meta)
+(provide 'ediff-mult)
(require 'ediff-util)
-;;; ediff-meta.el ends here
+;;; ediff-mult.el ends here