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: Christopher Dimech
Subject: bug#57481: elisp code utilising derived-mode-parent
Date: Tue, 30 Aug 2022 14:08:31 +0200

> Sent: Tuesday, August 30, 2022 at 6:37 PM
> From: "Phil Sainty" <psainty@orcon.net.nz>
> To: "Christopher Dimech" <dimech@gmx.com>
> Cc: 57481@debbugs.gnu.org
> Subject: Re: bug#57481: elisp code utilising derived-mode-parent
>
> 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)

Can one do something that can be run in elisp code and in
lisp-interaction-mode without requirement that the mode one
is interested in has been loaded?





reply via email to

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