GNU bug report logs - #65632
30.0.50; Proposal to improve `faces--attribute-at-point'.

Previous Next

Package: emacs;

Reported by: David Ponce <da_vid <at> orange.fr>

Date: Wed, 30 Aug 2023 18:06:02 UTC

Severity: wishlist

Tags: moreinfo, patch

Found in version 30.0.50

Done: Stefan Kangas <stefankangas <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Stefan Kangas <stefankangas <at> gmail.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#65632: closed (30.0.50; Proposal to improve `faces--attribute-at-point'.)
Date: Mon, 24 Feb 2025 16:36:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Mon, 24 Feb 2025 16:34:53 +0000
with message-id <CADwFkmmCdQZVtS0rGX+-dM0kK=ae6FvRCCRifHn7e0QyDCztjw <at> mail.gmail.com>
and subject line Re: bug#65632: 30.0.50; Proposal to improve `faces--attribute-at-point'.
has caused the debbugs.gnu.org bug report #65632,
regarding 30.0.50; Proposal to improve `faces--attribute-at-point'.
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
65632: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=65632
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: David Ponce <da_vid <at> orange.fr>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.0.50; Proposal to improve `faces--attribute-at-point'.
Date: Wed, 30 Aug 2023 20:04:49 +0200
[Message part 3 (text/plain, inline)]
Hello,

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)))))
TESTnil

;; Then click to move point somewhere on TEST and run
M-: (foreground-color-at-point) RET
>>> result is "black" instead of "red"
M-: (background-color-at-point) RET
>>> result is "white" instead of "yellow"

I propose the attached patch to faces.el to improve things.
The patch introduce a new function `face-attribute-lookup' to lookup
face attribute, that works when face specification is complex like in
above example.  The function `faces--attribute-at-point' is simplified
to use it.

Here is a possible changelog:

	* faces.el: Improve attribute lookup of face at point.
	(face--unnamed-attributes): New constant.
	(face--attribute-unspecified-p)
	(face-attribute-lookup): New functions.
	(faces--attribute-at-point): Use it.  Remove useless argument.
	(foreground-color-at-point)
	(background-color-at-point): Update accordingly.

Thanks
[faces-attribute-lookup-V0.patch (text/x-patch, attachment)]
[Message part 5 (message/rfc822, inline)]
From: Stefan Kangas <stefankangas <at> gmail.com>
To: David Ponce <da_vid <at> orange.fr>
Cc: Eli Zaretskii <eliz <at> gnu.org>, 65632-done <at> debbugs.gnu.org
Subject: Re: bug#65632: 30.0.50;
 Proposal to improve `faces--attribute-at-point'.
Date: Mon, 24 Feb 2025 16:34:53 +0000
David Ponce <da_vid <at> orange.fr> writes:

> Sincerely, I thought this bug was closed a long time ago.

[...]

OK, thanks.  I'm therefore closing this bug report now.


This bug report was last modified 85 days ago.

Previous Next


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