1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 18:40:39 -08:00

Drop face from hi-lock--unused-faces only when used

* lisp/hi-lock.el (hi-lock-set-pattern): If REGEXP is already
highlighted, then push FACE into hi-lock--unused-faces (Bug#26666).
* test/lisp/hi-lock-tests.el (hi-lock-bug26666): Add test.
This commit is contained in:
Tino Calancha 2017-04-27 12:01:19 +09:00
parent 2058ed65fb
commit 9af2ecc36d
2 changed files with 42 additions and 1 deletions

View file

@ -695,7 +695,8 @@ with completion and history."
(setq regexp (hi-lock--hashcons regexp))
(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)
(if (assoc regexp hi-lock-interactive-patterns)
(add-to-list 'hi-lock--unused-faces (face-name face))
(push pattern hi-lock-interactive-patterns)
(if (and font-lock-mode (font-lock-specified-p major-mode))
(progn