[Top][All Lists]

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

Re: magic-mode-alist has too high a priority

From: Stefan Monnier
Subject: Re: magic-mode-alist has too high a priority
Date: Thu, 24 Feb 2005 13:39:17 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

>> I need to view/edit ontologies in OWL syntax (XML files).
>> I use an owl-mode which puts ("\\.owl$" . owl-mode) in front of
>> auto-mode-alist.
>> However when I view those ontologies, the magic-mode-alist specified
>> function (xml-mode) is called because of the <?xml token on the first
>> line. So I find my file visited in xml-mode instead of the owl-mode.

When auto-mode-alist decides the buffer should use mode Foo and
magic-mode-alist thinks it should be type Bar, we have the
following possibilities:
- the file name's extension is wrong: we should use Bar.
- the magic code is wrong: we should use Foo.
- both are wrong.
- both are correct.

My guess is that in 99% of the cases, both are "correct".

Now if both are "correct", how can it be that Foo and Bar are different?
Because Foo is a sub-mode of Bar or vice-versa, or because one says
`perl-mode' and the other `cperl-mode', ...

This is especially true for XML/SGML which are frameworks which lead
naturally to the development of a multitude of sub-modes (HTML, XHTML, OWL,
you name it).

So I suggest something like: magic-mode-alist doesn't take precedence over
auto-mode-alist.  Instead, we look them up both, and if there's a conflict,
we lookup a new var `mode-precedence-alist' to see if the user prefers one
over the other.  If that doesn't resolve the conflict, check
`derived-mode-p'.  If the conflict is still not resolved, prompt the user.


reply via email to

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