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

Re: File type misclassification



storm@cua.dk (Kim F. Storm) writes:

> "Juanma Barranquero" <lekktu@gmail.com> writes:
>
>> On 3/20/07, David Kastrup <dak@gnu.org> wrote:
>>
>>> 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.
>>
>> Yep. It's magic-mode-alist's doing:
>>
>> ("%![^V]" . ps-mode)
>
> First line of the file reads:
>
> %!TEX encoding = UTF-8 Unicode
>
>
> I see three fixes:
>
>
> 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)

I don't think that there is a special case here: it would be my guess
that the author just picked that string by chance.

[Google]

Sigh.  Seems like a magic string for the "TeXshop" TeX editor.  But I
think just ruling out [VT] is still asking for trouble.

> 3) Remove it from magic-mode-alist.

Also an option in my book.  But I think we should start by making the
string much more discriminatory.  There is no harm if we overdo it: in
general, the file extension will catch what we don't, effectively
giving us option 3) for those cases.

-- 
David Kastrup



Reply to: