Subject: bug#33241: image-mode in non-file buffer

From: Eli Zaretskii <[email-masked]>
Date: Sat, 03 Nov 2018 11:33:45 +0200

> From: Evgeny Zajcev <[email-masked]>
> Date: Fri, 2 Nov 2018 14:37:26 +0300
> 
> I've got problems with image-mode triggered by scad-preview, but I have tiny code example to trigger it:
> 
>     (pop-to-buffer
>      (with-current-buffer (get-buffer-create "mybuf")
>        (insert-file-contents "~/pics/nav1.jpg")
>        (major-mode-suspend)
>        (setq major-mode 'image-mode)
>        (image-toggle-display-image)
>        (current-buffer)))
> 
> ===>
> Debugger entered--Lisp error: (wrong-type-argument stringp nil)
>   file-name-nondirectory(nil)
>   file-name-extension(nil)
>   image--imagemagick-wanted-p(nil)

But image-mode is for visiting image _files_, so why does it make
sense to turn it on in a buffer that doesn't have an associated file
name?