mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-02-13 19:25:37 -08:00
(derived-mode-p): Moved here from derived.el.
This commit is contained in:
parent
6b66d0289e
commit
31ca596b97
1 changed files with 10 additions and 0 deletions
10
lisp/subr.el
10
lisp/subr.el
|
|
@ -1294,6 +1294,16 @@ Only affects hooks run in the current buffer."
|
|||
(let ((delay-mode-hooks t))
|
||||
,@body)))
|
||||
|
||||
;; PUBLIC: find if the current mode derives from another.
|
||||
|
||||
(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."
|
||||
(let ((parent major-mode))
|
||||
(while (and (not (memq parent modes))
|
||||
(setq parent (get parent 'derived-mode-parent))))
|
||||
parent))
|
||||
|
||||
(defmacro with-syntax-table (table &rest body)
|
||||
"Evaluate BODY with syntax table of current buffer set to a copy of TABLE.
|
||||
The syntax table of the current buffer is saved, BODY is evaluated, and the
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue