diff options
author | Eli Zaretskii <eliz@gnu.org> | 2022-02-21 14:51:37 +0200 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2022-02-21 14:51:37 +0200 |
commit | b38223a844caef920c2cd2c6e56e84b0c91df1fa (patch) | |
tree | 586ffe78a891276b9ed5141e639fae40146072e2 /lisp/image-mode.el | |
parent | b7a651ba3787ab8257e35f93f754c4455fc8dba4 (diff) | |
download | emacs-b38223a844caef920c2cd2c6e56e84b0c91df1fa.tar.gz emacs-b38223a844caef920c2cd2c6e56e84b0c91df1fa.tar.bz2 emacs-b38223a844caef920c2cd2c6e56e84b0c91df1fa.zip |
A friendlier error message from image-mode in an empty buffer
* lisp/image-mode.el (image-mode): Handle the case where the empty
buffer doesn't visit a file (Bug#54084)
Diffstat (limited to 'lisp/image-mode.el')
-rw-r--r-- | lisp/image-mode.el | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lisp/image-mode.el b/lisp/image-mode.el index b87cf213d7e..1eb7cd58c3d 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el @@ -621,9 +621,11 @@ Key bindings: ;; Bail out early if we have no image data. (if (zerop (buffer-size)) (funcall (if (called-interactively-p 'any) 'error 'message) - (if (file-exists-p buffer-file-name) - "Empty file" - "(New file)")) + (if (stringp buffer-file-name) + (if (file-exists-p buffer-file-name) + "Empty file" + "(New file)") + "Empty buffer")) (image-mode--display))) (defun image-mode--display () |