From 501158bcb9b5fb14e181aad75a9bb612a2cacff5 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Fri, 20 Dec 2013 02:07:08 +0200 Subject: [PATCH] * lisp/replace.el (occur-engine): Use `add-face-text-property' to add the face property to matches and titles. * lisp/hi-lock.el (hi-green): Use lighter color "light green" closer to the palette of other hi-lock colors. (hi-lock-set-pattern): Prepend hi-lock face to the existing face. Fixes: debbugs:14645 --- lisp/ChangeLog | 9 +++++++++ lisp/hi-lock.el | 6 +++--- lisp/replace.el | 25 +++++++++++-------------- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 2818f89c784..d91dd13dd28 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2013-12-20 Juri Linkov + + * replace.el (occur-engine): Use `add-face-text-property' + to add the face property to matches and titles. (Bug#14645) + + * hi-lock.el (hi-green): Use lighter color "light green" closer to + the palette of other hi-lock colors. + (hi-lock-set-pattern): Prepend hi-lock face to the existing face. + 2013-12-19 Juri Linkov * isearch.el (isearch-mode-map): Bind `M-s e' to `isearch-edit-string'. diff --git a/lisp/hi-lock.el b/lisp/hi-lock.el index d0a82cd97b0..37ca83cba31 100644 --- a/lisp/hi-lock.el +++ b/lisp/hi-lock.el @@ -164,9 +164,9 @@ When non-nil, each hi-lock command will cycle through faces in (defface hi-green '((((min-colors 88) (background dark)) - (:background "green1" :foreground "black")) + (:background "light green" :foreground "black")) (((background dark)) (:background "green" :foreground "black")) - (((min-colors 88)) (:background "green1")) + (((min-colors 88)) (:background "light green")) (t (:background "green"))) "Face for hi-lock mode." :group 'hi-lock-faces) @@ -715,7 +715,7 @@ Otherwise, read face name from minibuffer with completion and history." "Highlight REGEXP with face FACE." ;; Hashcons the regexp, so it can be passed to remove-overlays later. (setq regexp (hi-lock--hashcons regexp)) - (let ((pattern (list regexp (list 0 (list 'quote face) t)))) + (let ((pattern (list regexp (list 0 (list 'quote face) 'prepend)))) ;; Refuse to highlight a text that is already highlighted. (unless (assoc regexp hi-lock-interactive-patterns) (push pattern hi-lock-interactive-patterns) diff --git a/lisp/replace.el b/lisp/replace.el index fea8941363d..42f7f3c900a 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -1471,13 +1471,12 @@ See also `multi-occur'." (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)) ;; Avoid infloop (Bug#7593). (let ((end (match-end 0))) (setq start (if (= start end) (1+ start) end))))) @@ -1572,11 +1571,9 @@ See also `multi-occur'." (buffer-name buf)) 'read-only t)) (setq end (point)) - (add-text-properties beg end - (append - (when title-face - `(font-lock-face ,title-face)) - `(occur-title ,buf)))) + (add-text-properties beg end `(occur-title ,buf)) + (when title-face + (add-face-text-property beg end title-face))) (goto-char (point-min))))))) ;; Display total match count and regexp for multi-buffer. (when (and (not (zerop global-lines)) (> (length buffers) 1)) @@ -1592,8 +1589,8 @@ See also `multi-occur'." global-lines (if (= global-lines 1) "" "s"))) (query-replace-descr regexp))) (setq end (point)) - (add-text-properties beg end (when title-face - `(font-lock-face ,title-face)))) + (when title-face + (add-face-text-property beg end title-face))) (goto-char (point-min))) (if coding ;; CODING is buffer-file-coding-system of the first buffer -- 2.11.4.GIT