[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/compat 46b44c3be1 2/3: Add derived-mode-p from Emacs 27
From: |
ELPA Syncer |
Subject: |
[elpa] externals/compat 46b44c3be1 2/3: Add derived-mode-p from Emacs 27 |
Date: |
Wed, 10 Aug 2022 15:57:24 -0400 (EDT) |
branch: externals/compat
commit 46b44c3be1f650c9f7c56f8e5f70211a796fc977
Author: Philip Kaludercic <philipk@posteo.net>
Commit: Philip Kaludercic <philipk@posteo.net>
Add derived-mode-p from Emacs 27
---
compat-27.el | 6 ++++++
compat.texi | 6 ++++++
2 files changed, 12 insertions(+)
diff --git a/compat-27.el b/compat-27.el
index 89ed286954..99a1d33d83 100644
--- a/compat-27.el
+++ b/compat-27.el
@@ -416,6 +416,12 @@ If you just want to check `major-mode', use
`derived-mode-p'."
(setq mode (if (and parentfn (symbolp parentfn)) parentfn parent)))))
mode)
+;;* UNTESTED
+(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."
+ (apply #'compat--provided-mode-derived-p major-mode modes))
+
;;* UNTESTED
(compat-defmacro ignore-error (condition &rest body)
"Execute BODY; if the error CONDITION occurs, return nil.
diff --git a/compat.texi b/compat.texi
index 27b00337c4..03e690372a 100644
--- a/compat.texi
+++ b/compat.texi
@@ -1474,6 +1474,12 @@ This function returns non-@code{nil} if @var{mode} is
derived from any
of the major modes given by the symbols @var{modes}.
@end defun
+@defun derived-mode-p &rest modes
+This function returns non-@code{nil} if the current major mode is
+derived from any of the major modes given by the symbols @var{modes}.
+
+@xref{Derived Modes,,,elisp}.
+@end defun
@subsection Prefixed Definitions
These functions are prefixed with @code{compat} prefix, and are only