Function: emerge-files-with-ancestor-internal

emerge-files-with-ancestor-internal is a byte-compiled function defined in emerge.el.gz.

Signature

(emerge-files-with-ancestor-internal FILE-A FILE-B FILE-ANCESTOR &optional STARTUP-HOOKS QUIT-HOOKS OUTPUT-FILE)

Source Code

;; Defined in /usr/src/emacs/lisp/vc/emerge.el.gz
;;; Top-level and setup functions for three-file mode.

(defun emerge-files-with-ancestor-internal (file-A file-B file-ancestor
					    &optional startup-hooks quit-hooks
					    output-file)
  (if (not (file-readable-p file-A))
      (error "File `%s' does not exist or is not readable" file-A))
  (if (not (file-readable-p file-B))
      (error "File `%s' does not exist or is not readable" file-B))
  (if (not (file-readable-p file-ancestor))
      (error "File `%s' does not exist or is not readable" file-ancestor))
  (let ((buffer-A (find-file-noselect file-A))
	(buffer-B (find-file-noselect file-B))
	(buffer-ancestor (find-file-noselect file-ancestor)))
    ;; Record the directories of the files
    (setq emerge-last-dir-A (file-name-directory file-A))
    (setq emerge-last-dir-B (file-name-directory file-B))
    (setq emerge-last-dir-ancestor (file-name-directory file-ancestor))
    (if output-file
	(setq emerge-last-dir-output (file-name-directory output-file)))
    ;; Make sure the entire files are seen, and they reflect what is on disk
    (with-current-buffer
     buffer-A
     (widen)
     (let ((temp (file-local-copy file-A)))
       (if temp
	   (setq file-A temp
		 startup-hooks
		 (cons (lambda () (delete-file file-A))
		       startup-hooks))
           ;; Verify that the file matches the buffer
           (emerge-verify-file-buffer))))
    (with-current-buffer
     buffer-B
     (widen)
     (let ((temp (file-local-copy file-B)))
       (if temp
	   (setq file-B temp
		 startup-hooks
		 (cons (lambda () (delete-file file-B))
		       startup-hooks))
           ;; Verify that the file matches the buffer
           (emerge-verify-file-buffer))))
    (with-current-buffer
     buffer-ancestor
     (widen)
     (let ((temp (file-local-copy file-ancestor)))
       (if temp
	   (setq file-ancestor temp
		 startup-hooks
		 (cons (lambda () (delete-file file-ancestor))
		       startup-hooks))
           ;; Verify that the file matches the buffer
           (emerge-verify-file-buffer))))
    (emerge-setup-with-ancestor buffer-A file-A buffer-B file-B
				buffer-ancestor file-ancestor
				startup-hooks quit-hooks output-file)))