[Top][All Lists]

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

Re: fundamental-mode-hook

From: Lennart Borgman (gmail)
Subject: Re: fundamental-mode-hook
Date: Fri, 09 Feb 2007 00:05:01 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20061207 Thunderbird/ Mnenhy/

Edward O'Connor wrote:
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))))

Thanks, looks useful.

reply via email to

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