Function: diff-file-local-copy

diff-file-local-copy is a byte-compiled function defined in diff.el.gz.

Signature

(diff-file-local-copy FILE-OR-BUF)

Documentation

Like file-local-copy but also supports a buffer as the argument.

When FILE-OR-BUF is a buffer, return the filename of a local temporary file with the buffer's contents.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/diff.el.gz
(defun diff-file-local-copy (file-or-buf)
  "Like `file-local-copy' but also supports a buffer as the argument.
When FILE-OR-BUF is a buffer, return the filename of a local
temporary file with the buffer's contents."
  (if (bufferp file-or-buf)
      (with-current-buffer file-or-buf
        (let ((tempfile (make-temp-file "buffer-content-"))
              (coding-system-for-write (or diff--coding-system-for-buffer
                                           coding-system-for-write)))
          (if diff-entire-buffers
              (write-region nil nil tempfile nil 'nomessage)
            (write-region (point-min) (point-max) tempfile nil 'nomessage))
          tempfile))
    (file-local-copy file-or-buf)))