[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 2476abc: Allow provided-mode-derived-p to work on aliases
From: |
Lars Ingebrigtsen |
Subject: |
master 2476abc: Allow provided-mode-derived-p to work on aliases |
Date: |
Sat, 6 Feb 2021 06:03:53 -0500 (EST) |
branch: master
commit 2476abc1f24f1b2385648cfb08cd9f178422497d
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
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)
---
lisp/subr.el | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lisp/subr.el b/lisp/subr.el
index 6e52bd2..c1624aa 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -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))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 2476abc: Allow provided-mode-derived-p to work on aliases,
Lars Ingebrigtsen <=