# HG changeset patch # User youngs # Date 1026116520 0 # Node ID 7f5ac0d2a71fb0dee1107f49ef4d378ae2d24f02 # Parent c15f25529e616d17f01b355ea71ac76a15ba91a0 [xemacs-hg @ 2002-07-08 08:21:47 by youngs] 2002-06-26 John Paul Wallington * derived.el (define-derived-mode): Put `derived-mode-parent' property on child. (derived-mode-p): New function; sync with GNU Emacs 21. 2002-06-26 Jerry James * symbols.c (check_sane_subr): Let the symbol be bound if it is an autoload cookie. diff -r c15f25529e61 -r 7f5ac0d2a71f lisp/ChangeLog --- a/lisp/ChangeLog Sat Jul 06 21:05:58 2002 +0000 +++ b/lisp/ChangeLog Mon Jul 08 08:22:00 2002 +0000 @@ -1,3 +1,9 @@ +2002-06-26 John Paul Wallington + + * derived.el (define-derived-mode): Put `derived-mode-parent' + property on child. + (derived-mode-p): New function; sync with GNU Emacs 21. + 2002-06-16 Andy Piper * menubar-items.el (default-menubar): enable windows printing on diff -r c15f25529e61 -r 7f5ac0d2a71f lisp/derived.el --- a/lisp/derived.el Sat Jul 06 21:05:58 2002 +0000 +++ b/lisp/derived.el Mon Jul 08 08:22:00 2002 +0000 @@ -148,6 +148,7 @@ `(progn (derived-mode-init-mode-variables (quote ,child)) + (put (quote ,child) 'derived-mode-parent (quote ,parent)) (defun ,child () ,docstring (interactive) @@ -187,6 +188,17 @@ (setq mode (get mode 'derived-mode-parent))) mode) +;; PUBLIC: find if the current mode derives from another. +;; from GNU Emacs 21 subr.el + +(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)) + ;; Inline functions to construct various names from a mode name. diff -r c15f25529e61 -r 7f5ac0d2a71f src/ChangeLog --- a/src/ChangeLog Sat Jul 06 21:05:58 2002 +0000 +++ b/src/ChangeLog Mon Jul 08 08:22:00 2002 +0000 @@ -1,3 +1,8 @@ +2002-06-26 Jerry James + + * symbols.c (check_sane_subr): Let the symbol be bound if it is an + autoload cookie. + 2002-06-24 Andy Piper * toolbar-x.c (console_type_create_toolbar_x): declare diff -r c15f25529e61 -r 7f5ac0d2a71f src/symbols.c --- a/src/symbols.c Sat Jul 06 21:05:58 2002 +0000 +++ b/src/symbols.c Mon Jul 08 08:22:00 2002 +0000 @@ -3362,6 +3362,8 @@ static void check_sane_subr (Lisp_Subr *subr, Lisp_Object sym) { + Lisp_Object f; + assert (subr->min_args >= 0); assert (subr->min_args <= SUBR_MAX_ARGS); @@ -3373,7 +3375,8 @@ assert (subr->min_args <= subr->max_args); } - assert (UNBOUNDP (XSYMBOL (sym)->function)); + f = XSYMBOL (sym)->function; + assert (UNBOUNDP (f) || (CONSP (f) && EQ (XCAR (f), Qautoload))); } #else #define check_sane_subr(subr, sym) /* nothing */