GNU bug report logs - #1534
Font lock decoration levels mismatch?

Previous Next

Package: emacs;

Reported by: Derick Eddington <derick.eddington <at> gmail.com>

Date: Wed, 10 Dec 2008 20:00:04 UTC

Severity: normal

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #16 received at 1534 <at> emacsbugs.donarmstrong.com (full text, mbox):

From: Glenn Morris <rgm <at> gnu.org>
To: Derick Eddington <derick.eddington <at> gmail.com>
Cc: 1534 <at> debbugs.gnu.org
Subject: Re: bug#1534: Font lock decoration levels mismatch?
Date: Fri, 12 Dec 2008 15:34:33 -0500
Derick Eddington wrote:

>> > when I customize the level for a specific mode (one I'm still
>> > developing) the number given to Customize is 0-based not 1-based;
>> > i.e., my `font-lock-defaults' `KEYWORDS' member is like `(level-1
>> > level-2 level-3 level-4)' and, e.g., to make Customize use
>> > level-3 I have to tell it the number 2.
[...]
> I'm customizing `font-lock-maximum-decoration'.  It's documentation says:
[...]
>          ((c-mode . t) (c++-mode . 2) (t . 1))
>         means use the maximum decoration available for buffers in C
>         mode, level 2 decoration for buffers in C++ mode, and level 1
>         decoration otherwise.
[...]
> When I start customizing it from its default state and activate the
> "Value Menu" with "mode specific", I get:
>
> INS DEL Instance:
>             Mode:
>             (*) all
>             ( ) name: nil
>             Decoration:
>             ( ) default
>             (*) maximum
>             ( ) level: 1


OK. So where's the part where you have to say 2 in order to get 3?

If I use customize to say:

mode: all : maximum
mode: name : f90-mode : level 2

Then I get level 2 highlighting in F90 buffers.


Oh, perhaps I see the problem. You said:

  my `font-lock-defaults' `KEYWORDS' member is like `(level-1 level-2
  level-3 level-4)'

There should be a separate element at the start giving the default
highlighting for the mode. See for example f90-mode:

  (set (make-local-variable 'font-lock-defaults)
       '((f90-font-lock-keywords f90-font-lock-keywords-1
                                 f90-font-lock-keywords-2
                                 f90-font-lock-keywords-3
                                 f90-font-lock-keywords-4)
         nil t))


(or grep for "keywords-1" in the lisp sources)

That does indeed look like a documentation bug in the manual...




This bug report was last modified 16 years and 165 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.