Function: provided-mode-derived-p
provided-mode-derived-p is a byte-compiled function defined in
subr.el.gz.
Signature
(provided-mode-derived-p MODE MODES)
Documentation
Non-nil if MODE is derived from a mode that is a member of the list MODES.
MODES can also be a single mode instead of a list.
This examines the parent modes set by define-derived-mode and also
additional ones set by derived-mode-add-parents.
If you just want to check the current major-mode, use derived-mode-p.
We also still support the deprecated calling convention:
(provided-mode-derived-p MODE &rest MODES).
Probably introduced at or before Emacs version 27.1.
Aliases
mode-local-use-bindings-p (obsolete since 30.1)
Source Code
;; Defined in /usr/src/emacs/lisp/subr.el.gz
(defun provided-mode-derived-p (mode &optional modes &rest old-modes)
"Non-nil if MODE is derived from a mode that is a member of the list MODES.
MODES can also be a single mode instead of a list.
This examines the parent modes set by `define-derived-mode' and also
additional ones set by `derived-mode-add-parents'.
If you just want to check the current `major-mode', use `derived-mode-p'.
We also still support the deprecated calling convention:
\(provided-mode-derived-p MODE &rest MODES)."
(declare (side-effect-free t)
(advertised-calling-convention (mode modes) "30.1"))
(cond
(old-modes (setq modes (cons modes old-modes)))
((not (listp modes)) (setq modes (list modes))))
(let ((ps (derived-mode-all-parents mode)))
(while (and modes (not (memq (car modes) ps)))
(setq modes (cdr modes)))
(car modes)))