From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Newsgroups: gmane.emacs.bugs Subject: bug#60841: 30.0.50; kill-ring-save pauses despite region being highlighted Date: Tue, 17 Jan 2023 23:03:32 +0100 Message-ID: <878ri0g6ob.fsf@gmail.com> References: <87h6wrs71h.fsf@gmail.com> <83zgai4peg.fsf@gnu.org> <5583fd58387746ce7ddc@heytings.org> <87cz7dbns0.fsf@gmail.com> <4c2c6cf44ad37e405b06@heytings.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6204"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Eli Zaretskii , 60841@debbugs.gnu.org To: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jan 17 23:04:32 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pHu4D-0001Kk-Rb for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 17 Jan 2023 23:04:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pHu3w-0003Ne-Q6; Tue, 17 Jan 2023 17:04:12 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pHu3m-0003Mv-N5 for bug-gnu-emacs@gnu.org; Tue, 17 Jan 2023 17:04:08 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pHu3m-0006Vc-7d for bug-gnu-emacs@gnu.org; Tue, 17 Jan 2023 17:04:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pHu3m-0001vU-23 for bug-gnu-emacs@gnu.org; Tue, 17 Jan 2023 17:04:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 17 Jan 2023 22:04:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 60841 X-GNU-PR-Package: emacs Original-Received: via spool by 60841-submit@debbugs.gnu.org id=B60841.16739930257378 (code B ref 60841); Tue, 17 Jan 2023 22:04:02 +0000 Original-Received: (at 60841) by debbugs.gnu.org; 17 Jan 2023 22:03:45 +0000 Original-Received: from localhost ([127.0.0.1]:38449 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHu3U-0001uw-M3 for submit@debbugs.gnu.org; Tue, 17 Jan 2023 17:03:45 -0500 Original-Received: from mail-wr1-f49.google.com ([209.85.221.49]:40758) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHu3Q-0001ud-DD for 60841@debbugs.gnu.org; Tue, 17 Jan 2023 17:03:43 -0500 Original-Received: by mail-wr1-f49.google.com with SMTP id r2so32084348wrv.7 for <60841@debbugs.gnu.org>; Tue, 17 Jan 2023 14:03:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9pCeufmHcEngEwm6UVao+wLTPlUVYl56ZfNArRFerE4=; b=e0T6i0e7f6R2BJZV56Ebl0uvCvIwcGKEz79NZQoVqYnQg7/ZWLeGFBjs+YcHXefmNQ VohJFy3NWWzmYETfwBeTCKH6rC3cULKwbz9MFfIk98J+28Tux1omHi4qHPM3bXoHRG4Q JnZEkeE0QiALsThDjhd8trLZJHXcK7abHfXzbK5Duz9j5TxlD0kb0kqTFxzcLb+nJhw6 fTZeECAzAnyKMpRs4DfDdNGuDMI+1R3dVrJ4X5OURlmZJetq+lycaCtQdDEfD17ddZlL I3n9redTyunR/M0+zVO4PQLbU/fgJBwZuU1GXPDDOL5KFs6vEqjrwxxPoO6rxtgv18e4 Gq9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=9pCeufmHcEngEwm6UVao+wLTPlUVYl56ZfNArRFerE4=; b=XKf2EX93s23Ht4pv19iowOalXD5o0S8AGSlo66IS3WlQ+XYyw4QWPCxq7iAPnOOUe7 GUgQK3KV8O3bkY1xCZRenIQWn3NO46ha0jGR3cE5agOaSq1hSGKHwilJmUrajT9wzaeq Wcu6JILJ8rTJB6+tijgGHIsKTOqoJfzW1/i+OCRX8cqFHAF3+RJ0uqetIDyseDJzmea0 dxkQUK3AkPtRA5+OQk4c677pZWK4yu2w1kAb8S2ZJsm7BjoSRGdtPSy/sU2UvMYjCsKP 68Zd5OUA8nkv7Xj0ax/9zT0ZFPjvuyrq+H3dEzdnxco78YEnxJNeJY+HvHTNIQda3Y5B hoNQ== X-Gm-Message-State: AFqh2krjtO3FfheV1S7qteWeHjj4P1YXCzNd7e8ApJQP76kRSE6STITk fKOqMI3i/7DbaVM+4EH4DbhXv02dhd4= X-Google-Smtp-Source: AMrXdXvi5H7Ku/xldAUaLLI/r+VTda/kVqH6TekGmBjvwRkIxEfwT3r5uXvyQEX8mi6i5+DV8zPNbQ== X-Received: by 2002:adf:e551:0:b0:2bb:3367:3b1c with SMTP id z17-20020adfe551000000b002bb33673b1cmr4053311wrm.31.1673993014184; Tue, 17 Jan 2023 14:03:34 -0800 (PST) Original-Received: from amdahl30 ([2a01:e0a:253:fe0:2ef0:5dff:fed2:7b49]) by smtp.gmail.com with ESMTPSA id m1-20020a5d6241000000b002bbdaf21744sm26970893wrv.113.2023.01.17.14.03.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jan 2023 14:03:33 -0800 (PST) In-Reply-To: <4c2c6cf44ad37e405b06@heytings.org> (Gregory Heytings's message of "Tue, 17 Jan 2023 08:26:53 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:253587 Archived-At: Gregory Heytings writes: >>>> But it would be better to have there a test which would tell us whethe= r 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) >> ; =E2=87=92 :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 sugges= t to > add an additional optional argument to face-differs-from-default-p, to ex= clude > one or more attributes from the comparison (in this case :extend, but som= eone > else might be interested in excluding other attributes in the future). I really think how face-differs-from-default-p examines attributes=E2=80=A6 (and (not (eq attr-val 'unspecified)) (display-supports-face-attributes-p (list attr attr-val) frame)) =E2=80=A6 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.