[Top][All Lists]

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

Re: Specifying mode in file variables trouble

From: Lennart Borgman (gmail)
Subject: Re: Specifying mode in file variables trouble
Date: Thu, 25 Sep 2008 01:09:28 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20071031 Thunderbird/ Mnenhy/

Richard M. Stallman wrote:
> The "idle sorting" mechanism in majmodpri.el is asking for trouble.
> Loading a file should _fully_ install the code in that file.  To leave
> _anything_ for later is unreliable.
> I'm not sure whether majmodpri is a useful feature, because I am not
> convinced there is a real problem to be solved.  What is a real case
> of the problem, and is there another solution?
> But if we want such a facility, we should implement it right.  The
> right way is to insert these elements in the proper position the first
> time.

I think I am beeing a bit stupid here. I should have said before that
the implementation in majmodpri.el is for the case that this feature is
not included in Emacs. If it is included in Emacs it can be done much
more simple.

What majmodpri.el does is effectively that it implements a priority list
beside the lists used by `normal-mode'. (And it makes this list

If we include this in Emacs I would suggest something similar to what I
have used in mumamo in `mumamo-major-modes'. This is for a different
purpose but the structure of the problem is sufficiently similar.

That list is used for converting what I call major mode specifiers to
major modes. Major modes are used when definiing multi major modes.

An example is the major mode specifier for javascript. I call this
javascript-mode. In mumamo-major-modes this is used as a key to find the
major mode to use:

(defcustom mumamo-major-modes

If a multi major mode has a major mode specifier for a chunk that is
javascript-mode this will result in a lookup in this list and give the
result (javascript-mode js2-fl-mode ecmasript-mode). These three are
major modes ordered in priority order. If javascript-mode is available
that will be used, else js2-fl-mode etc.

A similar implementation can be used for major mode priorities for
normal-mode. Then there is no need at all to change the lists
normal-mode uses (but I have to do that in majmodpri.el because I can't
change the way normal-mode behaves).

reply via email to

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