GNU bug report logs - #24586
24.5; `find-file' for non-existent file a.jpg should not complain

Previous Next

Package: emacs;

Reported by: Drew Adams <drew.adams <at> oracle.com>

Date: Sun, 2 Oct 2016 16:28:02 UTC

Severity: minor

Tags: fixed

Found in version 24.5

Fixed in version 28.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 24586 in the body.
You can then email your comments to 24586 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#24586; Package emacs. (Sun, 02 Oct 2016 16:28:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Drew Adams <drew.adams <at> oracle.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 02 Oct 2016 16:28:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.5; `find-file' for non-existent file a.jpg should not complain
Date: Sun, 2 Oct 2016 09:27:31 -0700 (PDT)
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'




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24586; Package emacs. (Wed, 05 Oct 2016 00:04:02 GMT) Full text and rfc822 format available.

Message #8 received at 24586 <at> debbugs.gnu.org (full text, mbox):

From: npostavs <at> users.sourceforge.net
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 24586 <at> debbugs.gnu.org
Subject: Re: bug#24586: 24.5;
 `find-file' for non-existent file a.jpg should not complain
Date: Tue, 04 Oct 2016 20:04:22 -0400
severity 24586 minor
quit

Drew Adams <drew.adams <at> 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.




Severity set to 'minor' from 'normal' Request was from npostavs <at> users.sourceforge.net to control <at> debbugs.gnu.org. (Wed, 05 Oct 2016 00:04:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#24586; Package emacs. (Thu, 20 Aug 2020 21:02:02 GMT) Full text and rfc822 format available.

Message #13 received at 24586 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Drew Adams <drew.adams <at> oracle.com>
Cc: 24586 <at> debbugs.gnu.org
Subject: Re: bug#24586: 24.5; `find-file' for non-existent file a.jpg should
 not complain
Date: Thu, 20 Aug 2020 23:01:12 +0200
Drew Adams <drew.adams <at> 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




Added tag(s) fixed. Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 20 Aug 2020 21:02:02 GMT) Full text and rfc822 format available.

bug marked as fixed in version 28.1, send any further explanations to 24586 <at> debbugs.gnu.org and Drew Adams <drew.adams <at> oracle.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Thu, 20 Aug 2020 21:02:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 18 Sep 2020 11:24:10 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 218 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.