Function: highlight-compare-buffers

highlight-compare-buffers is an autoloaded, interactive and byte-compiled function defined in hilit-chg.el.gz.

Signature

(highlight-compare-buffers BUF-A BUF-B)

Documentation

Compare two buffers and highlight the differences.

The default is the current buffer and the one in the next window.

If either buffer is modified and is visiting a file, you are prompted to save the file.

Unless the buffer is unmodified and visiting a file, the buffer is written to a temporary file for comparison.

If a buffer is read-only, differences will be highlighted but no property changes are made, so M-x highlight-changes-next-change (highlight-changes-next-change) and M-x highlight-changes-previous-change (highlight-changes-previous-change) will not work.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/hilit-chg.el.gz
;;;###autoload
(defun highlight-compare-buffers (buf-a buf-b)
  "Compare two buffers and highlight the differences.

The default is the current buffer and the one in the next window.

If either buffer is modified and is visiting a file, you are prompted
to save the file.

Unless the buffer is unmodified and visiting a file, the buffer is
written to a temporary file for comparison.

If a buffer is read-only, differences will be highlighted but no property
changes are made, so \\[highlight-changes-next-change] and
\\[highlight-changes-previous-change] will not work."
  (interactive
   (list
    (get-buffer (read-buffer "buffer-a " (current-buffer) t))
    (get-buffer
     (read-buffer "buffer-b "
		  (window-buffer (next-window)) t))))
  (let ((file-a (buffer-file-name buf-a))
	(file-b (buffer-file-name buf-b)))
    (highlight-markup-buffers buf-a file-a buf-b file-b)))