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

Re: File type misclassification

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>>> Sigh.  Seems like a magic string for the "TeXshop" TeX editor.  But I
>>>> think just ruling out [VT] is still asking for trouble.
>>> I think a bug report to the TeXshop is in order.
>> Uh, you people are joking, right?
> Nope!
>> It is not a bug in TeXshop if Emacs' magic-mode-alist goes out of control
>> and calls everything "PostScript".
> The %! thingy is not Emacs's invention.  It's how postscript was
> specified.

The only relevant standard I can find starts off with "%!PS-Adobe".
In contrast, %! is far too generic to be useful.  It may be a
heuristic for a PostScript interpreter to decide whether it is getting
fed PostScript on stdin.  But it does not sound like a useful
heuristic for a text editor to decide whether a named file contains
PostScript code or anything else.

> And for that reason `file greek-utf8.tex' agrees with Emacs.
> This said, I'd be happy to see the %! entry removed from
> magic-mode-alist, because I think magic-mode-alist should really be
> kept to its absolute strictest minimum.

I don't think that "%!PS" has comparable potential to do accidental
harm.  Whether it does noticeable good is a different question

However, dvips -i produces PostScript files where the extension is
replaced by a serial number.  Those will not be recognized as
PostScript without magic number detection.  "%!PS" is completely
sufficient for that purpose, however.

I think that little except hand-crafted PostScript would ever start
with "%!" alone, and hand-crafted PostScript will have a proper file

Even if one uses
dvips -N
(which disabled structured comments) the file starts with
%!PS (but not EPSF; comments have been disabled)

So I think that "%!PS" _does_ have some usefulness, and it is clearly
not as overboard as "%!".

David Kastrup

Reply to: