Function: derived-mode-p
derived-mode-p is a byte-compiled function defined in subr.el.gz.
Signature
(derived-mode-p MODES &rest DEPRECATED-ARGS)
Documentation
Return non-nil if the current major mode is derived from one of MODES.
MODES should be a list of symbols or a single mode symbol instead of a list.
This examines the parent modes set by define-derived-mode and also
additional ones set by derived-mode-add-parents.
We also still support the deprecated calling convention:
(derived-mode-p &rest MODES).
Probably introduced at or before Emacs version 27.1.
Aliases
epa--derived-mode-p (obsolete since 28.1)
Source Code
;; Defined in /usr/src/emacs/lisp/subr.el.gz
(defun derived-mode-p (&optional modes &rest old-modes)
"Return non-nil if the current major mode is derived from one of MODES.
MODES should be a list of symbols or a single mode symbol instead of a list.
This examines the parent modes set by `define-derived-mode' and also
additional ones set by `derived-mode-add-parents'.
We also still support the deprecated calling convention:
\(derived-mode-p &rest MODES)."
(declare (side-effect-free t)
;; FIXME: It's cumbersome for external packages to write code which
;; accommodates both the old and the new calling conventions *and*
;; doesn't cause spurious warnings. So let's be more lenient
;; for now and maybe remove `deprecated-args' for Emacs-31.
(advertised-calling-convention (modes &rest deprecated-args) "30.1"))
(provided-mode-derived-p major-mode (if old-modes (cons modes old-modes)
modes)))