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