How do you list the active minor modes in emacs?
+5
A:
C-h m
or M-x describe-mode
shows all the active minor modes (and major mode) and a brief description of each.
Phil
2009-10-02 21:02:09
+1
A:
A list of all the minor mode commands is stored in the variable minor-mode-list
. Finding out whether they're active or not is usually done by checking the variable of the same name. So you can do something like this:
(defun which-active-modes ()
"Give a message of which minor modes are enabled in the current buffer."
(interactiveq)
(let ((active-modes))
(mapc (lambda (mode) (condition-case nil
(if (and (symbolp mode) (symbol-value mode))
(add-to-list 'active-modes mode))
(error nil) ))
minor-mode-list)
(message "Active modes are %s" active-modes)))
Note: this only works for the current buffer (because the minor modes might be only enabled in certain buffers).
Trey Jackson
2009-10-02 21:17:22
add-to-list inside map? convoluted.
jrockway
2009-10-03 03:30:06
@jrockway Not my proudest lisp moment.
Trey Jackson
2009-10-04 23:27:04