Function: diff-buffers

diff-buffers is an autoloaded, interactive and byte-compiled function defined in diff.el.gz.

Signature

(diff-buffers OLD NEW &optional SWITCHES NO-ASYNC)

Documentation

Find and display the differences between OLD and NEW buffers.

When called interactively, read NEW, then OLD, using the minibuffer. The default for NEW is the current buffer, and the default for OLD is the most recently selected other buffer. If NO-ASYNC is non-nil, call diff synchronously.

When called interactively with a prefix argument, prompt interactively for diff switches. Otherwise, the switches specified in the variable diff-switches(var)/diff-switches(fun) are passed to the diff command.

OLD and NEW may each be a buffer or a buffer name.

Probably introduced at or before Emacs version 27.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/vc/diff.el.gz
;;;###autoload
(defun diff-buffers (old new &optional switches no-async)
  "Find and display the differences between OLD and NEW buffers.

When called interactively, read NEW, then OLD, using the
minibuffer.  The default for NEW is the current buffer, and the
default for OLD is the most recently selected other buffer.
If NO-ASYNC is non-nil, call diff synchronously.

When called interactively with a prefix argument, prompt
interactively for diff switches.  Otherwise, the switches
specified in the variable `diff-switches' are passed to the
diff command.

OLD and NEW may each be a buffer or a buffer name."
  (interactive
   (let ((newb (read-buffer "Diff new buffer" (current-buffer) t))
         (oldb (read-buffer "Diff original buffer"
                            (other-buffer (current-buffer) t) t)))
     (list oldb newb (diff-switches))))
  (diff (get-buffer old) (get-buffer new) switches no-async))