unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
Subject: how to tell if a mode has a given parent?
Date: Sat, 22 Jul 2006 08:44:52 -0700	[thread overview]
Message-ID: <MEEKKIABFKKDFJMPIOEBKEJIDDAA.drew.adams@oracle.com> (raw)

How can I determine, in Emacs Lisp, whether a given buffer's mode is derived
from some other mode? For example, shell-mode is derived from comint-mode.
What's a good way, by program, to tell if, say, comint-mode is a parent
(ancestor, really) of the current mode?

Shell mode is derived from comint mode using define-derived-mode (in Emacs
22), so there must be some way to access its ancestry.

I would also like, if possible, a way to do this in versions of Emacs that
don't have define-derived-mode. For example, in Emacs 20, shell mode is
similarly defined in terms of comint mode, but it doesn't use
define-derived-mode to do that - it simply calls comint-mode. Is there a
way, in a shell-mode buffer, to tell that the current mode is derived from
comint mode?

Check the keymap in some way? This sort of works, but it seems fragile and
kludgy. It depends on the child mode not replacing the binding of
`comint-send-input'.

(where-is-internal 'comint-send-input
                   (keymap-parent (current-local-map)))

I'm sure there must be an easy, clean way to do this - what is it?

             reply	other threads:[~2006-07-22 15:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-07-22 15:44 Drew Adams [this message]
2006-07-24 16:00 ` how to tell if a mode has a given parent? Kevin Rodgers
     [not found] <mailman.4354.1153642988.9609.help-gnu-emacs@gnu.org>
2006-07-23 12:18 ` Johan Bockgård
2006-07-23 18:56   ` Drew Adams

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=MEEKKIABFKKDFJMPIOEBKEJIDDAA.drew.adams@oracle.com \
    --to=drew.adams@oracle.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.
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).