* lisp/hi-lock.el: More fixes related to revert-buffer.

(hi-lock-set-pattern): Use the same propertized string
for 'overlay-put' property to allow 'remove-overlays'
to remove it while using 'eq' on the property value.
https://lists.gnu.org/archive/html/emacs-devel/2024-06/msg01001.html
This commit is contained in:
Juri Linkov 2024-06-28 09:42:43 +03:00
parent 6cc8ffae9a
commit bf862fc277

View file

@ -769,6 +769,7 @@ SPACES-REGEXP is a regexp to substitute spaces in font-lock search."
;; 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))
(setq subexp (or subexp 0)) (setq subexp (or subexp 0))
(when lighter (setq lighter (propertize lighter 'regexp regexp)))
(let ((pattern (list (lambda (limit) (let ((pattern (list (lambda (limit)
(let ((case-fold-search case-fold) (let ((case-fold-search case-fold)
(search-spaces-regexp spaces-regexp)) (search-spaces-regexp spaces-regexp))
@ -780,10 +781,7 @@ SPACES-REGEXP is a regexp to substitute spaces in font-lock search."
(assoc (or lighter regexp) hi-lock-interactive-lighters)) (assoc (or lighter regexp) hi-lock-interactive-lighters))
(add-to-list 'hi-lock--unused-faces (face-name face)) (add-to-list 'hi-lock--unused-faces (face-name face))
(push pattern hi-lock-interactive-patterns) (push pattern hi-lock-interactive-patterns)
(push (cons (or (and lighter (propertize lighter 'regexp regexp)) (push (cons (or lighter regexp) pattern) hi-lock-interactive-lighters)
regexp)
pattern)
hi-lock-interactive-lighters)
(if (and font-lock-mode (font-lock-specified-p major-mode) (if (and font-lock-mode (font-lock-specified-p major-mode)
(not hi-lock-use-overlays)) (not hi-lock-use-overlays))
(progn (progn