Re: File type misclassification
storm@cua.dk (Kim F. Storm) writes:
> David Kastrup <dak@gnu.org> writes:
>
>>> 1) Restrict the magic for PostScript files to %!PS
>>>
>>> ("%!PS" . ps-mode)
>>
>> And probably EPS?
>
> Dunno.
>
>>>
>>> 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:
%!PS-Adobe-2.0
The Ghostscript example files (created manually, apparently) start
with
%!
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
%!PS-Adobe-2.0 EPSF-2.0
So I'd propose making the magic string for PostScript at least
%!PS
While it may be conceivable to also allow %! on a line of its own, I
would judge that too weak for content-based detection.
--
David Kastrup
Reply to: