简体   繁体   中英

Emacs: Disable a specific minor mode for all Lisp buffers

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM