Function: ibuffer-diff-buffer-with-file-1

ibuffer-diff-buffer-with-file-1 is a byte-compiled function defined in ibuf-ext.el.gz.

Signature

(ibuffer-diff-buffer-with-file-1 BUFFER)

Documentation

Compare BUFFER with its associated file, if any.

Unlike diff-no-select, insert output into current buffer without erasing it.

Source Code

;; Defined in /usr/src/emacs/lisp/ibuf-ext.el.gz
(defun ibuffer-diff-buffer-with-file-1 (buffer)
  "Compare BUFFER with its associated file, if any.
Unlike `diff-no-select', insert output into current buffer
without erasing it."
  (when-let* ((old (buffer-file-name buffer)))
    (defvar diff-use-labels)
    (let* ((new buffer)
           (oldtmp (diff-file-local-copy old))
           (newtmp (diff-file-local-copy new))
           (switches diff-switches)
           (command
            (string-join
             `(,diff-command
               ,@(if (listp switches) switches (list switches))
               ,@(and (eq diff-use-labels t)
                      (list "--label" (shell-quote-argument old)
                            "--label" (shell-quote-argument (format "%S" new))))
               ,(shell-quote-argument (or oldtmp old))
               ,(shell-quote-argument (or newtmp new)))
             " "))
           (inhibit-read-only t))
      (insert ?\n command ?\n)
      (diff-sentinel (call-process shell-file-name nil t nil
                                   shell-command-switch command)
                     oldtmp newtmp)
      (goto-char (point-max)))
    (redisplay)))