Often I have many buffers open and, for whatever reason, I no longer wish to use a particular minor mode with them. Is there currently a built-in way to disable a particular minor mode for all open buffers, or does this require writing a custom elisp function?
This does require a custom elisp function unless the minor mode has a
(global-*-mode) function attached to it.
Luckily, it is a pretty simple function:
(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))))
To use (for example, on
Or call it interactively:
M-x global-disable-mode RET projectile-mode