Subject: Re: bug#2058: 23.0.60; bewildering behavior when visit new file throw.pdf

From: Tassilo Horn <[email-masked]>
Date: Tue, 27 Jan 2009 10:55:40 +0100

"Drew Adams" <[email-masked]> writes:

Hi Drew,

> emacs -Q
>  
> I did C-x C-f throw.pdf, with no existing file throw.pdf. The ensuing
> messages and interaction were bewildering.

Is that really a use-case?

> An extremely long message appeared in the echo area:
> "No image (png) support available or some conversion utility for pdf
> files is missing.  Type C-c C-c to switch to an editing mode or C-c
> C-t to open a buffer showing the doc as text."
>  
> But the new, empty file throw.pdf appeared to be visited with no
> problem. I tried to type into it. That threw me back to the previous
> buffer I had been in (Dired), and crazy error msgs were displayed.

The buffer was in doc-view-mode which has its own keymap, and most
probably you've hit k or q, which kills/buries the buffer.

> I tried again, and this time I tried to type `C-c C-t', since the 
> message indicated that that would open the buffer as text. That too
> led to errors.

Yeah, in the background it tries to run pdftotext on the pdf, to extract
the plain text contents.

> I don't know exactly what happened, but you will, as soon as you try
> it. ;-)

Sure.  So what's your advice how to handle this situation?  Check if the
file is existent (and non-empty) and if not, print a message and
fallback to fundamental mode?

Bye,
Tassilo