Function: vc-region-history

vc-region-history is an autoloaded, interactive and byte-compiled function defined in vc.el.gz.

Signature

(vc-region-history FROM TO)

Documentation

Show the history of the region between FROM and TO.

If called interactively, show the history between point and mark.

View in manual

Probably introduced at or before Emacs version 25.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/vc/vc.el.gz
;;;###autoload
(defun vc-region-history (from to)
  "Show the history of the region between FROM and TO.

If called interactively, show the history between point and
mark."
  (interactive "r")
  (let* ((lfrom (line-number-at-pos from t))
         (lto   (line-number-at-pos (1- to) t))
         (file buffer-file-name)
         (backend (vc-backend file))
         (buf (get-buffer-create "*VC-history*")))
    (unless backend
      (error "Buffer is not version controlled"))
    (with-current-buffer buf
      (setq-local vc-log-view-type 'long))
    (vc-call region-history file buf lfrom lto)
    (with-current-buffer buf
      (vc-call-backend backend 'region-history-mode)
      (setq-local log-view-vc-backend backend)
      (setq-local log-view-vc-fileset (list file))
      (setq-local revert-buffer-function
                  (lambda (_ignore-auto _noconfirm)
                    (with-current-buffer buf
                      (let ((inhibit-read-only t)) (erase-buffer)))
                    (vc-call region-history file buf lfrom lto))))
    (display-buffer buf)))