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

From: Tassilo Horn <[email-masked]>
Date: Tue, 27 Jan 2009 13:43:46 +0100

Alan Mackenzie <[email-masked]> writes:

Hi Alan,

>> > 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?
>
> No, it's an error case.  The user wanted to visit throw.ldf, which is
> a text based document format used only in his own company.  But he
> mistyped it.  He also knows nothing about png images, and really
> doesn't want to have to learn.

But how should I know that.  The best I can do is to handle non-existing
and empty files.

>> > 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.
>
> What on earth is doc-view-mode?  Hmm.  C-h f doc-view-mode <CR>.  ;-(

Emacs 23.

>> 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?
>
> Whatever is done, don't force the poor bewildered user to make a
> decision.  Perform whatever error handling is appropriate and display
> a message, and let her get out without further ado.

The message is no problem, but what to do with the open request.  Open
the (presumably) mistyped file in fundamental-mode?

> "... to switch to an editing mode " is particularly bad.  It should be
> less vague, stating the mode (text mode?).

Well, it's ps-mode for PostScript files and fundamental-mode for PDF and
DVI files.  Making that explicit would enlarge the message even more...

> "... to open a buffer showing the doc as text" would be better as "to
> show the doc as text".

Will be fixed as soon as I come to it.

Bye,
Tassilo