Closed Wilfred closed 8 years ago
If a major mode defines a keyword with a regular expression, highlight-symbol removes that highlighting permanently.
Here's an example major mode:
(defvar example-font-lock-keywords `((,(rx symbol-start "foobar" symbol-end) 0 font-lock-type-face))) (define-derived-mode example-mode prog-mode "Example" (setq-local font-lock-defaults '(example-font-lock-keywords)))
If you use this major mode, and enable highlight-symbol-mode, then foobar is never longer highlighted after point has been on an instance of foobar.
foobar
I suspect font-lock-remove-keywords (called from highlight-symbol-remove-symbol) is removing the original regexp from font-lock-keywords.
font-lock-remove-keywords
highlight-symbol-remove-symbol
font-lock-keywords
Your suspicion was correct. Thank you.
If a major mode defines a keyword with a regular expression, highlight-symbol removes that highlighting permanently.
Here's an example major mode:
If you use this major mode, and enable highlight-symbol-mode, then
foobar
is never longer highlighted after point has been on an instance offoobar
.I suspect
font-lock-remove-keywords
(called fromhighlight-symbol-remove-symbol
) is removing the original regexp fromfont-lock-keywords
.