Mercurial > hg > xemacs-beta
diff lisp/derived.el @ 906:7f5ac0d2a71f
[xemacs-hg @ 2002-07-08 08:21:47 by youngs]
2002-06-26 John Paul Wallington <jpw@shootybangbang.com>
* derived.el (define-derived-mode): Put `derived-mode-parent'
property on child.
(derived-mode-p): New function; sync with GNU Emacs 21.
2002-06-26 Jerry James <james@xemacs.org>
* symbols.c (check_sane_subr): Let the symbol be bound if it is an
autoload cookie.
author | youngs |
---|---|
date | Mon, 08 Jul 2002 08:22:00 +0000 |
parents | 023b83f4e54b |
children | e2ddc2a2b794 |
line wrap: on
line diff
--- a/lisp/derived.el Sat Jul 06 21:05:58 2002 +0000 +++ b/lisp/derived.el Mon Jul 08 08:22:00 2002 +0000 @@ -148,6 +148,7 @@ `(progn (derived-mode-init-mode-variables (quote ,child)) + (put (quote ,child) 'derived-mode-parent (quote ,parent)) (defun ,child () ,docstring (interactive) @@ -187,6 +188,17 @@ (setq mode (get mode 'derived-mode-parent))) mode) +;; PUBLIC: find if the current mode derives from another. +;; from GNU Emacs 21 subr.el + +(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)) + ;; Inline functions to construct various names from a mode name.