emacs-devel
[Top][All Lists]
Advanced

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

Re: map: major-mode --> font-lock-defaults


From: Stefan Monnier
Subject: Re: map: major-mode --> font-lock-defaults
Date: Mon, 29 Jan 2001 12:20:20 -0500

> > * In message <address@hidden>
> > * On the subject of "Re: map: major-mode --> font-lock-defaults "
> > * Sent on Mon, 29 Jan 2001 09:12:08 -0500
> > * Honorable "Stefan Monnier" <monnier+gnu/address@hidden> writes:
> >
> > > How do I determine font locking scheme of a major mode?
> > > font-lock-defaults-alist is now deprecated, so
> > > 
> > >         (assq 'c-mode font-lock-defaults-alist)
> > > 
> > > is wrong (I used it in e20).
> > > Do I have to use something like this:
> > > 
> > >         (with-temp-buffer (c-mode) font-lock-defaults)
> > > 
> > > (I want my derived move to inherit font-lock-defaults too)
> > 
> > It's inherited automatically since it's a buffer-local variable.
> > 
> >     (define-derived-mode new-mode old-mode "New"
> >       "A New major mode"
> >       ...)
> 
> Unfortunately, I do not observe this.
> The following:
> 
> (define-derived-mode d-mode c-mode "D"

Note that c-mode still uses font-lock-defaults-alist.
This is because it's a bit more difficult to move it back into CC-mode
(the font-lock regexps for it currently live in font-lock.el) because
of the independent maintainership.

And no, derived.el does not need to do anything special for
font-lock-defaults to be inherited.  That's why it's "the right way"
(as opposed to font-lock-defaults-alist where you need to inherit
 things explicitly, as shown in your example).


        Stefan




reply via email to

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