DOCSTRING: an optional documentation string--if you do not supply one,
the function will attempt to invent something useful.
BODY: forms to execute just before running the
- hooks for the new mode.
+ hooks for the new mode. Do not use `interactive' here.
Here is how you could define LaTeX-Thesis mode as a variant of LaTeX mode:
`(progn
(defvar ,map (make-sparse-keymap))
(defvar ,syntax (make-syntax-table))
- (defvar ,abbrev)
- (define-abbrev-table ',abbrev nil)
+ (defvar ,abbrev
+ (progn (define-abbrev-table ',abbrev nil) ,abbrev))
(put ',child 'derived-mode-parent ',parent)
(defun ,child ()
; Run the hooks, if any.
(run-mode-hooks ',hook)))))
-;; PUBLIC: find if the current mode derives from another.
-
-;;; ;;;###autoload
-(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))
-
;; PUBLIC: find the ultimate class of a derived mode.
(defun derived-mode-class (mode)