[Top][All Lists]

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

RE: font-lock-maximum-decoration and how to make a default font-locklowe

From: Drew Adams
Subject: RE: font-lock-maximum-decoration and how to make a default font-locklower than maximal?
Date: Sun, 26 Aug 2012 11:26:55 -0700

> > For example, assume you are developing X-mode and some 
> > users would like to have functions + numbers + other stuff
> > highlighted, but you don't want to activate those by default.
> > So you can add font-lock keyword levels (2, 3, 4 etc) to
> > accommodate this preference, but want to set the default to 2.
> I hate font-lock-maximum-decoration's notion of "levels" because
> there is no such neat line.  Some users will care about one
> particular detail, others about an other.  So please don't use
> font-lock's levels for that fine-grained control.  Instead just
> introduce new config vars specific to your major mode.

You are throwing out the baby with the bath water.
And you are missing the point about font-lock "levels".

Font-lock levels are not just for users to _customize_ decoration for a
particular mode, in a single, fixed way.

Font-lock levels let users easily (e.g., using a cycle command or picking a
"level" from a menu, as in `font-menus.el' from FJ Wright) switch to a different
kind of highlighting.

Those kinds are called "levels" today, but you need not (and probably should
not) think of them as such.  "Level" here is a misnomer.

So-called "levels" are just different highlighting patterns.  These patterns
might or might not reflect different highlighting degrees ("levels"), however
you might want to imagine such leveling.  There is no need to think in terms of
degree at all.  Think "different", not "more" or "less".

Whether users should be able to easily customize the "levels" available for a
given mode is a good question.  I certainly am all for that possibility.

By all means, let users customize what the font-locking choices are for a given
mode, and how many choices there are.  Go for it.  And if the doc and names used
for this customization emphasize that these are just arbitrary sets of font-lock
appearances, rather than "levels", so much the better.

But please do not take away the ability to interactively switch among such
highlighting choices, which is provided by today's "levels" mechanism (with a
little help from `font-menus.el' etc.).

The facts that (1) most Emacs modes do not currently provide more than one
"level" by default, and that (2) many users are unaware that they can choose a
highlighting pattern ("level") when such a choice does exist, is not a reason
for tossing the mechanism.  (Choose = customize once and for all or switch
patterns interactively.)

Rather, those facts are reasons for Emacs Dev to (a) offer different predefined
highlighting choices for more modes, (b) advertise the feature more, and (c)
provide better interactivity (switching among choices) out of the box.

reply via email to

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