Re: File type misclassification
email@example.com (Kim F. Storm) writes:
> David Kastrup <firstname.lastname@example.org> writes:
>>> 1) Restrict the magic for PostScript files to %!PS
>>> ("%!PS" . ps-mode)
>> And probably EPS?
>>> 2) Recognize the specific case of TEX
>>> ("%![^VT]" . ps-mode)
>> Sigh. Seems like a magic string for the "TeXshop" TeX editor. But I
>> think just ruling out [VT] is still asking for trouble.
> So maybe add this to the magic-mode-alist before the ps rule:
> ("%!TEX" . tex-mode)
That makes "%!" even less discriminatory than your last proposal. The
PostScript magic is _far_ too lenient.
I find strings like the following:
The Ghostscript example files (created manually, apparently) start
and nothing else. I think it perfectly feasible to detect their
document type on the file name alone.
EPS files seem to start with something like
So I'd propose making the magic string for PostScript at least
While it may be conceivable to also allow %! on a line of its own, I
would judge that too weak for content-based detection.