Function: ediff-merge-files-with-ancestor

ediff-merge-files-with-ancestor is an autoloaded, interactive and byte-compiled function defined in ediff.el.gz.

Signature

(ediff-merge-files-with-ancestor FILE-A FILE-B FILE-ANCESTOR &optional STARTUP-HOOKS MERGE-BUFFER-FILE)

Documentation

Merge two files with ancestor.

FILE-A and FILE-B are the names of the files to be merged, and FILE-ANCESTOR is the name of the ancestor file. STARTUP-HOOKS is a list of functions that Emacs calls without arguments after setting up the Ediff buffers. MERGE-BUFFER-FILE is the name of the file to be associated with the merge buffer.

Key Bindings

Aliases

ediff-merge-with-ancestor

Source Code

;; Defined in /usr/src/emacs/lisp/vc/ediff.el.gz
;;;###autoload
(defun ediff-merge-files-with-ancestor (file-A file-B file-ancestor
					       &optional
					       startup-hooks
					       ;; MERGE-BUFFER-FILE is the file
					       ;; to be associated with the
					       ;; merge buffer
					       merge-buffer-file)
  "Merge two files with ancestor.
FILE-A and FILE-B are the names of the files to be merged, and
FILE-ANCESTOR is the name of the ancestor file.  STARTUP-HOOKS is
a list of functions that Emacs calls without arguments after
setting up the Ediff buffers.  MERGE-BUFFER-FILE is the name of
the file to be associated with the merge buffer."
  (interactive
   (let ((dir-A (if ediff-use-last-dir
		    ediff-last-dir-A
		  default-directory))
	 dir-B dir-ancestor f ff)
     (list (setq f (ediff-read-file-name
		    "File A to merge"
		    dir-A
		    (ediff-get-default-file-name)
		    'no-dirs))
	   (setq ff (ediff-read-file-name "File B to merge"
					  (setq dir-B
						(if ediff-use-last-dir
						    ediff-last-dir-B
						  (file-name-directory f)))
					  (progn
					    (add-to-history
					     'file-name-history
					     (ediff-abbreviate-file-name
					      (expand-file-name
					       (file-name-nondirectory f)
					       dir-B)))
					    (ediff-get-default-file-name f 1))))
	   (ediff-read-file-name "Ancestor file"
				 (setq dir-ancestor
				       (if ediff-use-last-dir
					   ediff-last-dir-ancestor
					 (file-name-directory ff)))
				 (progn
				   (add-to-history
				    'file-name-history
				    (ediff-abbreviate-file-name
				     (expand-file-name
				      (file-name-nondirectory ff)
				      dir-ancestor)))
				   (ediff-get-default-file-name ff 2)))
	   )))
  (setq startup-hooks (cons 'ediff-merge-on-startup startup-hooks))
  (ediff-files-internal file-A
			(if (file-directory-p file-B)
			    (expand-file-name
			     (file-name-nondirectory file-A) file-B)
			  file-B)
			  file-ancestor
			  startup-hooks
			  'ediff-merge-files-with-ancestor
			  merge-buffer-file))