Re: File type misclassification
Stefan Monnier <email@example.com> writes:
>>>>> opening the following file in emacs-snapshot from Ubuntu Edgy
>>>>> (sorry, I don't have a fresher CVS Emacs at work) will throw the
>>>>> buffer into PostScript mode, presumably because it starts with
>>>>> "%!". This seems rather like overkill.
> Same old problem where the file's content and the file's extension do not
> agree on what the file actually contains. And once again, the file
> extension is the better predictor whereas Emacs uses magic-mode-alist in
> preference to auto-mode-alist.
>> 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? It is not a bug in TeXshop if
Emacs' magic-mode-alist goes out of control and calls everything
>>> 3) Remove it from magic-mode-alist.
>> Also an option in my book.
> Agreed, a very good option I'd say. Especially since editing
> postscript is rather uncommon.
Since I don't seem too good at explaining what appears as common sense
to me, I'll fix the magic expression myself to "#!PS". That's still a
less drastic change than removing it altogether, and most people seem
to agree that the latter option would be quite feasible.
This won't catch "#!\n" which seems to be used in some hand-crafted PS
files, but then the handcrafted files (vasarely.ps, for example)
should be discernible by file extension, and one would have to
actually use some generic line-ending recognizer instead of "\n",
anyway, since PostScript has no fixed line-ending convention.
If others find they want even the "#!PS" gone (which I don't really
see as a problem), or add some form of "#!lineend", feel free to
discuss and fix.
David Kastrup, Kriemhildstr. 15, 44793 Bochum