emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: python-mode.el doesn't associate python-mode with .PY files


From: Kim F. Storm
Subject: Re: python-mode.el doesn't associate python-mode with .PY files
Date: Thu, 28 Dec 2006 13:47:11 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.92 (gnu/linux)

"Juanma Barranquero" <address@hidden> writes:

> On 12/27/06, Kim F. Storm <address@hidden> wrote:
>
>> In contrast, the "recognize images by file contents" approach has already
>> required three rounds of bug-fixing ... and there's no guarantee that there
>> are not more "surprises"...
>
> Well, I think that's not entirely fair. Patches for that approach have
> conflated several different things:

Sure, but if we had just added Stefan patch now, the rest of the patches
would not have been needed "before the release".

That said, I agree that _some_ of the changes are good.
>
>  - The possibility of adding matcher functions to `magic-mode-alist'.
> That's good IMO.
Yes.

>
>  - Fixes to regexps in `image-type-header-regexps'. These are good
> too. "^P[1-6]" matching PBM files would be over-eager even if
> `image-type-from-buffer' were not added to `magic-mode-alist'.
Correct, but we have not had reports of bad effects of the simpler regexp.

>  - Adding `image-type-from-buffer' to `magic-mode-alist'. That's not
> good because there is one type of file (postscript) whose
> interpretation is ambiguous under that function. 

Yes, that is the part of this approach which I think is going in a
very bad direction ... trying to fix things in the wrong way.


>                                                  The right approach
> would be to add to `magic-mode-alist' a function specifically designed
> to detect images; it should also take into account
> `image-type-available-p' (it never makes sense to identify a .ps file
> as an image on Windows, for example, as the Windows port does not
> support postscript images).

I agree!

>
> - Modifying `image-type-header-regexps' to support NOT-ALWAYS. Not
> good IMO because it adds interface complexity just to fix one case.

Precisely.  This is the part which should be reverted.

> Not entirely true. Someone noted that he wanted Emacs to autodetect
> JPEG thumb files that had no recognizable extension, for example.
> That's not fixed by Stefan's patch (which I think is good, BTW).

Ok. So we could detect _just_ JPEG via magic-mode-alist, supposing
that format is sufficiently different from anything else.

>
> I think a good approach would be to add Stefan patch, remove the
> NOT-ALWAYS stuff and fix `magic-mode-alist' to use a function
> specifically designed to detect image types.

Agree ... for a _very limited set_ of image types, which cannot always
be detected by their file suffixes...

-- 
Kim F. Storm <address@hidden> http://www.cua.dk





reply via email to

[Prev in Thread] Current Thread [Next in Thread]