The doc of define-globalized-minor-mode
says:
When a major mode is initialized, MODE is actually turned on just
after running the major mode’s hook. However, MODE is not turned
on if the hook has explicitly disabled it.
That means you should explicitly disable column-enforce-mode
in web-mode-hook
. I.e.:
(defun my-web-mode-hook-fun ()
"Disable `column-enforce-mode' in `web-mode'."
(column-enforce-mode -1))
(add-hook 'web-mode-hook #'my-web-mode-hook-fun)
This is the general approach for globalized minor modes. It is not tested for your special case of column-enforce-mode
since I don't use it. Please test the code and report whether it works.
column-enforce-mode
but not inweb-mode
especially on html files. Then I tried that code above but the column-enforce-mode is still active on html , I thought theremove-hook
will disable it if I am on web-mode