Commit 501158bc authored by Juri Linkov's avatar Juri Linkov
Browse files

* 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
parent 50ab1da6
2013-12-20 Juri Linkov <juri@jurta.org>
* 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 <juri@jurta.org> 2013-12-19 Juri Linkov <juri@jurta.org>
* isearch.el (isearch-mode-map): Bind `M-s e' to `isearch-edit-string'. * isearch.el (isearch-mode-map): Bind `M-s e' to `isearch-edit-string'.
......
...@@ -164,9 +164,9 @@ When non-nil, each hi-lock command will cycle through faces in ...@@ -164,9 +164,9 @@ When non-nil, each hi-lock command will cycle through faces in
(defface hi-green (defface hi-green
'((((min-colors 88) (background dark)) '((((min-colors 88) (background dark))
(:background "green1" :foreground "black")) (:background "light green" :foreground "black"))
(((background dark)) (:background "green" :foreground "black")) (((background dark)) (:background "green" :foreground "black"))
(((min-colors 88)) (:background "green1")) (((min-colors 88)) (:background "light green"))
(t (:background "green"))) (t (:background "green")))
"Face for hi-lock mode." "Face for hi-lock mode."
:group 'hi-lock-faces) :group 'hi-lock-faces)
...@@ -715,7 +715,7 @@ Otherwise, read face name from minibuffer with completion and history." ...@@ -715,7 +715,7 @@ Otherwise, read face name from minibuffer with completion and history."
"Highlight REGEXP with face FACE." "Highlight REGEXP with face FACE."
;; Hashcons the regexp, so it can be passed to remove-overlays later. ;; Hashcons the regexp, so it can be passed to remove-overlays later.
(setq regexp (hi-lock--hashcons regexp)) (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. ;; Refuse to highlight a text that is already highlighted.
(unless (assoc regexp hi-lock-interactive-patterns) (unless (assoc regexp hi-lock-interactive-patterns)
(push pattern hi-lock-interactive-patterns) (push pattern hi-lock-interactive-patterns)
......
...@@ -1471,13 +1471,12 @@ See also `multi-occur'." ...@@ -1471,13 +1471,12 @@ See also `multi-occur'."
(setq matches (1+ matches)) (setq matches (1+ matches))
(add-text-properties (add-text-properties
(match-beginning 0) (match-end 0) (match-beginning 0) (match-end 0)
(append '(occur-match t) curstring)
`(occur-match t) (when match-face
(when match-face ;; Add `match-face' to faces copied from the buffer.
;; Use `face' rather than `font-lock-face' here (add-face-text-property
;; so as to override faces copied from the buffer. (match-beginning 0) (match-end 0)
`(face ,match-face))) match-face nil curstring))
curstring)
;; Avoid infloop (Bug#7593). ;; Avoid infloop (Bug#7593).
(let ((end (match-end 0))) (let ((end (match-end 0)))
(setq start (if (= start end) (1+ start) end))))) (setq start (if (= start end) (1+ start) end)))))
...@@ -1572,11 +1571,9 @@ See also `multi-occur'." ...@@ -1572,11 +1571,9 @@ See also `multi-occur'."
(buffer-name buf)) (buffer-name buf))
'read-only t)) 'read-only t))
(setq end (point)) (setq end (point))
(add-text-properties beg end (add-text-properties beg end `(occur-title ,buf))
(append (when title-face
(when title-face (add-face-text-property beg end title-face)))
`(font-lock-face ,title-face))
`(occur-title ,buf))))
(goto-char (point-min))))))) (goto-char (point-min)))))))
;; Display total match count and regexp for multi-buffer. ;; Display total match count and regexp for multi-buffer.
(when (and (not (zerop global-lines)) (> (length buffers) 1)) (when (and (not (zerop global-lines)) (> (length buffers) 1))
...@@ -1592,8 +1589,8 @@ See also `multi-occur'." ...@@ -1592,8 +1589,8 @@ See also `multi-occur'."
global-lines (if (= global-lines 1) "" "s"))) global-lines (if (= global-lines 1) "" "s")))
(query-replace-descr regexp))) (query-replace-descr regexp)))
(setq end (point)) (setq end (point))
(add-text-properties beg end (when title-face (when title-face
`(font-lock-face ,title-face)))) (add-face-text-property beg end title-face)))
(goto-char (point-min))) (goto-char (point-min)))
(if coding (if coding
;; CODING is buffer-file-coding-system of the first buffer ;; CODING is buffer-file-coding-system of the first buffer
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment