From: Christopher Dimech <dimech@gmx.com>
To: Phil Sainty <psainty@orcon.net.nz>
Cc: 57481@debbugs.gnu.org
Subject: bug#57481: elisp code utilising derived-mode-parent
Date: Wed, 31 Aug 2022 13:31:15 +0200 [thread overview]
Message-ID: <trinity-4fce17ca-5057-4af6-beac-5a38f89293ad-1661945475404@3c-app-mailcom-bs01> (raw)
In-Reply-To: <fbf558ae2cfa79fb8765a55f06c50d67@webmail.orcon.net.nz>
> 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)
>
Have not encountered "(while" with "(progn" in "(while (progn". Could you be so kind to explain it?
next prev parent reply other threads:[~2022-08-31 11:31 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-30 5:44 bug#57481: elisp code utilising derived-mode-parent Christopher Dimech
2022-08-30 6:37 ` Phil Sainty
2022-08-30 11:33 ` Christopher Dimech
2022-08-30 12:02 ` Phil Sainty
2022-08-30 12:08 ` Christopher Dimech
2022-08-30 12:38 ` Phil Sainty
2022-08-30 12:46 ` Christopher Dimech
2022-08-30 13:02 ` Eli Zaretskii
2022-08-30 13:16 ` Christopher Dimech
2022-08-30 22:07 ` Phil Sainty
2022-08-31 6:24 ` Christopher Dimech
2022-08-31 11:31 ` Christopher Dimech [this message]
2022-08-30 10:36 ` Lars Ingebrigtsen
2022-08-30 11:48 ` Christopher Dimech
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=trinity-4fce17ca-5057-4af6-beac-5a38f89293ad-1661945475404@3c-app-mailcom-bs01 \
--to=dimech@gmx.com \
--cc=57481@debbugs.gnu.org \
--cc=psainty@orcon.net.nz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).