[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
A function for getting the minor-modes of the current buffer
From: |
Deniz Dogan |
Subject: |
A function for getting the minor-modes of the current buffer |
Date: |
Sat, 7 Aug 2010 00:56:09 +0200 |
I found that there for some reason is no easy way of getting a list of
all the minor modes for a current buffer. Is there any particular
reason for that?
To try to help, I ripped out and slightly modified some code from
`describe-mode' to do this (see below). Any comments on it?
--
Deniz Dogan
(defun minor-modes ()
"Get the list of minor modes for the current buffer."
(let (minor-modes)
;; Older packages do not register in minor-mode-list but only in
;; minor-mode-alist.
(dolist (x minor-mode-alist)
(setq x (car x))
(unless (memq x minor-mode-list)
(push x minor-mode-list)))
;; Find enabled minor mode we will want to mention.
(dolist (mode minor-mode-list)
;; Document a minor mode if it is listed in minor-mode-alist,
;; non-nil, and has a function definition.
(let ((fmode (or (get mode :minor-mode-function) mode)))
(and (boundp mode) (symbol-value mode)
(fboundp fmode)
(push fmode minor-modes))))
minor-modes))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- A function for getting the minor-modes of the current buffer,
Deniz Dogan <=