unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Phil Sainty <psainty@orcon.net.nz>
To: Christopher Dimech <dimech@gmx.com>
Cc: 57481@debbugs.gnu.org
Subject: bug#57481: elisp code utilising derived-mode-parent
Date: Tue, 30 Aug 2022 18:37:22 +1200	[thread overview]
Message-ID: <fbf558ae2cfa79fb8765a55f06c50d67@webmail.orcon.net.nz> (raw)
In-Reply-To: <trinity-e5874991-7b1d-4b00-9854-aec591619bf5-1661838279808@3c-app-mailcom-bs10>

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	other threads:[~2022-08-30  6:37 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 [this message]
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
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=fbf558ae2cfa79fb8765a55f06c50d67@webmail.orcon.net.nz \
    --to=psainty@orcon.net.nz \
    --cc=57481@debbugs.gnu.org \
    --cc=dimech@gmx.com \
    /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).