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)