GNU bug report logs -
#1534
Font lock decoration levels mismatch?
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 1534 in the body.
You can then email your comments to 1534 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#1534
; Package
emacs
.
Full text and
rfc822 format available.
Acknowledgement sent to
Derick Eddington <derick.eddington <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
Full text and
rfc822 format available.
Message #5 received at submit <at> emacsbugs.donarmstrong.com (full text, mbox):
I'm using:
GNU Emacs 23.0.60.1 (i486-pc-linux-gnu, GTK+ Version 2.14.3) of
2008-10-13 on rothera, modified by Debian
The documentation at "23.6.1 Font Lock Basics" and "23.6.5 Levels of
Font Lock" refers to level numbers starting at 1, but 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. Should
Customize do 1-based indexing instead so it corresponds to the
documentation, or the documentation use 0-based?
--
: Derick
----------------------------------------------------------------
Information forwarded to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#1534
; Package
emacs
.
Full text and
rfc822 format available.
Message #8 received at 1534 <at> emacsbugs.donarmstrong.com (full text, mbox):
Derick Eddington wrote:
> The documentation at "23.6.1 Font Lock Basics" and "23.6.5 Levels of
> Font Lock" refers to level numbers starting at 1, but 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 don't really understand the problem. What exactly are you
customizing, and how?
In general, the actual Lisp expression used by Customize is not
terribly important - use a tag instead to give a more human-readable
set of choices (eg "minimum", "medium", "maximum" rather than 1, 2, 3).
Information forwarded to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#1534
; Package
emacs
.
Full text and
rfc822 format available.
Acknowledgement sent to
Derick Eddington <derick.eddington <at> gmail.com>
:
Extra info received and forwarded to list. Copy sent to
Emacs Bugs <bug-gnu-emacs <at> gnu.org>
.
Full text and
rfc822 format available.
Message #13 received at 1534 <at> emacsbugs.donarmstrong.com (full text, mbox):
On Thu, 2008-12-11 at 18:52 -0500, Glenn Morris wrote:
> Derick Eddington wrote:
>
> > The documentation at "23.6.1 Font Lock Basics" and "23.6.5 Levels of
> > Font Lock" refers to level numbers starting at 1, but 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 don't really understand the problem. What exactly are you
> customizing, and how?
>
> In general, the actual Lisp expression used by Customize is not
> terribly important - use a tag instead to give a more human-readable
> set of choices (eg "minimum", "medium", "maximum" rather than 1, 2, 3).
I'm customizing `font-lock-maximum-decoration'. It's documentation
says:
Maximum decoration level for fontification.
If nil, use the default decoration (typically the minimum
available).
If t, use the maximum decoration available.
If a number, use that level of decoration (or if not available
the maximum).
If a list, each element should be a cons pair of the form
(MAJOR-MODE . LEVEL), where MAJOR-MODE is a symbol or t (meaning
the default). For example:
((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.
I'm using the last form with an association for my mode. I have 4
levels. I haven't yet learned how to use tags with Customize, I'll read
about that. But for my mode, I think tag names would not be as clear as
just the numbers. If Customize is going to allow numbers, shouldn't
their indexing base be consistent with the documentation?
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
INS
Which is not the Lisp syntax and is showing a number.
This isn't a big deal to me, but the Emacs' documentation tells me to
report things like this.
--
: Derick
----------------------------------------------------------------
Information forwarded to
bug-submit-list <at> lists.donarmstrong.com, Emacs Bugs <bug-gnu-emacs <at> gnu.org>
:
bug#1534
; Package
emacs
.
Full text and
rfc822 format available.
Message #16 received at 1534 <at> emacsbugs.donarmstrong.com (full text, mbox):
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...
Reply sent to
Glenn Morris <rgm <at> gnu.org>
:
You have taken responsibility.
Full text and
rfc822 format available.
Notification sent to
Derick Eddington <derick.eddington <at> gmail.com>
:
bug acknowledged by developer.
Full text and
rfc822 format available.
Message #21 received at 1534-done <at> emacsbugs.donarmstrong.com (full text, mbox):
I have clarified the documentation.
Glenn Morris wrote:
> There should be a separate element at the start giving the default
> highlighting for the mode.
BTW, it's not really the "default" any more. It's the level used when
font-lock-maximum-decoration has a nil value. Nowaways it is t by
default.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> emacsbugs.donarmstrong.com
.
(Sat, 10 Jan 2009 15:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 16 years and 164 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.