bug#2058: 23.0.60; bewildering behavior when visit new file throw.pdf
Alan Mackenzie <[email protected]>
| Newsgroups | gmane.emacs.bugs,gmane.emacs.pretest.bugs |
|---|---|
| Message-ID | <[email protected]> |
Hi, Tassilo, On Tue, Jan 27, 2009 at 10:55:40AM +0100, Tassilo Horn wrote: > "Drew Adams" <[email protected]> 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? 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. > > 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." It's particularly long and confusing for a non-existent document. Emacs shouldn't alarm users. > > 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>. ;-( > > 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? 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. "... to switch to an editing mode " is particularly bad. It should be less vague, stating the mode (text mode?). "... to open a buffer showing the doc as text" would be better as "to show the doc as text". > Bye, > Tassilo -- Alan Mackenzie (Nürnberg, Germany).