[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#65632: 30.0.50; Proposal to improve `faces--attribute-at-point'.
From: |
Eli Zaretskii |
Subject: |
bug#65632: 30.0.50; Proposal to improve `faces--attribute-at-point'. |
Date: |
Wed, 30 Aug 2023 21:35:11 +0300 |
> Date: Wed, 30 Aug 2023 20:04:49 +0200
> From: David Ponce <da_vid@orange.fr>
>
> I noticed that the functions `foreground-color-at-point' and
> `background-color-at-point' don't return expected values when the face
> at point includes anonymous face or is a nested list of face, for
> example.
>
> Here is a simple recipe that demonstrates the issue (emacs -Q):
>
> In scratch buffer eval:
> -----------------------
>
> ;; Display "TEST" in red, bold, italic on yellow background.
> (insert
> (propertize
> "TEST" 'font-lock-face
> '(bold ((:background "yellow") "italic"
> ((foreground-color . "red") underline)))))
This is not a valid face, AFAIU. That it works is sheer luck (because
Emacs is very lenient with this stuff). The correct face definition
for what you want is this (see 'set-face-attribute's doc string):
(insert
(propertize
"TEST" 'font-lock-face
'(:weight bold :background "yellow" :slant italic
:foreground "red" :underline t)))
If you use the above, foreground-color-at-point etc. will work as
expected.
I'm not sure we want to go out of our way to support the kind of face
specifications that you used.