Function: ediff-patch-file

ediff-patch-file is an autoloaded, interactive and byte-compiled function defined in ediff.el.gz.

Signature

(ediff-patch-file &optional ARG PATCH-BUF)

Documentation

Query for a file name, and then run Ediff by patching that file.

If optional PATCH-BUF is given, use the patch in that buffer and don't ask the user. If prefix argument ARG, then: if even argument, assume that the patch is in a buffer. If odd -- assume it is in a file.

Key Bindings

Aliases

epatch

Source Code

;; Defined in /usr/src/emacs/lisp/vc/ediff.el.gz
;;;###autoload
(defun ediff-patch-file (&optional arg patch-buf)
  "Query for a file name, and then run Ediff by patching that file.
If optional PATCH-BUF is given, use the patch in that buffer
and don't ask the user.
If prefix argument ARG, then: if even argument, assume that the
patch is in a buffer.  If odd -- assume it is in a file."
  (interactive "P")
  (let (source-dir source-file)
    (require 'ediff-ptch)
    (setq patch-buf
	  (ediff-get-patch-buffer
	   (and arg (prefix-numeric-value arg))
           (and patch-buf (get-buffer patch-buf))))
    (setq source-dir (cond (ediff-use-last-dir ediff-last-dir-patch)
			   ((and (not ediff-patch-default-directory)
				 (buffer-file-name patch-buf))
			    (file-name-directory
			     (expand-file-name
			      (buffer-file-name patch-buf))))
			   (t default-directory)))
    (setq source-file
	  (read-file-name
	   "File to patch (directory, if multifile patch): "
	   ;; use an explicit initial file
	   source-dir nil nil (ediff-get-default-file-name)))
    (ediff-dispatch-file-patching-job patch-buf source-file)))