[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/subr.el
From: |
Richard M. Stallman |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/subr.el |
Date: |
Wed, 12 Dec 2001 04:26:43 -0500 |
Index: emacs/lisp/subr.el
diff -c emacs/lisp/subr.el:1.277 emacs/lisp/subr.el:1.278
*** emacs/lisp/subr.el:1.277 Tue Dec 11 02:34:39 2001
--- emacs/lisp/subr.el Wed Dec 12 04:26:43 2001
***************
*** 1294,1299 ****
--- 1294,1309 ----
(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