all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#14645: Keep highlighting face foreground
@ 2013-06-17 22:55 Juri Linkov
  2013-06-18 23:31 ` Juri Linkov
  2020-08-13 11:27 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 10+ messages in thread
From: Juri Linkov @ 2013-06-17 22:55 UTC (permalink / raw)
  To: 14645

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






^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2020-08-14  9:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-17 22:55 bug#14645: Keep highlighting face foreground Juri Linkov
2013-06-18 23:31 ` Juri Linkov
2013-06-19 23:14   ` Juri Linkov
2020-08-13 11:35     ` Lars Ingebrigtsen
2013-06-20 23:03   ` Juri Linkov
2020-08-13 11:32   ` Lars Ingebrigtsen
2020-08-13 23:44     ` Juri Linkov
2020-08-14  6:20       ` Eli Zaretskii
2020-08-14  9:50       ` Lars Ingebrigtsen
2020-08-13 11:27 ` Lars Ingebrigtsen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.