[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fundamental-mode-hook

From: Edward O'Connor
Subject: Re: fundamental-mode-hook
Date: Thu, 08 Feb 2007 17:55:43 -0500
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/21.3 (berkeley-unix)

Lennart asked:

> What is the right way to find out if a function is a major mode?

Kevin Rodgers posted the following function to g.e.h or somewhere
similar some number of years ago. It's just a heuristic, but it works
well enough for my purposes.

| (defun kr-major-mode-p (symbol)
|   "Return non-nil if SYMBOL is a major mode."
|   (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))))


Edward O'Connor

Ense petit placidam sub libertate quietem.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]