unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#24586: 24.5; `find-file' for non-existent file a.jpg should not complain
@ 2016-10-02 16:27 Drew Adams
  2016-10-05  0:04 ` npostavs
  2020-08-20 21:01 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 3+ messages in thread
From: Drew Adams @ 2016-10-02 16:27 UTC (permalink / raw)
  To: 24586

emacs -Q

C-x C-f a.jpg     ; Where file `a.jpg' does not exist

This presents these error/warning messages, but it does not raise an
error:

  Type C-c C-c to view the image as an image.
  Cannot display image: (Cannot determine image type)

This seems wrong, because the file does not exist.  If you are trying to
create an ordinary text file that happens to match an image-file name
pattern, you should be able to do so, without getting such messages.  It
could be helpful to instead get a message confirming that this is in
fact what you are doing.

Or if it is considered wrong to do that then Emacs should raise an
error.

IOW, either raise an error, if you are not allowed to create a new file
whose name matches an image file, or else show a different message,
saying, e.g., that no such image file exists and the buffer is therefore
not in image mode (and it should in that case not be put in image mode).

It seems wrong to both put the new buffer for the non-existent file in
image mode and to complain that Emacs cannot display the image.  And
the first message, about typing C-c C-c seems doubly inappropriate.


In GNU Emacs 24.5.1 (i686-pc-mingw32)
 of 2015-04-11 on LEG570
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
 `configure --prefix=/c/usr --host=i686-pc-mingw32'





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#24586: 24.5; `find-file' for non-existent file a.jpg should not complain
  2016-10-02 16:27 bug#24586: 24.5; `find-file' for non-existent file a.jpg should not complain Drew Adams
@ 2016-10-05  0:04 ` npostavs
  2020-08-20 21:01 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 3+ messages in thread
From: npostavs @ 2016-10-05  0:04 UTC (permalink / raw)
  To: Drew Adams; +Cc: 24586

severity 24586 minor
quit

Drew Adams <drew.adams@oracle.com> writes:

> emacs -Q
>
> C-x C-f a.jpg     ; Where file `a.jpg' does not exist
>
> This presents these error/warning messages, but it does not raise an
> error:
>
>   Type C-c C-c to view the image as an image.
>   Cannot display image: (Cannot determine image type)
>
> This seems wrong, because the file does not exist.  If you are trying to
> create an ordinary text file that happens to match an image-file name
> pattern, you should be able to do so, without getting such messages.  It
> could be helpful to instead get a message confirming that this is in
> fact what you are doing.
>
> Or if it is considered wrong to do that then Emacs should raise an
> error.
>
> IOW, either raise an error, if you are not allowed to create a new file
> whose name matches an image file, or else show a different message,
> saying, e.g., that no such image file exists and the buffer is therefore
> not in image mode (and it should in that case not be put in image mode).
>
> It seems wrong to both put the new buffer for the non-existent file in
> image mode and to complain that Emacs cannot display the image.  And
> the first message, about typing C-c C-c seems doubly inappropriate.

But then what would a user who wants to type the raw jpeg bytes into a
buffer and use C-c C-c to check the result do? ;)

Possible solutions:

1. Use the content-based magic-mode-alist to recognize images instead of
the filename-based auto-mode-alist.

2. Add a check to `image-mode' for an empty buffer and stay in
fundamental-mode in that case.





^ permalink raw reply	[flat|nested] 3+ messages in thread

* bug#24586: 24.5; `find-file' for non-existent file a.jpg should not complain
  2016-10-02 16:27 bug#24586: 24.5; `find-file' for non-existent file a.jpg should not complain Drew Adams
  2016-10-05  0:04 ` npostavs
@ 2020-08-20 21:01 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2020-08-20 21:01 UTC (permalink / raw)
  To: Drew Adams; +Cc: 24586

Drew Adams <drew.adams@oracle.com> writes:

> emacs -Q
>
> C-x C-f a.jpg     ; Where file `a.jpg' does not exist
>
> This presents these error/warning messages, but it does not raise an
> error:
>
>   Type C-c C-c to view the image as an image.
>   Cannot display image: (Cannot determine image type)

This is fixed in Emacs 28 now.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-20 21:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-10-02 16:27 bug#24586: 24.5; `find-file' for non-existent file a.jpg should not complain Drew Adams
2016-10-05  0:04 ` npostavs
2020-08-20 21:01 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).