GNU bug report logs -
#14645
Keep highlighting face foreground
Previous Next
Reported by: Juri Linkov <juri <at> jurta.org>
Date: Mon, 17 Jun 2013 23:08:02 UTC
Severity: wishlist
Tags: fixed, patch
Fixed in version 28.1
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Now that we have a new function `add-face-text-property' it would be
very useful for features that add faces with a different background
to highlight matches. For instance, `occur' uses `add-text-properties'
to add the `match' face, but currently it removes foreground colors
from the text copied from the fontified buffer.
`add-face-text-property' can help to keep the original foreground colors
in the text copied from fontified buffers. And if someone still wants
to always use the black foreground, this is easy to do by customizing
the `match' face and explicitly selecting a foreground color.
=== modified file 'lisp/replace.el'
--- lisp/replace.el 2013-06-13 22:08:45 +0000
+++ lisp/replace.el 2013-06-17 22:51:03 +0000
@@ -1442,13 +1460,12 @@ (defun occur-engine (regexp buffers out-
(setq matches (1+ matches))
(add-text-properties
(match-beginning 0) (match-end 0)
- (append
- `(occur-match t)
- (when match-face
- ;; Use `face' rather than `font-lock-face' here
- ;; so as to override faces copied from the buffer.
- `(face ,match-face)))
- curstring)
+ '(occur-match t) curstring)
+ (when match-face
+ ;; Add `match-face' to faces copied from the buffer.
+ (add-face-text-property
+ (match-beginning 0) (match-end 0)
+ match-face nil curstring))
(setq start (match-end 0))))
;; Generate the string to insert for this match
(let* ((match-prefix
This bug report was last modified 4 years and 280 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.