emacsminor-mode

How to disable global minor mode in a specified major mode


I use Prelude, I want enable hs-minor-mode in all prog-modes, except web-mode. I wrote

(add-hook 'prog-mode-hook #'hs-minor-mode)          
(make-variable-buffer-local 'hs-minor-mode)        
(add-hook 'web-mode-hook (lambda () (setq hs-minor-mode nil)))      

in personal.el, but it doesn't work!

What should I do?


Solution

  • Normally, to disable a minor mode, it is not enough to set the variable. You must call the mode function. So try something like:

    (add-hook 'web-mode-hook (lambda () (hs-minor-mode -1)))