]> git.eshelyaron.com Git - emacs.git/commitdiff
Check that the buffer in diff-buffer-with-file is visiting a file
authorDaniel Martín <mardani29@yahoo.es>
Tue, 15 Sep 2020 12:56:10 +0000 (14:56 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Tue, 15 Sep 2020 12:56:10 +0000 (14:56 +0200)
* lisp/vc/diff.el (diff-buffer-with-file): Signal a specific error
when the buffer passed to diff-buffer-with-file is not visiting a
file (bug#43401).

lisp/vc/diff.el

index 469888078c467c30eee3063db864f87445040487..b7f17bf3c73de579f3dea101220bc74864c1af1e 100644 (file)
@@ -258,6 +258,8 @@ This requires the external program `diff' to be in your `exec-path'."
   (interactive "bBuffer: ")
   (let ((buf (get-buffer (or buffer (current-buffer)))))
     (with-current-buffer (or (buffer-base-buffer buf) buf)
+      (unless buffer-file-name
+        (error "Buffer is not visiting a file"))
       (diff buffer-file-name (current-buffer) nil 'noasync))))
 
 ;;;###autoload