automatically disable a global minor mode for a specific major mode

Viewed 8180

I have centered-cursor-mode activated globaly, like this:

(require 'centered-cursor-mode)
(global-centered-cursor-mode 1)

It works fine, but there are some major modes where I would like to disable it automatically. For example slime-repl and shell.

There is another question dealing with the same problem, but another minor mode. Unfortunately the answers only offer workarounds for this specific minor mode (global-smart-tab-mode), that doesn't work with centered-cursor-mode.

I tried this hook, but it has no effect. The variable doesn't change.

(eval-after-load "slime"
  (progn
    (add-hook 'slime-repl-mode-hook (lambda ()
                                      (set (make-local-variable 'centered-cursor-mode) nil)))
    (slime-setup '(slime-repl slime-autodoc))))
2 Answers
Related