[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/2] Make font-lock honor parents mode of current major-mode
From: |
Stefan Monnier |
Subject: |
Re: [PATCH 2/2] Make font-lock honor parents mode of current major-mode |
Date: |
Wed, 09 Feb 2011 16:47:42 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
>>> This allows to add font-lock keyword to prog-mode directly, so every other
>>> children mode will use them.
>>
>> Making inheritance work with font-lock keywords is a good idea, but this
>> is the wrong way to do it. The right way is to take advantage of the
>> way inheritance works. E.g. use a variable which modes would
>> *modify* rather than just set. E.g. somehow convince all modes to use
>> the equivalent of font-lock-add-keywords.
> I may not have enough knowledge of modes and font-lock to understand the
> way you describe. Would you mind ellaboring a bit so I can maybe work on
> that? :)
If modes *add* keywords to `font-lock-new-keywords', then children of
prog-mode will automatically inherit the prog-mode's keyword since
variables set by the parent are carried to the child.
So, I think we should change font-lock.el so that major modes setup
font-lock keywords by adding them to a variable. For backward
compatibility, the keywords listed in font-lock-defaults would be added,
of course.
Stefan
Re: [PATCH 1/2] Add new function derived-mode-parents, Stefan Monnier, 2011/02/08