1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-26 19:18:50 +00:00

(ibuffer-diff-with-file): Just call `diff-buffer-with-file'.

This commit is contained in:
Colin Walters 2002-09-07 21:31:03 +00:00
parent 5840a0d4d3
commit 125c108147
2 changed files with 7 additions and 33 deletions

View File

@ -6,7 +6,11 @@
* diff.el (diff): Add optional argument no-async, and use the
above argument.
* files.el (diff-buffer-with-file): Use it.
* files.el (diff-buffer-with-file): Call diff synchronously, so we
don't delete the temporary file before diff has a chance to read
it.
* ibuf-ext.el (ibuffer-diff-with-file): Just call `diff-buffer-with-file'.
2002-09-07 John Paul Wallington <jpw@shootybangbang.com>

View File

@ -1221,40 +1221,10 @@ to move by. The default is `ibuffer-marked-char'."
"View the differences between this buffer and its associated file.
This requires the external program \"diff\" to be in your `exec-path'."
(interactive)
(let* ((buf (ibuffer-current-buffer))
(buf-filename (with-current-buffer buf
buffer-file-name)))
(let ((buf (ibuffer-current-buffer)))
(unless (buffer-live-p buf)
(error "Buffer %s has been killed" buf))
(unless buf-filename
(error "Buffer %s has no associated file" buf))
(let ((diff-buf (get-buffer-create "*Ibuffer-diff*")))
(with-current-buffer diff-buf
(setq buffer-read-only nil)
(erase-buffer))
(let ((tempfile (make-temp-file "ibuffer-diff-")))
(unwind-protect
(progn
(with-current-buffer buf
(write-region (point-min) (point-max) tempfile nil 'nomessage))
(if (zerop
(apply #'call-process "diff" nil diff-buf nil
(append
(when (and (boundp 'ediff-custom-diff-options)
(stringp ediff-custom-diff-options))
(list ediff-custom-diff-options))
(list buf-filename tempfile))))
(message "No differences found")
(progn
(with-current-buffer diff-buf
(goto-char (point-min))
(if (fboundp 'diff-mode)
(diff-mode)
(fundamental-mode)))
(display-buffer diff-buf))))
(when (file-exists-p tempfile)
(delete-file tempfile)))))
nil))
(diff-buffer-with-file buf)))
;;;###autoload
(defun ibuffer-copy-filename-as-kill (&optional arg)