Answers:
除非次要模式(global-*-mode)
附加了功能,否则这确实需要自定义elisp函数。
幸运的是,它是一个非常简单的函数:
(defun global-disable-mode (mode-fn)
"Disable `MODE-FN' in ALL buffers."
(interactive "a")
(dolist (buffer (buffer-list))
(with-current-buffer buffer
(funcall mode-fn -1))))
要使用(例如on projectile-mode
):
(global-disable-mode 'projectile-mode)
或以交互方式调用它:
M-x global-disable-mode RET projectile-mode
M-S-; (dolist ....)
替换mode-fn
。