简体   繁体   中英

Emacs: How to disable specific global mode in major-mode hook?

I use global-autopair-mode , but with Ruby the ruby-electric-mode provides better autopairing.

I'm a n00b to Emacs and Lisp, so I would have thought you could do something like:

(add-hook 'ruby-mode-hook
          (lambda ()
             (autopair-mode nil)
             (ruby-electric-mode t))

This however doesn't work. Is there a way to disable global modes within a major-mode hook?

Currently I'm using the last solution posted here , but it's not very neat and clean.

autopair mode honors autopair-dont-activate , used like so:

(add-hook 'ruby-mode-hook
          (lambda ()
             (setq autopair-dont-activate t)
             (ruby-electric-mode t))

尝试将(autopair-mode nil)替换为(autopair-mode -1)

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