GNU bug report logs - #2077
23.0.60; error raised if visit new, empty file foo.jpeg

Previous Next

Package: emacs;

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

Date: Mon, 26 Jan 2009 22:40:04 UTC

Severity: normal

Done: "Drew Adams" <drew.adams <at> oracle.com>

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 2077 in the body.
You can then email your comments to 2077 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-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>:
bug#2077; Package emacs. (Mon, 26 Jan 2009 22:40:04 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 Emacs Bugs <bug-gnu-emacs <at> gnu.org>. (Mon, 26 Jan 2009 22:40:04 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: <emacs-pretest-bug <at> gnu.org>
Subject: 23.0.60; error raised if visit new, empty file foo.jpeg
Date: Mon, 26 Jan 2009 14:32:56 -0800
This is similar to bug #2058, but the error raised here is much less
bewildering. ;-)
 
emacs -Q
 
C-x C-f foo.jpeg
 
That raises this error:
"File mode specification error: (error "Cannot determine image type")"
 
I don't think an error should be raised until the buffer is saved. I
could be wrong about that.  In any case, the error message should be
something more appropriate.
 

In GNU Emacs 23.0.60.1 (i386-mingw-nt5.1.2600)
 of 2009-01-04 on LENNART-69DE564
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.4) --no-opt --cflags -Ic:/g/include
-fno-crossjumping'
 





Reply sent to Chong Yidong <cyd <at> stupidchicken.com>:
You have taken responsibility. (Tue, 27 Jan 2009 15:00:03 GMT) Full text and rfc822 format available.

Notification sent to "Drew Adams" <drew.adams <at> oracle.com>:
bug acknowledged by developer. (Tue, 27 Jan 2009 15:00:04 GMT) Full text and rfc822 format available.

Message #10 received at 2077-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Chong Yidong <cyd <at> stupidchicken.com>
To: "Drew Adams" <drew.adams <at> oracle.com>
Cc: 2077-done <at> debbugs.gnu.org
Subject: Re: 23.0.60; error raised if visit new, empty file foo.jpeg
Date: Tue, 27 Jan 2009 09:54:34 -0500
> emacs -Q
> 
> C-x C-f foo.jpeg
> 
> That raises this error:
> "File mode specification error: (error "Cannot determine image type")"
> 
> I don't think an error should be raised until the buffer is saved.  I
> could be wrong about that.  In any case, the error message should be
> something more appropriate.

The error occurs because Emacs is trying to display the image, and is
unable to do so.  It has nothing to do with saving the buffer.

Note that image-mode does not assume that the file is in jpeg format
based on the file name alone: it examines the file contents as well.  We
could, in principle, replace this error message with a more generic
message, but that would be less helpful for debugging.




bug reopened, originator not changed. Request was from "Drew Adams" <drew.adams <at> oracle.com> to control <at> emacsbugs.donarmstrong.com. (Tue, 27 Jan 2009 15:55:03 GMT) Full text and rfc822 format available.

Reply sent to "Drew Adams" <drew.adams <at> oracle.com>:
You have taken responsibility. (Tue, 27 Jan 2009 15:55:05 GMT) Full text and rfc822 format available.

Notification sent to "Drew Adams" <drew.adams <at> oracle.com>:
bug acknowledged by developer. (Tue, 27 Jan 2009 15:55:05 GMT) Full text and rfc822 format available.

Message #17 received at 2077-done <at> emacsbugs.donarmstrong.com (full text, mbox):

From: "Drew Adams" <drew.adams <at> oracle.com>
To: "'Chong Yidong'" <cyd <at> stupidchicken.com>
Cc: <2077-done <at> debbugs.gnu.org>
Subject: RE: 23.0.60; error raised if visit new, empty file foo.jpeg
Date: Tue, 27 Jan 2009 07:45:31 -0800
> > emacs -Q
> > 
> > C-x C-f foo.jpeg
> > 
> > That raises this error:
> > "File mode specification error: (error "Cannot determine 
> > image type")"
> > 
> > I don't think an error should be raised until the buffer is 
> > saved.  I could be wrong about that.  In any case, the error
> > message should be something more appropriate.
> 
> The error occurs because Emacs is trying to display the image, and is
> unable to do so.

Yes, I know.

> It has nothing to do with saving the buffer.

I see. Will Emacs display an unsaved image file buffer? I was thinking that
image mode (or whatever it is) is reserved for existing files. That's why I
mentioned saving.

There are two possible cases here: (1) a new, empty file buffer and (2) an
existing empty file.

> Note that image-mode does not assume that the file is in jpeg format
> based on the file name alone: it examines the file contents 
> as well.  We could, in principle, replace this error message with a
> more generic message, but that would be less helpful for debugging.

It should be replaced with a more _specific_ message, saying that (1) the file
does not exist or (2) that the file is empty.

A user who knows nothing of image mode or images and mistakenly types foo.jpeg
instead of foo.jpem (local to his organization) gets an inappropriate message.
What s?he should be told is that (1) image mode is used, by default, for *.jpeg
(`auto-mode-alist'), and (2) the file does not exist (if new) or is empty (if
existing).

Another case is what happens if a user visits a non-empty text file named
foo.jpeg? Again, the buffer should be put in fundamental mode and an error
message raised. The message should say that *.jpeg is associated with image
mode, but this is not a well-formed JPEG file. IOW, the not-valid-PDF message
must make sense also to a user unfamiliar with images.

If you want to give additional info about the invalid JPEG in the case of a
normal bad-JPEG file, then consider giving first such a short message, but
mention that the user can hit some key for more information. When s?he hits that
key, pop up a buffer with the detailed diagnosis for the bad JPEG.

See the discussion for bug #2058.





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> emacsbugs.donarmstrong.com. (Wed, 25 Feb 2009 15:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 16 years and 196 days ago.

Previous Next


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