Function: ediff-revision

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

Signature

(ediff-revision &optional FILE STARTUP-HOOKS)

Documentation

Run Ediff by comparing versions of a file.

The file is an optional FILE argument or the file entered at the prompt. Default: the file visited by the current buffer. Uses vc.el or rcs.el depending on ediff-version-control-package. STARTUP-HOOKS is a list of functions that Emacs calls without arguments after setting up the Ediff buffers.

Probably introduced at or before Emacs version 19.29.

Key Bindings

Aliases

erevision

Source Code

;; Defined in /usr/src/emacs/lisp/vc/ediff.el.gz
;;; Versions Control functions

;;;###autoload
(defun ediff-revision (&optional file startup-hooks)
  "Run Ediff by comparing versions of a file.
The file is an optional FILE argument or the file entered at the prompt.
Default: the file visited by the current buffer.
Uses `vc.el' or `rcs.el' depending on `ediff-version-control-package'.
STARTUP-HOOKS is a list of functions that Emacs calls without
arguments after setting up the Ediff buffers."
  ;; if buffer is non-nil, use that buffer instead of the current buffer
  (interactive "P")
  (if (not (stringp file))
    (setq file
	  (ediff-read-file-name "Compare revisions for file"
				(if ediff-use-last-dir
				    ediff-last-dir-A
				  default-directory)
				(ediff-get-default-file-name)
				'no-dirs)))
  (find-file file)
  (if (and (buffer-modified-p)
	   (y-or-n-p (format "Buffer %s is modified.  Save buffer? "
                             (buffer-name))))
      (save-buffer (current-buffer)))
  (let (rev1 rev2)
    (setq rev1
	  (read-string (format-prompt "Revision 1 to compare"
                                      (concat (file-name-nondirectory file)
                                              "'s latest revision")))
	  rev2
	  (read-string
	   (format-prompt "Revision 2 to compare"
                          (concat (file-name-nondirectory file)
                                  "'s current state"))))
    (ediff-load-version-control)
    (funcall
     (intern (format "ediff-%S-internal" ediff-version-control-package))
     rev1 rev2 startup-hooks)
    ))