How to disable global minor mode in a specified major mode

3.8k views Asked by At

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?

1

There are 1 answers

3
Tom Tromey On BEST ANSWER

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)))