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: Sun, 29 Jan 2023 15:54:14 +0100 Message-ID: <87357t2xyh.fsf@gmail.com> References: <87h6wrs71h.fsf@gmail.com> <83zgai4peg.fsf@gnu.org> <5583fd58387746ce7ddc@heytings.org> <87cz7dbns0.fsf@gmail.com> <4c2c6cf44ad37e405b06@heytings.org> <878ri0g6ob.fsf@gmail.com> <83pmbc0yxo.fsf@gnu.org> <87y1pzo5dp.fsf@gmail.com> <834jskmhs8.fsf@gnu.org> <87fsc2qjcs.fsf@gmail.com> <833581jtff.fsf@gnu.org> <87lelsga1f.fsf@gmail.com> <83r0vkgj7l.fsf@gnu.org> <87h6wawo2k.fsf@gmail.com> <831qnea5ye.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7544"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: gregory@heytings.org, 60841@debbugs.gnu.org, Juri Linkov To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Jan 29 15:55:13 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 1pM95N-0001io-Lv for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 29 Jan 2023 15:55:13 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pM95D-0001CB-Vm; Sun, 29 Jan 2023 09:55:04 -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 1pM95C-0001Bo-KA for bug-gnu-emacs@gnu.org; Sun, 29 Jan 2023 09:55:02 -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 1pM95C-00086a-Al for bug-gnu-emacs@gnu.org; Sun, 29 Jan 2023 09:55:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pM95C-0006O1-75 for bug-gnu-emacs@gnu.org; Sun, 29 Jan 2023 09:55: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: Sun, 29 Jan 2023 14:55: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.167500406624499 (code B ref 60841); Sun, 29 Jan 2023 14:55:02 +0000 Original-Received: (at 60841) by debbugs.gnu.org; 29 Jan 2023 14:54:26 +0000 Original-Received: from localhost ([127.0.0.1]:42554 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pM94b-0006N4-Di for submit@debbugs.gnu.org; Sun, 29 Jan 2023 09:54:26 -0500 Original-Received: from mail-wm1-f54.google.com ([209.85.128.54]:44630) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pM94Y-0006Mo-M4 for 60841@debbugs.gnu.org; Sun, 29 Jan 2023 09:54:24 -0500 Original-Received: by mail-wm1-f54.google.com with SMTP id l41-20020a05600c1d2900b003daf986faaeso6528140wms.3 for <60841@debbugs.gnu.org>; Sun, 29 Jan 2023 06:54:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=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=CFqjxTehHg56GKv5bIlrv/PIXLt3QEZAgj1slFLbmxc=; b=X8mcQ5PhOepRT6xcxIBAfxPHvktqgyKkmONx2uZRYgEfQRPdldjcZl97sDRuRIrMnI JzU6OZwhVufaWxxxKmSnV1RoP8tpK295oc1UNS16zRDmDUfebZSidMPLeDPCyXcwmq5D 7BhfH1eJRhlciDuS8NODOYRjFa/5w59hkuUdw3+0j3sBXeOfyji/YzF0wjbiPgagYKAS j7JyTR+jlsjb3NzxoTSsrsYL8f5DfGT2bPJbwIDHqGlMHRC41DuLohN+WeMCWC0XfFXf 4Ex5ViZEaZYyeNbjfjdgFnb/xYXmA+cd7IvLdO0ZralbZy74AURhkhPpLTdgcgcaMqRK fSiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=CFqjxTehHg56GKv5bIlrv/PIXLt3QEZAgj1slFLbmxc=; b=AMDNW0+k0UIcwb2wwJlNWYdwuuWCD5za5R0fRQHndrGa5nCcSvDMR0q6wPCu/ZSpSw nBWQ3BPrpsBMvQaFRWnC28OZWpoM1ALdb4HuA6Tfd7kOb3lS9XRkNLZ9aB9Y+G3iHN6/ Pslge565ysHmY2h3Cle5o1TAmfdP9U6dsTuj/5OhTD46xCvkI0Bb6Hv7nMYUIW7Qt2PX 38+5e6LCjHw0U73XP7UQJOy3nxIZarFydTs95EK7RAvdRS6EtboGSZzCMU8YkwoxX9XX PdZvD0vrxYBXs9B/Ze940oDjd5iKKS5LGxFH9IBLCl3gc5EkupP71lGvwptqDOYhFQ+z 5P6w== X-Gm-Message-State: AO0yUKVkjn2EAtZkVeOvqamUp5YCIJIxAV5ycL7od3CKOUvz5D/pgpcw asgHkwpglXTk0U3xEJcQJDE= X-Google-Smtp-Source: AK7set9dWwtHW/yQr6pcXkCRid5i2Hz8bfIKhWe76jpWPkXN6KAvkGQClr/OqqLI98t9vVQSoe4ZGA== X-Received: by 2002:a05:600c:6008:b0:3da:282b:e774 with SMTP id az8-20020a05600c600800b003da282be774mr2626336wmb.38.1675004056458; Sun, 29 Jan 2023 06:54:16 -0800 (PST) Original-Received: from amdahl30 ([2a01:e0a:253:fe0:2ef0:5dff:fed2:7b49]) by smtp.gmail.com with ESMTPSA id j6-20020a05600c42c600b003dc521f336esm2856786wme.14.2023.01.29.06.54.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Jan 2023 06:54:15 -0800 (PST) In-Reply-To: <831qnea5ye.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 28 Jan 2023 20:07:21 +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:254358 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Eli Zaretskii writes: >> From: K=C3=A9vin Le Gouguec >> Cc: gregory@heytings.org, 60841@debbugs.gnu.org >> Date: Sat, 28 Jan 2023 18:45:07 +0100 >>=20 >> diff-mode.el (re. smerge-mode.el) can indeed be fooled into thinking >> diff-changed (re. smerge-refined-changed) differs-from-default, if one >> "shoots their own foot", for example, setting=E2=80=A6 >>=20 >> * :extend t: fixed by this patch =E2=9C=94=EF= =B8=8F >> * :stipple nil: foot blown with or without the patch =F0=9F=A4=B7 >> * :inherit 'default: foot blown with or without the patch =F0=9F=A4=B7 >>=20 >> Problem with :stipple nil and :inherit 'default explained in [1]. >> indicate-copied-region will become affected if the current patch goes >> in. > > I wouldn't be bothered by :stipple whose value is nil. Why would > someone do such a thing, except when the face is meant to be merged > with other faces (which are expected to have non-nil :stipple > attributes)? The only place where this "matters" is in replace.el, AFAICT: 1. Customize list-matching-lines-prefix-face to 'default, 2. (face-differs-from-default-p list-matching-lines-prefix-face) =E2=86=A6 :stipple 3. Luckily this does not impact replace-el:occur-1, since this check=E2=80= =A6 (if (face-differs-from-default-p list-matching-lines-prefix-face) list-matching-lines-prefix-face) =E2=80=A6 is redundant AFAIU: the goal is to _not_ apply list-matching-lines-prefix-face if it is close to 'default, and instead=E2=80=A6 leave the default face? So why bother checking? CC'ing Juri, who installed this check in bug#14017, for comment in case I missed something. (Hi Juri =F0=9F=91=8B For context, the current report is about refining indicate-copied-region to avoid spuriously considering the region as "unhighlighted" and triggering the point-mark swap; see attached patches. I believe this aspect of the report might also be of interest to you, given your participation in bug#42865) >> > 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. >>=20 >> Should I cook up a user option to unconditionally do the swap before we >> apply the attached? Otherwise we may disgruntle trunk users who >> actually liked the behaviour I reported in the OP (swapping regardless >> of whether region stands out). > > I guess adding such an option would be a good precaution, indeed. OK, two tentative patches attached, because I don't know which makes for the better UX: =E2=96=BC Copy Region Inhibit Blink: Choice: (*) region-stands-out-p Whether the region can be distinguished visually. More ( ) always Always inhibit: never blink point and mark. ( ) ignore Never inhibit: always blink point and mark. ( ) Other predicate function.: ignore State : STANDARD. Whether we should refrain from blinking the cursor after a copy. =E2= =96=BC When this condition holds, =E2=80=98kill-ring-save=E2=80=99 will not= blink the cursor between point and mark to denote the copied region. Groups: Killing =E2=81=82 VS =E2=81=82 =E2=96=BC Copy Region Blink Predicate: Choice: (*) region-indistinguishable-p Whether the current region is not denoted visually. =E2=96=BC This holds when the region is inactive, or when the =E2=80=98region= =E2=80=99 face cannot be distinguished from the =E2=80=98default=E2=80=99 face. ( ) always Always blink point and mark. ( ) ignore Never blink point and mark. ( ) Other predicate function.: ignore State : STANDARD. Whether the cursor must be blinked after a copy. =E2=96=BC When this condition holds, and the copied region fits in the current window, =E2=80=98kill-ring-save=E2=80=99 will blink the curs= or between point and mark for =E2=80=98copy-region-blink-delay=E2=80=99 seconds. Groups: Killing inhibit-vs-predicate.diff shows a comparison of both patches once applied. Boldly marked the new options with "---" in NEWS, because copy-region-blink-delay is not documented in the manual either, but let me know if that should be remedied. Thank you for your time. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=copy-region-blink-predicate.patch >From 7ba1128b72fda681f1368d862e5979d8e340957a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= Date: Sun, 29 Jan 2023 11:23:01 +0100 Subject: [PATCH] Avoid spurious pause in kill-ring-save (Bug#60841) 'indicate-copied-region' checks whether the region is "highlighted" and if not, briefly moves point to mark to give a visual cue of the extent of text that was saved to the kill ring. The region is considered "highlighted" if (a) it is active and (b) its face specifies a :background. That latter condition does not account for the multiple ways in which the face can make the region "visually distinct" from the default face, so switch to a more extensive predicate. * lisp/faces.el (face-differs-from-default-p): Filter out :extend; add rationale for the attributes we ignore. * lisp/simple.el (copy-region-blink-predicate): Add option to let user explicitly opt into or out of blinking point and mark. (region-indistinguishable-p): New function to detect "if there is currently no active region highlighting", leveraging face-differs-from-default-p. (indicate-copied-region): Use it. * etc/NEWS: Announce user option. --- etc/NEWS | 13 +++++++++++++ lisp/faces.el | 11 ++++++++++- lisp/simple.el | 22 ++++++++++++++++++++-- 3 files changed, 43 insertions(+), 3 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index e0175bacfdf..56b6add5d98 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -59,6 +59,19 @@ This allows the user to customize the prompt that is appended by * Editing Changes in Emacs 30.1 +--- +** New user option 'copy-region-blink-predicate'. +By default, when copying a region with 'kill-ring-save', Emacs only +blinks point and mark when the region is not denoted visually, that +is, when either the region is inactive, or the 'region' face is +indistinguishable from the 'default' face. + +The way Emacs evaluated this latter condition sometimes yielded false +positives, so point and mark would blink despite the region being +active and visually distinct. The false positive was fixed; users who +consider blinking unconditionally to be a feature can now set this +user option to 'always'. + --- ** New command 'kill-matching-buffers-no-ask'. This works like 'kill-matching-buffers', but without asking for diff --git a/lisp/faces.el b/lisp/faces.el index 3323eab205a..4933b495a6c 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -304,7 +304,16 @@ face-differs-from-default-p If FRAME is t, report on the defaults for face FACE (for new frames). If FRAME is omitted or nil, use the selected frame." (let ((attrs - (delq :inherit (mapcar 'car face-attribute-name-alist))) + ;; The _value_ of :inherit teaches us nothing about how FACE + ;; looks compared to the default face. Instead, we will ask + ;; `face-attribute' to take inheritance into account when + ;; examining other attributes. + (delq :inherit + ;; A difference in extension past EOL only matters when + ;; relevant attributes (such as :background) also + ;; differ from the default; otherwise this difference + ;; is a false positive. + (delq :extend (mapcar 'car face-attribute-name-alist)))) (differs nil)) (while (and attrs (not differs)) (let* ((attr (pop attrs)) diff --git a/lisp/simple.el b/lisp/simple.el index 7bda368d85d..5832d6449bf 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -5871,6 +5871,25 @@ copy-region-blink-delay :group 'killing :version "28.1") +(defcustom copy-region-blink-predicate #'region-indistinguishable-p + "Whether the cursor must be blinked after a copy. +When this condition holds, and the copied region fits in the +current window, `kill-ring-save' will blink the cursor between +point and mark for `copy-region-blink-delay' seconds." + :type '(radio (function-item region-indistinguishable-p) + (function-item :doc "Always blink point and mark." always) + (function-item :doc "Never blink point and mark." ignore) + (function :tag "Other predicate function.")) + :group 'killing + :version "30.1") + +(defun region-indistinguishable-p () + "Whether the current region is not denoted visually. +This holds when the region is inactive, or when the `region' face +cannot be distinguished from the `default' face." + (not (and (region-active-p) + (face-differs-from-default-p 'region)))) + (defun indicate-copied-region (&optional message-len) "Indicate that the region text has been copied interactively. If the mark is visible in the selected window, blink the cursor between @@ -5891,8 +5910,7 @@ indicate-copied-region ;; was selected. Don't do it if the region is highlighted. (when (and (numberp copy-region-blink-delay) (> copy-region-blink-delay 0) - (or (not (region-active-p)) - (not (face-background 'region nil t)))) + (funcall copy-region-blink-predicate)) ;; Swap point and mark. (set-marker (mark-marker) (point) (current-buffer)) (goto-char mark) -- 2.39.0 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=copy-region-inhibit-blink.patch >From 5fc9250f02cbb26d6c2765a3fa7893f66fa4e6c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Le=20Gouguec?= Date: Sun, 29 Jan 2023 11:23:01 +0100 Subject: [PATCH] Avoid spurious pause in kill-ring-save (Bug#60841) 'indicate-copied-region' checks whether the region is "highlighted" and if not, briefly moves point to mark to give a visual cue of the extent of text that was saved to the kill ring. The region is considered "highlighted" if (a) it is active and (b) its face specifies a :background. That latter condition does not account for the multiple ways in which the face can make the region "visually distinct" from the default face, so switch to a more extensive predicate. * lisp/faces.el (face-differs-from-default-p): Filter out :extend; add rationale for the attributes we ignore. * lisp/simple.el (copy-region-inhibit-blink): Add option to let user explicitly opt into or out of blinking point and mark. (region-stands-out-p): New function to detect "if the region is highlighted", leveraging face-differs-from-default-p. (indicate-copied-region): Use it. * etc/NEWS: Announce user option. --- etc/NEWS | 13 +++++++++++++ lisp/faces.el | 11 ++++++++++- lisp/simple.el | 21 +++++++++++++++++++-- 3 files changed, 42 insertions(+), 3 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index e0175bacfdf..b69b5af9101 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -59,6 +59,19 @@ This allows the user to customize the prompt that is appended by * Editing Changes in Emacs 30.1 +--- +** New user option 'copy-region-inhibit-blink. +By default, when copying a region with 'kill-ring-save', Emacs +refrains from blinking point and mark when the region is denoted +visually, that is, when the region is active, and the 'region' face is +visibly distinct from the 'default' face. + +The way Emacs evaluated this latter condition sometimes yielded false +negatives, so point and mark would blink despite the region being +active and visually distinct. The false negative was fixed; users who +consider blinking unconditionally to be a feature can now set this +user option to 'ignore'. + --- ** New command 'kill-matching-buffers-no-ask'. This works like 'kill-matching-buffers', but without asking for diff --git a/lisp/faces.el b/lisp/faces.el index 3323eab205a..4933b495a6c 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -304,7 +304,16 @@ face-differs-from-default-p If FRAME is t, report on the defaults for face FACE (for new frames). If FRAME is omitted or nil, use the selected frame." (let ((attrs - (delq :inherit (mapcar 'car face-attribute-name-alist))) + ;; The _value_ of :inherit teaches us nothing about how FACE + ;; looks compared to the default face. Instead, we will ask + ;; `face-attribute' to take inheritance into account when + ;; examining other attributes. + (delq :inherit + ;; A difference in extension past EOL only matters when + ;; relevant attributes (such as :background) also + ;; differ from the default; otherwise this difference + ;; is a false positive. + (delq :extend (mapcar 'car face-attribute-name-alist)))) (differs nil)) (while (and attrs (not differs)) (let* ((attr (pop attrs)) diff --git a/lisp/simple.el b/lisp/simple.el index 7bda368d85d..b5e6255fca9 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -5871,6 +5871,24 @@ copy-region-blink-delay :group 'killing :version "28.1") +(defcustom copy-region-inhibit-blink #'region-stands-out-p + "Whether we should refrain from blinking the cursor after a copy. +When this condition holds, `kill-ring-save' will not blink the +cursor between point and mark to denote the copied region." + :type '(radio (function-item region-stands-out-p) + (function-item :doc "Always inhibit: never blink point and mark." always) + (function-item :doc "Never inhibit: always blink point and mark." ignore) + (function :tag "Other predicate function.")) + :group 'killing + :version "30.1") + +(defun region-stands-out-p () + "Whether the region can be distinguished visually. +This takes into account whether the region is active, and whether +the `region' face displays differently from the default face." + (and (region-active-p) + (face-differs-from-default-p 'region))) + (defun indicate-copied-region (&optional message-len) "Indicate that the region text has been copied interactively. If the mark is visible in the selected window, blink the cursor between @@ -5891,8 +5909,7 @@ indicate-copied-region ;; was selected. Don't do it if the region is highlighted. (when (and (numberp copy-region-blink-delay) (> copy-region-blink-delay 0) - (or (not (region-active-p)) - (not (face-background 'region nil t)))) + (not (funcall copy-region-inhibit-blink))) ;; Swap point and mark. (set-marker (mark-marker) (point) (current-buffer)) (goto-char mark) -- 2.39.0 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=inhibit-vs-predicate.diff diff --git a/etc/NEWS b/etc/NEWS index b69b5af9101..56b6add5d98 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -60,17 +60,17 @@ This allows the user to customize the prompt that is appended by * Editing Changes in Emacs 30.1 --- -** New user option 'copy-region-inhibit-blink. -By default, when copying a region with 'kill-ring-save', Emacs -refrains from blinking point and mark when the region is denoted -visually, that is, when the region is active, and the 'region' face is -visibly distinct from the 'default' face. +** New user option 'copy-region-blink-predicate'. +By default, when copying a region with 'kill-ring-save', Emacs only +blinks point and mark when the region is not denoted visually, that +is, when either the region is inactive, or the 'region' face is +indistinguishable from the 'default' face. The way Emacs evaluated this latter condition sometimes yielded false -negatives, so point and mark would blink despite the region being -active and visually distinct. The false negative was fixed; users who +positives, so point and mark would blink despite the region being +active and visually distinct. The false positive was fixed; users who consider blinking unconditionally to be a feature can now set this -user option to 'ignore'. +user option to 'always'. --- ** New command 'kill-matching-buffers-no-ask'. diff --git a/lisp/simple.el b/lisp/simple.el index b5e6255fca9..5832d6449bf 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -5871,23 +5871,24 @@ copy-region-blink-delay :group 'killing :version "28.1") -(defcustom copy-region-inhibit-blink #'region-stands-out-p - "Whether we should refrain from blinking the cursor after a copy. -When this condition holds, `kill-ring-save' will not blink the -cursor between point and mark to denote the copied region." - :type '(radio (function-item region-stands-out-p) - (function-item :doc "Always inhibit: never blink point and mark." always) - (function-item :doc "Never inhibit: always blink point and mark." ignore) +(defcustom copy-region-blink-predicate #'region-indistinguishable-p + "Whether the cursor must be blinked after a copy. +When this condition holds, and the copied region fits in the +current window, `kill-ring-save' will blink the cursor between +point and mark for `copy-region-blink-delay' seconds." + :type '(radio (function-item region-indistinguishable-p) + (function-item :doc "Always blink point and mark." always) + (function-item :doc "Never blink point and mark." ignore) (function :tag "Other predicate function.")) :group 'killing :version "30.1") -(defun region-stands-out-p () - "Whether the region can be distinguished visually. -This takes into account whether the region is active, and whether -the `region' face displays differently from the default face." - (and (region-active-p) - (face-differs-from-default-p 'region))) +(defun region-indistinguishable-p () + "Whether the current region is not denoted visually. +This holds when the region is inactive, or when the `region' face +cannot be distinguished from the `default' face." + (not (and (region-active-p) + (face-differs-from-default-p 'region)))) (defun indicate-copied-region (&optional message-len) "Indicate that the region text has been copied interactively. @@ -5909,7 +5910,7 @@ indicate-copied-region ;; was selected. Don't do it if the region is highlighted. (when (and (numberp copy-region-blink-delay) (> copy-region-blink-delay 0) - (not (funcall copy-region-inhibit-blink))) + (funcall copy-region-blink-predicate)) ;; Swap point and mark. (set-marker (mark-marker) (point) (current-buffer)) (goto-char mark) --=-=-=--