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: Mon, 16 Jan 2023 22:58:09 +0100 Message-ID: <87lem2w39q.fsf@gmail.com> References: <87h6wrs71h.fsf@gmail.com> <83zgai4peg.fsf@gnu.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="33595"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 60841@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Jan 16 23:04:25 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 1pHXab-0008YE-Rt for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 16 Jan 2023 23:04:25 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pHXXc-0002yB-H5; Mon, 16 Jan 2023 17:01:20 -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 1pHXVP-0007li-0c for bug-gnu-emacs@gnu.org; Mon, 16 Jan 2023 16:59:04 -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 1pHXVO-0003mA-GN for bug-gnu-emacs@gnu.org; Mon, 16 Jan 2023 16:59:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pHXVO-0002zr-AL for bug-gnu-emacs@gnu.org; Mon, 16 Jan 2023 16:59: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: Mon, 16 Jan 2023 21:59: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.167390629911461 (code B ref 60841); Mon, 16 Jan 2023 21:59:02 +0000 Original-Received: (at 60841) by debbugs.gnu.org; 16 Jan 2023 21:58:19 +0000 Original-Received: from localhost ([127.0.0.1]:35131 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHXUg-0002ym-Mt for submit@debbugs.gnu.org; Mon, 16 Jan 2023 16:58:19 -0500 Original-Received: from mail-wm1-f43.google.com ([209.85.128.43]:40450) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pHXUf-0002ya-HT for 60841@debbugs.gnu.org; Mon, 16 Jan 2023 16:58:18 -0500 Original-Received: by mail-wm1-f43.google.com with SMTP id j34-20020a05600c1c2200b003da1b054057so8808252wms.5 for <60841@debbugs.gnu.org>; Mon, 16 Jan 2023 13:58:17 -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=YtFIH3cyjGXTj/rwZsZ51oHLoK4MA3JNBVxIgmazGNs=; b=aA1EOyzw4eYmP3Q/7GX4++qd7Gye8gj+1+glkqR3A872vpquq5CwDoxAwN2ew4a0hf M++mrC9cY+/lwP5xEXiCXzlUWm9eCS+7uplMce6WTqaGVBvy+WcsqrAlgRKkOOAuekem 6fJeQqkLpjDSHOuzLnjNmvkI2B4TaTGZk12PNosCltWOsTPvokssczZN+TjvxRKHI+Np LXttLQg6v6OmZD8UG/pwFXY7K1RQnQs/w/weOgijkPkY44RDKJZQMDCjJDNAwXgdTHwT BQUvCNErUg6nYKGxtW5YR0Aw95s73IOLDnYODpYQnHgI575zXdrdghMzIfbSpd90Eq0y h8KQ== 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=YtFIH3cyjGXTj/rwZsZ51oHLoK4MA3JNBVxIgmazGNs=; b=NxqpsvVdLrreP40peK5zu8TXaYM2qtNhSaD4hZmG1D2mLDuA0zuKlasAzwTI0rqCj7 /3p7xFDuDjZQFtWXTjtPy/SgnfKjlhpIv32kf7t3LGzEM/b60Y0hmZcDTgK9dp0JAEME 5/1Gnr5kJI+nOCi6Vwl3WE1RpH8aYtENSaEscmiLIeqQd5jM/PTSnhEgdE60jCDOied1 JMVaByqxfhJ0rjt3eORIdc0dWBjI+nJzfVdYl+pl7JJWAnOJR1pFJTSA6E4kC1B7EpA8 Z3hAJzhMJssv2HiKU+MsyK/KE/l9jTx2hh6u44AQShVZi8+eb5L6EFfbopVgPUGk7eC1 SLPA== X-Gm-Message-State: AFqh2krE/EeK6v77QRhPkHj7Uhjw/TEHmS5iuliT4Ekp2Ij4jgMH80fz QP0bEyEo/3l4SJpX5i++xSIa/xogby4= X-Google-Smtp-Source: AMrXdXtv6NGOHMs5mYgrV0z5p7HymF/4IamhCdqMIvNwsGlk6I83V865AIsEN2rBdTot2c5ci5H+0w== X-Received: by 2002:a05:600c:314b:b0:3d2:3ca2:2d4f with SMTP id h11-20020a05600c314b00b003d23ca22d4fmr814569wmo.36.1673906291296; Mon, 16 Jan 2023 13:58:11 -0800 (PST) Original-Received: from amdahl30 ([2a01:e0a:253:fe0:2ef0:5dff:fed2:7b49]) by smtp.gmail.com with ESMTPSA id y6-20020a1c4b06000000b003da119d7251sm15709138wma.21.2023.01.16.13.58.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Jan 2023 13:58:10 -0800 (PST) In-Reply-To: <83zgai4peg.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 16 Jan 2023 14:47:35 +0200") 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:253519 Archived-At: Eli Zaretskii writes: >> The attached patch handles this foreground + inverse-video switcheroo. >> Not sure how many themes actually do that in the wild, so I'd understand >> if there wasn't much enthusiasm for applying. That face-background >> check has been with us since 2004; haven't found any hint in the BTS >> that anyone else has been bothered by this false negative. > > IMNSHO, this just makes another mini-step (albeit in the right > direction), instead of going all the way. There are other face > attributes that can make the region stand out on display: what about > underline or italics, for example? And vice versa: the face could > have a background that is identical or almost identical to the default > face. Indeed. I wasn't sure how much brain-racking we would feel like devoting to this issue, hence the naive patch; thank you for prompting more discussion. > We could keep adding conditions for more and more face attributes, one > by one. 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? I struggle to find a heuristic that I'd dare call "smart", so here's a dumb one: if _any_ attribute of the region face differs from that of the default face, then odds are whoever customized the region face (theme author or end user) intended for it to "stand out" to some extent? (defun dumb/stands-out-from-default-p () (seq-some (lambda (attribute) (unless (memq attribute '(:extend :inherit)) (let ((default-value (face-attribute 'default attribute nil t)) (region-value (face-attribute 'region attribute nil t))) (and (not (eq region-value 'unspecified)) (not (equal region-value default-value)))))) (mapcar 'car (face-all-attributes 'default)))) > Alternatively, we could add a user option to make the swap > unconditional, because maybe some users would prefer that to splitting > hair in this case. Then we could stop worrying about all those fine > differences. Right, after discovering the feature swap I was surprised to find no way to enable it regardless of whether the region is highlighted. Sure, OT1H I thought Emacs was bugging out on me; OTOH now knowing what's happening (and in particular, knowing that we're in sit-for so not frozen), considering that the region is deactivated when M-w ends, I could imagine some people finding this swap helpful and preferring to have it on always. Wrapping up=E2=80=A6 (a) Would it make sense to introduce a defcustom (copy-region-indication-predicate?) that allows nil, t, or a predicate function? The default value being: (and (region-active-p) (smart/stands-out-from-default-p)) (Random considerations: * nil would be redundant with copy-region-blink-delay 0 or nil, not sure how much we care, * we could require this to always be a function instead, since 'always is a thing) (b) No flash of genius on how to determine whether the region face "stands out", yet.