* Face specifications in font-lock-keywords.
@ 2005-04-06 12:30 Lute Kamstra
2005-04-06 13:37 ` Stefan Monnier
0 siblings, 1 reply; 10+ messages in thread
From: Lute Kamstra @ 2005-04-06 12:30 UTC (permalink / raw
(I'm updating the node Search-based Fontification in the lisp manual.)
The lisp manual says that a FACESPEC can be a list of the form
(face FACE PROP1 VAL1 PROP2 VAL2...)
whereas the docstring of font-lock-keywords says that this can be a
list of the form:
(face VAL1 PROP2 VAL2 PROP3 VAL3 ...)
The latter is obviously wrong. But is the former correct?
Lute.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Face specifications in font-lock-keywords.
2005-04-06 12:30 Face specifications in font-lock-keywords Lute Kamstra
@ 2005-04-06 13:37 ` Stefan Monnier
2005-04-06 13:59 ` Kim F. Storm
2005-04-06 14:16 ` Lute Kamstra
0 siblings, 2 replies; 10+ messages in thread
From: Stefan Monnier @ 2005-04-06 13:37 UTC (permalink / raw
Cc: emacs-devel
> (I'm updating the node Search-based Fontification in the lisp manual.)
> The lisp manual says that a FACESPEC can be a list of the form
> (face FACE PROP1 VAL1 PROP2 VAL2...)
> whereas the docstring of font-lock-keywords says that this can be a
> list of the form:
> (face VAL1 PROP2 VAL2 PROP3 VAL3 ...)
> The latter is obviously wrong. But is the former correct?
To me both are equivalent and correct. What's the problem exactly?
Regarding the discrepancy, I'd suggest we use the first form since it's
a bit more explicit.
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Face specifications in font-lock-keywords.
2005-04-06 13:37 ` Stefan Monnier
@ 2005-04-06 13:59 ` Kim F. Storm
2005-04-06 16:22 ` Ralf Angeli
2005-04-06 14:16 ` Lute Kamstra
1 sibling, 1 reply; 10+ messages in thread
From: Kim F. Storm @ 2005-04-06 13:59 UTC (permalink / raw
Cc: Lute Kamstra, emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> (I'm updating the node Search-based Fontification in the lisp manual.)
>> The lisp manual says that a FACESPEC can be a list of the form
>
>> (face FACE PROP1 VAL1 PROP2 VAL2...)
>
>> whereas the docstring of font-lock-keywords says that this can be a
>> list of the form:
>
>> (face VAL1 PROP2 VAL2 PROP3 VAL3 ...)
>
>> The latter is obviously wrong. But is the former correct?
>
> To me both are equivalent and correct. What's the problem exactly?
> Regarding the discrepancy, I'd suggest we use the first form since it's
> a bit more explicit.
IMO, both of these are hard to understand at first sight.
I think (face FACE [PROP VAL]...) would be clearer.
--
Kim F. Storm <storm@cua.dk> http://www.cua.dk
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Face specifications in font-lock-keywords.
2005-04-06 13:59 ` Kim F. Storm
@ 2005-04-06 16:22 ` Ralf Angeli
2005-04-06 17:22 ` Stefan Monnier
0 siblings, 1 reply; 10+ messages in thread
From: Ralf Angeli @ 2005-04-06 16:22 UTC (permalink / raw
* Kim F. Storm (2005-04-06) writes:
> I think (face FACE [PROP VAL]...) would be clearer.
AFAICS the "face FACE" part isn't even necessary; you can pass a
property/value-only list to `font-lock-keywords' and it will work as
well (you might have to disable global-font-lock-mode before trying
this):
(progn
(pop-to-buffer (get-buffer-create "*foo*"))
(insert "foo")
(setq font-lock-keywords '(("foo" 0 '(:foreground "green"))))
(font-lock-fontify-keywords-region (point-min) (point-max)))
This is not covered in the manual and doc string yet, or am I missing
something?
--
Ralf
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Face specifications in font-lock-keywords.
2005-04-06 16:22 ` Ralf Angeli
@ 2005-04-06 17:22 ` Stefan Monnier
2005-04-06 18:48 ` Ralf Angeli
0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2005-04-06 17:22 UTC (permalink / raw
Cc: emacs-devel
>> I think (face FACE [PROP VAL]...) would be clearer.
> AFAICS the "face FACE" part isn't even necessary; you can pass a
> property/value-only list to `font-lock-keywords' and it will work as
> well (you might have to disable global-font-lock-mode before trying
> this):
> (progn
> (pop-to-buffer (get-buffer-create "*foo*"))
> (insert "foo")
> (setq font-lock-keywords '(("foo" 0 '(:foreground "green"))))
> (font-lock-fontify-keywords-region (point-min) (point-max)))
It doesn't do the same. Your example only affects the `face' property,
whereas what the doc is talking about is how to set several text properties,
additionally to the `face' property (e.g. thinks like `keymap', `display'
`invisible', ...).
> This is not covered in the manual and doc string yet, or am I missing
> something?
It's probably discussed in the section talking about faces.
It's not specific to font-lock at all.
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Face specifications in font-lock-keywords.
2005-04-06 17:22 ` Stefan Monnier
@ 2005-04-06 18:48 ` Ralf Angeli
2005-04-06 22:38 ` Stefan Monnier
0 siblings, 1 reply; 10+ messages in thread
From: Ralf Angeli @ 2005-04-06 18:48 UTC (permalink / raw
* Stefan Monnier (2005-04-06) writes:
>>> I think (face FACE [PROP VAL]...) would be clearer.
>
>> AFAICS the "face FACE" part isn't even necessary; you can pass a
>> property/value-only list to `font-lock-keywords' and it will work as
>> well (you might have to disable global-font-lock-mode before trying
>> this):
>
>> (progn
>> (pop-to-buffer (get-buffer-create "*foo*"))
>> (insert "foo")
>> (setq font-lock-keywords '(("foo" 0 '(:foreground "green"))))
>> (font-lock-fontify-keywords-region (point-min) (point-max)))
>
> It doesn't do the same. Your example only affects the `face' property,
> whereas what the doc is talking about is how to set several text properties,
> additionally to the `face' property (e.g. thinks like `keymap', `display'
> `invisible', ...).
Oh, I see.
>> This is not covered in the manual and doc string yet, or am I missing
>> something?
>
> It's probably discussed in the section talking about faces.
> It's not specific to font-lock at all.
In the section about faces there is a subsection about face
attributes. But it doesn't mention that you can use a list of such
attributes and associated values for `font-lock-keywords'. The
documentation of `font-lock-keywords' could describe it, though. That
is what I meant, although I confused text properties with face
attributes.
--
Ralf
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Face specifications in font-lock-keywords.
2005-04-06 18:48 ` Ralf Angeli
@ 2005-04-06 22:38 ` Stefan Monnier
2005-04-07 6:58 ` Ralf Angeli
0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2005-04-06 22:38 UTC (permalink / raw
Cc: emacs-devel
>>> This is not covered in the manual and doc string yet, or am I missing
>>> something?
>>
>> It's probably discussed in the section talking about faces.
>> It's not specific to font-lock at all.
> In the section about faces there is a subsection about face
> attributes.
OK, I was wrong: since it's not a feature of faces but of the `face' text
property, it's mentioned in (info "(elisp)Special Properties").
I don't particularly like this feature, so I see no need to advertise it
more.
Stefan
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Face specifications in font-lock-keywords.
2005-04-06 22:38 ` Stefan Monnier
@ 2005-04-07 6:58 ` Ralf Angeli
2005-04-07 12:41 ` Stefan Monnier
0 siblings, 1 reply; 10+ messages in thread
From: Ralf Angeli @ 2005-04-07 6:58 UTC (permalink / raw
Cc: emacs-devel
* Stefan Monnier (2005-04-07) writes:
>>> It's probably discussed in the section talking about faces.
>>> It's not specific to font-lock at all.
>
>> In the section about faces there is a subsection about face
>> attributes.
>
> OK, I was wrong: since it's not a feature of faces but of the `face' text
> property, it's mentioned in (info "(elisp)Special Properties").
>
> I don't particularly like this feature, so I see no need to advertise it
> more.
I cannot say that I like or dislike it, but in fact AUCTeX is already
using it in order to allow a user to specify lists of LaTeX macros
which should get a special fontification. For the special
fontification one can either select a face already present or specify
face attributes. Without the possibility to use face attributes the
choices would be rather limited if you don't expect a user to define
his own faces.
I hope this feature will stay and mentioning it in the documentation
for `font-lock-keywords' would make me feel more confident that it
will.
--
Ralf
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Face specifications in font-lock-keywords.
2005-04-06 13:37 ` Stefan Monnier
2005-04-06 13:59 ` Kim F. Storm
@ 2005-04-06 14:16 ` Lute Kamstra
1 sibling, 0 replies; 10+ messages in thread
From: Lute Kamstra @ 2005-04-06 14:16 UTC (permalink / raw
Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> (I'm updating the node Search-based Fontification in the lisp manual.)
>> The lisp manual says that a FACESPEC can be a list of the form
>
>> (face FACE PROP1 VAL1 PROP2 VAL2...)
>
>> whereas the docstring of font-lock-keywords says that this can be a
>> list of the form:
>
>> (face VAL1 PROP2 VAL2 PROP3 VAL3 ...)
>
>> The latter is obviously wrong. But is the former correct?
>
> To me both are equivalent and correct. What's the problem exactly?
Ah yes, now that you mention it: you could see them as equivalent.
The problem is that the second form suggests that VAL1 is of the same
type as VAL2 and VAL3, which is not the case.
> Regarding the discrepancy, I'd suggest we use the first form since
> it's a bit more explicit.
Ok.
Lute.
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2005-04-07 12:41 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-06 12:30 Face specifications in font-lock-keywords Lute Kamstra
2005-04-06 13:37 ` Stefan Monnier
2005-04-06 13:59 ` Kim F. Storm
2005-04-06 16:22 ` Ralf Angeli
2005-04-06 17:22 ` Stefan Monnier
2005-04-06 18:48 ` Ralf Angeli
2005-04-06 22:38 ` Stefan Monnier
2005-04-07 6:58 ` Ralf Angeli
2005-04-07 12:41 ` Stefan Monnier
2005-04-06 14:16 ` Lute Kamstra
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).