tags:

views:

124

answers:

2

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
+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
add-to-list inside map? convoluted.
jrockway
@jrockway Not my proudest lisp moment.
Trey Jackson