From: "Kévin Le Gouguec" <kevin.legouguec@gmail.com>
To: Gregory Heytings <gregory@heytings.org>
Cc: Eli Zaretskii <eliz@gnu.org>, 60841@debbugs.gnu.org
Subject: bug#60841: 30.0.50; kill-ring-save pauses despite region being highlighted
Date: Tue, 17 Jan 2023 23:03:32 +0100 [thread overview]
Message-ID: <878ri0g6ob.fsf@gmail.com> (raw)
In-Reply-To: <4c2c6cf44ad37e405b06@heytings.org> (Gregory Heytings's message of "Tue, 17 Jan 2023 08:26:53 +0000")
Gregory Heytings <gregory@heytings.org> writes:
>>>> But it would be better to have there a test which would tell us whether the
>>>> region face is "visually different" from the default face. Can we do
>>>> something like that?
>>>
>>> face-differs-from-default-p?
>>
>> Nice catch; IIUC display-supports-face-attributes-p is what is doing the heavy
>> work.
>>
>> Might need to be made smarter wrt :extend though?
>>
>
> Indeed...
>
>>
>> (set-face-background 'region (face-background 'default nil t))
>> (face-differs-from-default-p 'region nil)
>> ; ⇒ :extend
>>
>
> ... although that's a really contrived example.
OK, how about this example:
> (defun mtmm-reset-background ()
> (set-face-attribute 'region nil :background 'unspecified))
Straight from <87vfjhre9z.fsf@zamazal.org> (emacs-devel), i.e. the user
report which resulted in the current code in indicate-copied-region.
Same result: :extend differs, so (face-differs-from-default-p 'region)
returns t, which for this user would cause a regression compared to
(face-background 'region nil t).
> I'm not sure it's TRT to add too much complexity there, so I would suggest to
> add an additional optional argument to face-differs-from-default-p, to exclude
> one or more attributes from the comparison (in this case :extend, but someone
> else might be interested in excluding other attributes in the future).
I really think how face-differs-from-default-p examines attributes…
(and
(not (eq attr-val 'unspecified))
(display-supports-face-attributes-p (list attr attr-val)
frame))
… makes no sense for :extend. Here's an example (and this one is
contrived alright):
(set-face-attribute 'default nil :underline t)
(set-face-attribute 'region nil :underline nil :extend VALUE)
* VALUE is 'unspecified: the condition becomes nil (meaning ":extend
does not make this face look different than default"), whereas that
actually _does_ make a difference (:underline nil too, obviously, and
luckily face-differs-from-default-p picks up on this),
* VALUE is nil: (display-supports-face-attributes-p '(:extend nil))
returns nil (because see gui_supports_face_attributes_p), despite
:extend nil procuding different results for :underline.
* VALUE is t: for the same reason, display-supports-face-attributes-p
returns t, despite :extend t making :underline indistinguishable from
the default face.
Granted, yeah, contrived, since that calls for :underline t on the
default face and who does that.
But since, as we've seen, :extend causes a false positive (face reported
as "displaying differently" despite displaying identically) when a face
has a :background equal to the default's, I don't see how the current
behaviour helps anyone.
next prev parent reply other threads:[~2023-01-17 22:03 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-15 23:38 bug#60841: 30.0.50; kill-ring-save pauses despite region being highlighted Kévin Le Gouguec
2023-01-16 12:47 ` Eli Zaretskii
2023-01-16 21:58 ` Kévin Le Gouguec
2023-01-16 22:28 ` Gregory Heytings
2023-01-17 7:53 ` Kévin Le Gouguec
2023-01-17 8:26 ` Gregory Heytings
2023-01-17 22:03 ` Kévin Le Gouguec [this message]
2023-01-18 13:12 ` Eli Zaretskii
2023-01-18 22:16 ` Kévin Le Gouguec
2023-01-21 8:08 ` Eli Zaretskii
2023-01-22 22:45 ` Kévin Le Gouguec
2023-01-23 13:01 ` Eli Zaretskii
2023-01-23 22:29 ` Kévin Le Gouguec
2023-01-24 13:23 ` Eli Zaretskii
2023-01-28 17:45 ` Kévin Le Gouguec
2023-01-28 18:07 ` Eli Zaretskii
2023-01-29 14:54 ` Kévin Le Gouguec
2023-01-29 15:40 ` Eli Zaretskii
2023-01-29 22:57 ` Kévin Le Gouguec
2023-01-30 12:41 ` Eli Zaretskii
2023-01-30 22:38 ` Kévin Le Gouguec
2023-02-02 10:43 ` Eli Zaretskii
2023-02-02 21:15 ` Kévin Le Gouguec
2023-01-29 17:55 ` Juri Linkov
2023-01-29 19:09 ` Eli Zaretskii
2023-01-29 19:33 ` Eli Zaretskii
2023-01-29 20:32 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878ri0g6ob.fsf@gmail.com \
--to=kevin.legouguec@gmail.com \
--cc=60841@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=gregory@heytings.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).