What you are doing seems convoluted.
And it is partly undefined (here) - e.g., what is the major mode highlight-chars-disable
? That is not defined in library highlight-chars.el, and it doesn't sound like something that would be a good candidate for a major mode.
See the Commentary
of library highlight-chars.el for suggestions.
Something like this, perhaps (and you would put property prevent-highlight-tabs
on any major-mode symbols you like:
(add-hook 'font-lock-mode-hook
(lambda () (unless (get major-mode 'prevent-highlight-tabs)
(hc-highlight-tabs))))
Or something like this (from the Commentary
):
(add-hook 'change-major-mode-hook
(lambda ()
(add-hook 'font-lock-mode-hook 'hc-highlight-tabs)))
(add-hook 'after-change-major-mode-hook
(lambda ()
(when (eq major-mode 'THE-MODE)
(remove-hook 'font-lock-mode-hook 'hc-highlight-tabs)
(hc-dont-highlight-tabs)))
'APPEND)