bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#57481: elisp code utilising derived-mode-parent


From: Phil Sainty
Subject: bug#57481: elisp code utilising derived-mode-parent
Date: Tue, 30 Aug 2022 18:37:22 +1200
User-agent: Orcon Webmail

You can derive (as it were) such a function from the code of
`provided-mode-derived-p' like so:


 (defun derived-mode-chain (mode)
   "Return the chain of derived modes for MODE."
   (let (chain)
     (while (progn (push mode chain)
                   (let* ((parent (get mode 'derived-mode-parent))
                          (parentfn (symbol-function parent)))
                     (setq mode (if (and parentfn (symbolp parentfn))
                                    parentfn
                                  parent)))))
     (nreverse chain)))


 (derived-mode-chain 'latex-mode)
 => (latex-mode tex-mode text-mode)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]