Closed Mengesh closed 4 years ago
This reproduces in emacs -q with matlab-mode and highlight-numbers-mode, therefore one of these is the culprit.
So I guess the workaround would be
(remove-hook 'matlab-mode-hook 'highlight-numbers-mode)
but it doesn't work for me and I can't figure out why.
It works with prog-mode-hook
though.
(remove-hook 'prog-mode-hook 'highlight-numbers-mode)
Because highlight-numbers-mode
isn't in matlab-mode-hook
, it's in prog-mode-hook
.
That makes sense :)
(triage) is there anything left to do here?
Wouldn't removing highlight-numbers-mode from prog-mode-hook affect other modes, too?
I found that adding an entry to the hash table highlight-numbers-modelist with key 'matlab-mode and value 'do-not-use works, too!
it would, but I don't think anyone was suggesting that was a satisfactory solution, only that it was sufficient (for debugging's sake)
adding an entry to highlight-numbers-modelist
works, as does the following:
(add-hook 'matlab-mode-hook
;; `highlight-numbers-mode' breaks MATLAB comment coloring --
;; `highlight-numbers-mode' is mostly redundant with
;; `rainbow-identifiers-mode' anyway
(lambda ()
(highlight-numbers-mode -1))
;; We must append the above *after* `spacemacs/run-prog-mode-hooks'
;; in `matlab-mode-hook', since the former hook enables
;; `highlight-numbers-mode'. Note that
;; `spacemacs/run-prog-mode-hooks' is manually added to
;; `matlab-mode-hook' by Spacemacs since the upstream `matlab-mode'
;; package does not derive `matlab-mode' from `prog-mode' (oddly --
;; IIRC the author refused to do so for compatibility with XEmacs).
'append)
which is quite confusing in that it requires appending to achieve the expected effect (whereas, normally, the prog-mode-hook
will always run before any functions in the derived mode's hook). Perhaps we could change where spacemacs/run-prog-mode-hooks
is called to avoid this situation more generally?
That explains why the hook didn't seem to work when I was toying with it, nice to know!
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!
Description :octocat:
Comments in
.m
files are not colored well inmatlab-mode
if they contain a number and some operation symbol like+-*/
.Reproduction guide :beetle:
.m
filematlab-mode
Observed behaviour: :eyes: :broken_heart: The color of comment lines are different
Expected behaviour: :heart: :smile: The color of all comment lines should be the same regardless of the comment text
System Info :computer: