all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Subject: Re: [PATCH 2/2] Make font-lock honor parents mode of current major-mode
Date: Wed, 09 Feb 2011 16:47:42 -0500	[thread overview]
Message-ID: <jwvsjvwx4ql.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87ei7hw2mk.fsf@keller.adm.naquadah.org> (Julien Danjou's message of "Wed, 09 Feb 2011 18:15:31 +0100")

>>> 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



  reply	other threads:[~2011-02-09 21:47 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-08 18:43 [PATCH 1/2] Add new function derived-mode-parents Julien Danjou
2011-02-08 18:43 ` [PATCH 2/2] Make font-lock honor parents mode of current major-mode Julien Danjou
2011-02-09 16:37   ` Stefan Monnier
2011-02-09 17:15     ` Julien Danjou
2011-02-09 21:47       ` Stefan Monnier [this message]
2011-02-10  9:25         ` Julien Danjou
2011-02-10 18:16           ` Stefan Monnier
2011-02-08 21:12 ` [PATCH 1/2] Add new function derived-mode-parents Stefan Monnier
2011-02-08 21:19   ` Julien Danjou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvsjvwx4ql.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.