diff options
author | Richard M. Stallman <[email protected]> | 2001-12-12 09:26:43 +0000 |
---|---|---|
committer | Richard M. Stallman <[email protected]> | 2001-12-12 09:26:43 +0000 |
commit | 31ca596b970d838877353b06df675c7a4fdeddb2 (patch) | |
tree | 54e3ccf97efb7463b51593357ca3f4264421ce55 /lisp/subr.el | |
parent | 6b66d0289ef51b4f9b923b656a7597308461b318 (diff) |
(derived-mode-p): Moved here from derived.el.
Diffstat (limited to 'lisp/subr.el')
-rw-r--r-- | lisp/subr.el | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lisp/subr.el b/lisp/subr.el index 4232fd77e0..4029b7fa33 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1294,6 +1294,16 @@ Only affects hooks run in the current buffer." (let ((delay-mode-hooks t)) ,@body))) +;; PUBLIC: find if the current mode derives from another. + +(defun derived-mode-p (&rest modes) + "Non-nil if the current major mode is derived from one of MODES. +Uses the `derived-mode-parent' property of the symbol to trace backwards." + (let ((parent major-mode)) + (while (and (not (memq parent modes)) + (setq parent (get parent 'derived-mode-parent)))) + parent)) + (defmacro with-syntax-table (table &rest body) "Evaluate BODY with syntax table of current buffer set to a copy of TABLE. The syntax table of the current buffer is saved, BODY is evaluated, and the |