Allow provided-mode-derived-p to work on aliases
* lisp/subr.el (provided-mode-derived-p): Allow this to work on modes that are aliases of other modes (bug#46331). For instance: (provided-mode-derived-p 'javascript-mode 'prog-mode)
This commit is contained in:
parent
23a7da9148
commit
2476abc1f2
1 changed files with 4 additions and 0 deletions
|
|
@ -2231,6 +2231,10 @@ Affects only hooks run in the current buffer."
|
|||
"Non-nil if MODE is derived from one of MODES or their aliases.
|
||||
Uses the `derived-mode-parent' property of the symbol to trace backwards.
|
||||
If you just want to check `major-mode', use `derived-mode-p'."
|
||||
;; If MODE is an alias, then look up the real mode function first.
|
||||
(when-let ((alias (symbol-function mode)))
|
||||
(when (symbolp alias)
|
||||
(setq mode alias)))
|
||||
(while
|
||||
(and
|
||||
(not (memq mode modes))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue