[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re[2]: Multiple major modes
From: |
Eric M. Ludlam |
Subject: |
Re[2]: Multiple major modes |
Date: |
Mon, 18 Jun 2007 22:09:12 -0400 |
>>> Richard Stallman <address@hidden> seems to think that:
> This tools has a spiff macro `with-mode-local', which lets you run a
> bunch of code as if some other mode were active.
>
>Can you explain, in a nutshell, how the mechanism works?
>
The mode-local system ignores all variables set for the mode outside
the scope of mode-local.
Step 1:
Define all your variables with `defvar-mode-local'.
If changing a default value, use `setq-mode-local'
Step 2:
For a program, use `define-overload' to specify a function that
can have a mode specific override. Supply a default body for modes
that accept the default.
Step 3:
The mode-local system will automatically assign buffer-local values
to mode-local defined variables.
If a function is called created with `define-overload', then a mode
specific behavior will be run.
Ok, now if you use `with-mode-local', it will just substitute the old
local variables defined in the current mode with those from the new
mode, deleting any that don't exist in the new mode.
When exiting body (from with-mode-local macro) then it will just
reverse the process.
This is a key piece of abstraction for my semantic tool which provides
language independent access to tagging information, which needs
mode-specific values for parser information and many other functions.
http://cedet.sourceforge.net/semantic.shtml
Enjoy
Eric
--
Eric Ludlam: address@hidden, address@hidden
Home: http://www.ludlam.net Siege: www.siege-engine.com
Emacs: http://cedet.sourceforge.net GNU: www.gnu.org
- Re: Should nXML be included, (continued)
- Re: Should nXML be included, Peter Heslin, 2007/06/12
- Re: Should nXML be included, Jason Rumney, 2007/06/12
- Multiple major modes (was: Should nXML be included), Stefan Monnier, 2007/06/12
- Re: Multiple major modes, Leo, 2007/06/12
- Re: Multiple major modes, Lennart Borgman (gmail), 2007/06/12
- Re[2]: Multiple major modes, Eric M. Ludlam, 2007/06/12
- Re: Multiple major modes, Lennart Borgman (gmail), 2007/06/12
- Re: Multiple major modes, Stefan Monnier, 2007/06/12
- Re: Multiple major modes, Richard Stallman, 2007/06/13
- Re: Multiple major modes, Richard Stallman, 2007/06/13
- Re[2]: Multiple major modes,
Eric M. Ludlam <=
- Re: Multiple major modes, Richard Stallman, 2007/06/24
- Re[2]: Multiple major modes, Eric M. Ludlam, 2007/06/25
Re: Should nXML be included, Stefan Monnier, 2007/06/12
Re: Should nXML be included, Peter Heslin, 2007/06/12
- Re: Should nXML be included, Leo, 2007/06/12
- Re: Should nXML be included, joakim, 2007/06/12
- Re: Should nXML be included, Peter Heslin, 2007/06/12
- Re: Should nXML be included, David Kastrup, 2007/06/12
- Re: Should nXML be included, Stefan Monnier, 2007/06/12
- Re: Should nXML be included, Richard Stallman, 2007/06/13