Received: (at 22915) by debbugs.gnu.org; 5 Mar 2016 08:16:10 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 05 03:16:10 2016 Received: from localhost ([127.0.0.1]:34253 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1ac7Ni-0001K5-0O for submit <at> debbugs.gnu.org; Sat, 05 Mar 2016 03:16:10 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52151) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from <eliz@HIDDEN>) id 1ac7Nf-0001Jk-VT for 22915 <at> debbugs.gnu.org; Sat, 05 Mar 2016 03:16:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <eliz@HIDDEN>) id 1ac7NX-0003Gt-GJ for 22915 <at> debbugs.gnu.org; Sat, 05 Mar 2016 03:16:02 -0500 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 Received: from fencepost.gnu.org ([2001:4830:134:3::e]:52073) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <eliz@HIDDEN>) id 1ac7NX-0003Go-CL; Sat, 05 Mar 2016 03:15:59 -0500 Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4633 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from <eliz@HIDDEN>) id 1ac7NW-0004QI-K4; Sat, 05 Mar 2016 03:15:59 -0500 Date: Sat, 05 Mar 2016 10:15:58 +0200 Message-Id: <83lh5xxrup.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: =?utf-8?Q?Cl=C3=A9ment?= Pit--Claudel <clement.pitclaudel@HIDDEN> In-reply-to: <56DA785D.8080202@HIDDEN> (message from =?utf-8?Q?Cl=C3=A9m?= =?utf-8?Q?ent?= Pit--Claudel on Sat, 5 Mar 2016 01:10:37 -0500) Subject: Re: bug#22915: foreground-color-at-point doesn't return the foreground color at point (when overlays are present) References: <56DA785D.8080202@HIDDEN> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2001:4830:134:3::e X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: 22915 Cc: 22915 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Reply-To: Eli Zaretskii <eliz@HIDDEN> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -5.0 (-----) > From: Clément Pit--Claudel <clement.pitclaudel@HIDDEN> > Date: Sat, 5 Mar 2016 01:10:37 -0500 > > (with-current-buffer (get-buffer-create "*broken*") > (require 'cl-lib) > (erase-buffer) > (delete-all-overlays) > (fundamental-mode) > (insert "AAAAA") > (goto-char (point-min)) > > ;; Add two faces > (set-text-properties (point-min) (point-max) '(face font-lock-type-face)) > (let ((ov (make-overlay (point-min) (point-max)))) > (overlay-put ov 'face 'font-lock-negation-char-face)) > > ;; This passes, proving that font-lock-negation-char-face is not contributing to the > ;; foreground color > (cl-assert (eq (face-attribute 'font-lock-negation-char-face :foreground) > 'unspecified)) > > ;; This fails: foreground-color-at-point reads the face of the overlay, sees that it's undefined, > ;; and ignores the 'face text property > (cl-assert (eq (foreground-color-at-point) > (face-attribute 'font-lock-type-face :foreground))) > > (pop-to-buffer (current-buffer))) You are creating a situation where the actual color of the character is the result of face merging as part of redisplay. I don't think there's currently any way of accessing the results of face merging from Lisp. By contrast, foreground-color-at-point simply returns the color specified by the highest-priority overlay/text property at point; in this case that color is unspecified, so it defaults to the default face's foreground color. If I'm right, you expect too much from foreground-color-at-point, or from any Lisp implementation of this functionality in general. AFAICT, if we want this kind of functionality supported from Lisp, we will need first to implement a primitive that would accept a list of faces and return the fully realized face spec produced by merging those faces. Then a Lisp implementation of foreground-color-at-point could be changed to collect all the relevant text/overlay properties at point and pass them to that primitive. Alternatively, an entirely-C implementation, exposed to Lisp as a primitive, could simulate display of the character at point and return the resulting color. If there are other ideas, I'm all ears. If not, I think this is a fine subject for a small project, patches are welcome.
bug-gnu-emacs@HIDDEN:bug#22915; Package emacs.
Full text available.
Received: (at submit) by debbugs.gnu.org; 5 Mar 2016 06:10:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 05 01:10:53 2016
Received: from localhost ([127.0.0.1]:34241 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1ac5QS-0006s6-TA
for submit <at> debbugs.gnu.org; Sat, 05 Mar 2016 01:10:53 -0500
Received: from eggs.gnu.org ([208.118.235.92]:60959)
by debbugs.gnu.org with esmtp (Exim 4.84)
(envelope-from <clement.pitclaudel@HIDDEN>) id 1ac5QR-0006ru-8l
for submit <at> debbugs.gnu.org; Sat, 05 Mar 2016 01:10:51 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
(envelope-from <clement.pitclaudel@HIDDEN>) id 1ac5QL-0002up-Bm
for submit <at> debbugs.gnu.org; Sat, 05 Mar 2016 01:10:46 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level:
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM
autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:38540)
by eggs.gnu.org with esmtp (Exim 4.71)
(envelope-from <clement.pitclaudel@HIDDEN>) id 1ac5QL-0002uj-8N
for submit <at> debbugs.gnu.org; Sat, 05 Mar 2016 01:10:45 -0500
Received: from eggs.gnu.org ([2001:4830:134:3::10]:51926)
by lists.gnu.org with esmtp (Exim 4.71)
(envelope-from <clement.pitclaudel@HIDDEN>) id 1ac5QK-0004DR-A7
for bug-gnu-emacs@HIDDEN; Sat, 05 Mar 2016 01:10:45 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
(envelope-from <clement.pitclaudel@HIDDEN>) id 1ac5QH-0002u7-50
for bug-gnu-emacs@HIDDEN; Sat, 05 Mar 2016 01:10:44 -0500
Received: from mout.kundenserver.de ([212.227.126.135]:60370)
by eggs.gnu.org with esmtp (Exim 4.71)
(envelope-from <clement.pitclaudel@HIDDEN>) id 1ac5QG-0002u1-Mb
for bug-gnu-emacs@HIDDEN; Sat, 05 Mar 2016 01:10:41 -0500
Received: from [18.189.68.195] ([18.189.68.195]) by mrelayeu.kundenserver.de
(mreue005) with ESMTPSA (Nemesis) id 0MSmwb-1aUZ2228UH-00RtQH for
<bug-gnu-emacs@HIDDEN>; Sat, 05 Mar 2016 07:10:39 +0100
To: bug-gnu-emacs@HIDDEN
From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= <clement.pitclaudel@HIDDEN>
Subject: foreground-color-at-point doesn't return the foreground color at
point (when overlays are present)
Message-ID: <56DA785D.8080202@HIDDEN>
Date: Sat, 5 Mar 2016 01:10:37 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101
Thunderbird/38.5.1
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha1;
protocol="application/pgp-signature";
boundary="lqnbr8eGJkxsxCaktRGx4snVu3wOX4oSv"
X-Provags-ID: V03:K0:tmOGQQYwRuTXtUXaWulOxWigRD/zv/Cz3eF2jSiftRO+htbC+dT
jkSwNCKeggyCI96Tq/ADxHvXZXlHipCWGT2sEdMmyulT7nWbd/aT0ABm5XiLdTp+/yEalO4
2DPCmGJn0XvQpHEGsuKmI7poUs41+ywq7kswHnZDJy/iMEnm3dv81s26Jx7xS8E86baxX5z
H11YlmN7ZquhpciJYP37A==
X-UI-Out-Filterresults: notjunk:1;V01:K0:vfuG3g2bc+8=:sN+j+mT6D3LD74+t2wIsam
OrCVLXi4XG8HyJDiDpuBD7HZJDZlxgaN0T7pMU4MYrw7B2Jkx9x+bh/t/6M0ZtrNqSSzzQN3x
KAL+VdBP+ZyRaZfTzfcdk5i/ScsUjPG/+4Ser91uWNK7A372W7MYs22UGa5Wtq8Y0+el8DpVL
9opIYzQ9LAzLErAE4JmPs5roGD2tdsiSbNJGjv3Avs+pzuE2C3xvoyuUSlUP4bF9dHf13TEla
VNNGv7QdwDeubnF0UapunGcwVTS3yDEyjONRAOlhsKG0l/Ly6hduz7mIK6zhj5xgwAYO54RbS
A5RdAWLpw+9xu+H86lEdoysQt8/UE6t3NBdCsNy+jtfCzhsuygvgNWuKf/kXxE5WS2zRG7FXi
mNMqcQCG1/Thu8PIXXbrFoaW+wyBvFRUMmavZFFeqi7H121XIEvHlACHItrzFO54T1j2zr9+8
eHCUv4YM2OVckf4r74pKNMIdAdF5Jzzf4EBRmvs+jYL2Jvgzdb+hpdu7CTl6rUp9DCvqiuZV1
Q8F8AG/1GQdozWTqfMsGGgsVbMTxkk5MUyu7Br0vf1PfiIKdn2OaoBruLJPurz7EIvDc03bHZ
WbJvvYro9iI64oV97bi2nJ4kC+PpReHXAd914BQUkAZsN/UnccNTsK6WzDOgg/NP/DKJuF8wt
B4Thp1BG4rITO4ftDePj0k9k+ZQXtb84zqT5OCQic4sfga349O5Si1tbyT8/rLyv5O9s=
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)
This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--lqnbr8eGJkxsxCaktRGx4snVu3wOX4oSv
Content-Type: multipart/mixed; boundary="t8nPWdeU3cVAcHj7VSgFjeQjEh3m8qFHR"
From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= <clement.pitclaudel@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Message-ID: <56DA785D.8080202@HIDDEN>
Subject: foreground-color-at-point doesn't return the foreground color at
point (when overlays are present)
--t8nPWdeU3cVAcHj7VSgFjeQjEh3m8qFHR
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Reproduction with emacs -Q:
(with-current-buffer (get-buffer-create "*broken*")
(require 'cl-lib)
(erase-buffer)
(delete-all-overlays)
(fundamental-mode)
(insert "AAAAA")
(goto-char (point-min))
;; Add two faces
(set-text-properties (point-min) (point-max) '(face font-lock-type-face=
))
(let ((ov (make-overlay (point-min) (point-max))))
(overlay-put ov 'face 'font-lock-negation-char-face))
;; This passes, proving that font-lock-negation-char-face is not contri=
buting to the
;; foreground color
(cl-assert (eq (face-attribute 'font-lock-negation-char-face :foregroun=
d)
'unspecified))
;; This fails: foreground-color-at-point reads the face of the overlay,=
sees that it's undefined,=20
;; and ignores the 'face text property=20
(cl-assert (eq (foreground-color-at-point)
(face-attribute 'font-lock-type-face :foreground)))
(pop-to-buffer (current-buffer)))
Let me know if I can provide more info.
Cl=C3=A9ment.
--t8nPWdeU3cVAcHj7VSgFjeQjEh3m8qFHR--
--lqnbr8eGJkxsxCaktRGx4snVu3wOX4oSv
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)
iQIcBAEBAgAGBQJW2nhdAAoJEPqg+cTm90wjeIwP/1YtkYiv+byjwmLI/pq9fLT1
rMm9wqZU06SCWR2OFJ3KJZT462AJAd1vKyyeu17nQV1C3v7fbPQxoDM/qYwEQRK6
uC+W3pcl4PXUwe7Ymjh9l9uA2K7s6G6Ezvouq0IcctUkHBJvZIIbBekcMDwUiHXS
VrTOZmhjmouTIH75wRpljjawQCtU+QlUEgNdwy/E5KGDLXTDEfiQ+KaVXDM/gqgc
Vw1HQGUtgG3vO5cpXd2ULZmcgcgljfKbdE9XEJVNfUHgS7luPj6Lvcdg8dhpUHLJ
/SYUGiYOalE5AGut17g7bCUuEv6cpvA5YtT3yIjj1w6ZWI2C95MO31Yx0pFAYiS9
sbWVZQP44IxXs13V8j6W1GACXf3xvvAQX0NPIKlNFA39e31UtaI5XBXMZohJ8XIR
jL9oi+hK3t4HqVjAOo4MDmjS0WGPXdjlzy+ZqeBnORk8yYipdOFKUTbLoWolh2uW
andsTmRdVw0kOBtnf7b/Y9l0mzueunJckKcbFzKWU1S6L9zREE1XeHFPdrsIIteM
BXSIhWTf+hoy7eMgEiF+r06iQVRGfVesO7furOxQCf2ylcnrXGTTCKie9E0rujor
dy7MLGM6Jr7HdSf4pk7xDURYQckHk0mbDE8TIfus7pQoDXyL59/RQE7d7J24G+WG
VxLT1VC6O3pN5b0d3+jm
=l0+e
-----END PGP SIGNATURE-----
--lqnbr8eGJkxsxCaktRGx4snVu3wOX4oSv--
Clément Pit--Claudel <clement.pitclaudel@HIDDEN>:bug-gnu-emacs@HIDDEN.
Full text available.bug-gnu-emacs@HIDDEN:bug#22915; Package emacs.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.