diff --git a/latex.el b/latex.el index e9b08cc1..0551c320 100644 --- a/latex.el +++ b/latex.el @@ -8087,6 +8087,8 @@ Run after mode hooks and file local variables application." ;;;###autoload (put 'LaTeX-mode 'auctex-function-definition (symbol-function 'LaTeX-mode)) +(TeX-derived-mode-add-parents 'LaTeX-mode '(latex-mode)) + (with-eval-after-load 'semantic/symref/grep (push '(docTeX-mode "*.dtx") semantic-symref-filepattern-alist)) diff --git a/tex-jp.el b/tex-jp.el index ff562e22..36a39ec1 100644 --- a/tex-jp.el +++ b/tex-jp.el @@ -471,6 +471,9 @@ Now `japanese-latex-mode-initialization' is no-op. Don't use it.")) ;;;###autoload (defalias 'japanese-latex-mode #'japanese-LaTeX-mode) +(TeX-derived-mode-add-parents 'japanese-LaTeX-mode + '(japanese-latex-mode latex-mode)) + (defun japanese-LaTeX-guess-engine () "Guess Japanese TeX engine and set it to `TeX-engine'. Document class and its option are taken into account. Do not diff --git a/tex.el b/tex.el index d4fded73..f67e1e31 100644 --- a/tex.el +++ b/tex.el @@ -3875,6 +3875,15 @@ Run after mode hooks and file local variables application." ;;;###autoload (put 'TeX-mode 'auctex-function-definition (symbol-function 'TeX-mode)) +;; COMPATIBILITY for Emacs<30 +(unless (fboundp 'derived-mode-add-parents) + (advice-add 'derived-mode-p :after-until #'TeX--compat-derived-mode-p) + (defun TeX--compat-derived-mode-p (&rest modes) + (let ((extra-parents (get major-mode 'derived-mode-extra-parents))) + (and extra-parents + (cl-loop for parent in extra-parents + thereis (memq parent modes)))))) + ;;; Hilighting ;; FIXME: It's likely that `hilit-patterns-alist' is much obsolete. @@ -4828,6 +4837,16 @@ Also see `ignore'. This is a compatibility function for Emacs versions prior to v.28." t)) +;; COMPATIBILITY for Emacs<30 +(if (fboundp 'derived-mode-add-parents) + (defalias 'TeX-derived-mode-add-parents #'derived-mode-add-parents) + ;; Adapted copy of `derived-mode-add-parents'. + (defun TeX-derived-mode-add-parents (mode extra-parents) + "Add EXTRA-PARENTS to the parents of MODE. +Declares the parents of MODE to be its main parent (as defined +in `define-derived-mode') plus EXTRA-PARENTS." + (put mode 'derived-mode-extra-parents extra-parents))) + (defun TeX-match-buffer (n) "Return the substring corresponding to the N'th match. See `match-data' for details."