[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: List of major modes?
From: |
Edward O'Connor |
Subject: |
Re: List of major modes? |
Date: |
Wed, 09 Nov 2005 10:02:39 -0800 |
User-agent: |
Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (darwin) |
David Reitter wrote:
> How would I go about compiling a list of all major modes available in
> the current emacs session?
>From my .emacs; originally from Kevin Rodgers:
(defun kr-major-mode-p (symbol)
"Return non-nil if SYMBOL is a major mode.
Used in `interactive' forms to read major mode names from the user."
(and (fboundp symbol)
(let ((function-name (symbol-name symbol)))
(and (string-match "-mode\\'" function-name)
(not (string-match "\\`turn-\\(on\\|off\\)-"
function-name))))
(not (assq symbol minor-mode-alist))))
You could use this together with `mapatoms' to find all major modes.
Ted
--
Edward O'Connor
hober0@gmail.com
Ense petit placidam sub libertate quietem.