[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

From: Alan Mackenzie
Subject: bug#2058: 23.0.60; bewildering behavior when visit new file throw.pdf
Date: Tue, 27 Jan 2009 14:42:20 +0000
User-agent: Mutt/1.5.9i

Hi, Tassilo,

On Tue, Jan 27, 2009 at 01:43:46PM +0100, Tassilo Horn wrote:
> Alan Mackenzie <address@hidden> 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.

Does an empty/non-existent file have any meaning in this mode?  Is
doc-view-mode an editing mode as well as a viewing mode?

> >> > 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.

Yes, I know.  :-)  I was looking at the doc string in doc-view.el from
2009-01-05.  Here's the output from that C-h f:

    doc-view-mode is an interactive autoloaded Lisp function in


    Major mode in DocView buffers.
    You can use
    Uses keymap "doc-view-mode-map", which is not currently defined.
    M-x doc-view-toggle-display to
    toggle between displaying the document or editing it as text.

    Uses keymap "doc-view-mode-map", which is not currently defined.

It doesn't work well before the `doc-view-mode-map' keymap is loaded.
But mainly, it doesn't say at all what doc-view-mode is for.  Could you
maybe put something about the mode's purpose into the doc string?
Possibly this comment from doc-view.el:

    ;; DocView is a document viewer for Emacs.  It converts PDF, PS and DVI 
    ;; to a set of PNG files, one PNG for each page, and displays the PNG images
    ;; inside an Emacs buffer.  This buffer uses `doc-view-mode' which provides
    ;; convenient key bindings for browsing the document.

, or more succinctly:

    Doc View Mode is an Emacs document viewer.  It displays PDF, PS and
    DVI files (as PNG images) in Emacs buffers.

> >> 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?

That's more or less what the .gzip mode (can't remember it's exact name)
does - it displays the raw unintelligible file.

> > "... 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...

Er, "... to switch to ps-mode" and "... to switch to fundamental mode"
are shorter.  Surely you can determine the exact prompt at run time?

> > "... 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

Bis sp├Ąter!

Alan Mackenzie (Nuremberg, Germany).

reply via email to

[Prev in Thread] Current Thread [Next in Thread]