all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / 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

* 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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.