From 5fdeef8b44a4742ef9f745981e3c202a43697085 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mart=C3=ADn?= Date: Mon, 14 Sep 2020 17:58:58 +0200 Subject: [PATCH] Check that the buffer in diff-buffer-with-file is visiting a file * 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. --- lisp/vc/diff.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lisp/vc/diff.el b/lisp/vc/diff.el index 469888078c..b7f17bf3c7 100644 --- a/lisp/vc/diff.el +++ b/lisp/vc/diff.el @@ -258,6 +258,8 @@ diff-buffer-with-file (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 -- 2.28.0