unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* A function for getting the minor-modes of the current buffer
@ 2010-08-06 22:56 Deniz Dogan
  0 siblings, 0 replies; only message in thread
From: Deniz Dogan @ 2010-08-06 22:56 UTC (permalink / raw)
  To: Emacs-Devel devel

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))



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2010-08-06 22:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-06 22:56 A function for getting the minor-modes of the current buffer Deniz Dogan

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).