Function: ediff-patch-file-form-meta

ediff-patch-file-form-meta is a byte-compiled function defined in ediff-mult.el.gz.

Signature

(ediff-patch-file-form-meta FILE &optional STARTUP-HOOKS)

Source Code

;; Defined in /usr/src/emacs/lisp/vc/ediff-mult.el.gz
;; this is the action invoked when the user selects a patch from the meta
;; buffer.
(defun ediff-patch-file-form-meta (file &optional startup-hooks)
  (let* ((pos (ediff-event-point last-command-event))
	 (meta-buf (ediff-event-buffer last-command-event))
	 ;; ediff-get-meta-info gives error if meta-buf or pos are invalid
	 (info (ediff-get-meta-info meta-buf pos))
	 (meta-patchbuf ediff-meta-patchbufer)
	 session-buf beg-marker end-marker)

    (if (or (file-directory-p file) (string-match null-device file))
	(user-error "`%s' is not an ordinary file" (file-name-as-directory file)))
    (setq session-buf (ediff-get-session-buffer info)
	  beg-marker (ediff-get-session-objB-name info)
	  end-marker (ediff-get-session-objC-name info))

    (or (ediff-buffer-live-p session-buf) ; either an active patch session
	(null session-buf)                ; or it is a virgin session
	(error
	 "Patch has already been applied to this file -- can't repeat!"))

    (ediff-with-current-buffer meta-patchbuf
      (save-restriction
	(widen)
	(narrow-to-region beg-marker end-marker)
	(ediff-patch-file-internal meta-patchbuf file startup-hooks)))))