Emacs: Disable a specific minor mode for all Lisp buffers

1k Views Asked by At

I want to avoid conflicts between evil-mode and paredit by disabling the former for the buffers in which the latter is active.

The following code didn't work:

(add-hook 'emacs-lisp-mode-hook 'turn-off-evil-mode)
(add-hook 'lisp-mode-hook 'turn-off-evil-mode)
(add-hook 'lisp-interaction-mode-hook 'turn-off-evil-mode)
(add-hook 'inferior-lisp-mode-hook 'turn-off-evil-mode)
(add-hook 'clojure-mode-hook 'turn-off-evil-mode)
(add-hook 'scheme-mode-hook 'turn-off-evil-mode)
(add-hook 'ielm-mode-hook 'turn-off-evil-mode)
(add-hook 'eval-expression-minibuffer-setup-hook 'turn-off-evil-mode)

In other words, how to auto-disable evil-mode for all Lisp buffers?

1

There are 1 best solutions below

3
abo-abo On BEST ANSWER

You could just advice paredit-mode:

(defadvice paredit-mode (around paredit-disable-evil activate)
  (if paredit-mode
      ad-do-it
    (turn-off-evil-mode)
    ad-do-it))

Also, did you try lispy? It's my Paredit-like package that's inspired by vi. It has more features than Paredit, like inline-eval, region manipulation and outlines.