summaryrefslogtreecommitdiff
path: root/lisp/faces.el
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@gmail.com>2023-01-29 11:23:01 +0100
committerKévin Le Gouguec <kevin.legouguec@gmail.com>2023-02-02 19:39:39 +0100
commitc4988840598b7da84b25d21a1936ce1ab6f6d666 (patch)
tree0899a6fd53ebd903540b5f2e57f02a2d0b565ac4 /lisp/faces.el
parent382ab516cefc974d65622479fb7e844fd982011d (diff)
downloademacs-c4988840598b7da84b25d21a1936ce1ab6f6d666.tar.gz
emacs-c4988840598b7da84b25d21a1936ce1ab6f6d666.tar.bz2
emacs-c4988840598b7da84b25d21a1936ce1ab6f6d666.zip
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 the more extensive predicate face-differs-from-default-p. The patch also fixes a couple of issues with the predicate's implementation, and introduces a new user option in case anyone happened to enjoy unconditional blinking. * 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 users 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. * src/xfaces.c (merge_face_ref): Allow :stipple to be nil, since it is a documented valid value for that attribute. * etc/NEWS: Announce user option.
Diffstat (limited to 'lisp/faces.el')
-rw-r--r--lisp/faces.el11
1 files changed, 10 insertions, 1 deletions
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 @@ If the optional argument FRAME is given, report on face FACE in that frame.
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))