aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman2001-12-12 09:26:43 +0000
committerRichard M. Stallman2001-12-12 09:26:43 +0000
commit31ca596b970d838877353b06df675c7a4fdeddb2 (patch)
tree54e3ccf97efb7463b51593357ca3f4264421ce55
parent6b66d0289ef51b4f9b923b656a7597308461b318 (diff)
downloademacs-31ca596b970d838877353b06df675c7a4fdeddb2.tar.gz
emacs-31ca596b970d838877353b06df675c7a4fdeddb2.zip
(derived-mode-p): Moved here from derived.el.
-rw-r--r--lisp/subr.el10
1 files changed, 10 insertions, 0 deletions
diff --git a/lisp/subr.el b/lisp/subr.el
index 4232fd77e09..4029b7fa334 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1294,6 +1294,16 @@ Only affects hooks run in the current buffer."
1294 (let ((delay-mode-hooks t)) 1294 (let ((delay-mode-hooks t))
1295 ,@body))) 1295 ,@body)))
1296 1296
1297;; PUBLIC: find if the current mode derives from another.
1298
1299(defun derived-mode-p (&rest modes)
1300 "Non-nil if the current major mode is derived from one of MODES.
1301Uses the `derived-mode-parent' property of the symbol to trace backwards."
1302 (let ((parent major-mode))
1303 (while (and (not (memq parent modes))
1304 (setq parent (get parent 'derived-mode-parent))))
1305 parent))
1306
1297(defmacro with-syntax-table (table &rest body) 1307(defmacro with-syntax-table (table &rest body)
1298 "Evaluate BODY with syntax table of current buffer set to a copy of TABLE. 1308 "Evaluate BODY with syntax table of current buffer set to a copy of TABLE.
1299The syntax table of the current buffer is saved, BODY is evaluated, and the 1309The syntax table of the current buffer is saved, BODY is evaluated, and the