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

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

Elisp info: How does a major mode work? When is its function called?


From: Alan Mackenzie
Subject: Elisp info: How does a major mode work? When is its function called?
Date: 2 Mar 2002 23:23:09 +0100
Date: Sat, 2 Mar 2002 18:45:47 +0000
User-agent: tin/1.4.5-20010409 ("One More Nightmare") (UNIX) (Linux/2.0.35 (i686))

Elisp manual, version 2.7.

The page "Major Modes" is rather vague about how major modes work.  For
example, it doesn't answer questions such as "Is the major mode function
called just once for a buffer, or is it called every time the buffer is
selected?".

The first paragraph on the page reads:

>   Major modes specialize Emacs for editing particular kinds of text.
>Each buffer has only one major mode at a time.

I suggest inserting something like the following after that paragraph:

The major mode of a buffer is set by calling the mode's function.  This
is typically done just after a file has been loaded into the buffer.  The
mode function works by setting buffer-local variables to mode specific
values (e.g., for font-lock settings and local keymaps).  These values
automatically become active whenever the buffer is selected. 

[Please correct me if I have misunderstood this mechanism.]

-- 
Alan Mackenzie (Munich, Germany)
Email: aacm@muuc.dee; to decode, wherever there is a repeated letter
(like "aa"), remove half of them (leaving, say, "a").




reply via email to

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