From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: how to tell if a mode has a given parent? Date: Sat, 22 Jul 2006 08:44:52 -0700 Message-ID: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1153583147 21224 80.91.229.2 (22 Jul 2006 15:45:47 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 22 Jul 2006 15:45:47 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jul 22 17:45:40 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1G4JfY-0005ua-3L for geh-help-gnu-emacs@m.gmane.org; Sat, 22 Jul 2006 17:45:32 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G4JfX-0003GO-Lf for geh-help-gnu-emacs@m.gmane.org; Sat, 22 Jul 2006 11:45:31 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1G4JfL-0003El-Hp for help-gnu-emacs@gnu.org; Sat, 22 Jul 2006 11:45:19 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1G4JfI-0003Ds-4K for help-gnu-emacs@gnu.org; Sat, 22 Jul 2006 11:45:18 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G4JfH-0003Dp-Tm for help-gnu-emacs@gnu.org; Sat, 22 Jul 2006 11:45:15 -0400 Original-Received: from [148.87.113.118] (helo=rgminet01.oracle.com) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_3DES_EDE_CBC_SHA:24) (Exim 4.52) id 1G4Jfx-0000Pd-0n for help-gnu-emacs@gnu.org; Sat, 22 Jul 2006 11:45:57 -0400 Original-Received: from rcsmt250.oracle.com (rcsmt250.oracle.com [148.87.90.195]) by rgminet01.oracle.com (Switch-3.1.6/Switch-3.1.6) with ESMTP id k6M7OKYg013978 for ; Sat, 22 Jul 2006 09:45:13 -0600 Original-Received: from dhcp-amer-csvpn-gw2-141-144-72-153.vpn.oracle.com by rcsmt250.oracle.com with ESMTP id 1620428011153583097; Sat, 22 Jul 2006 09:44:57 -0600 Original-To: "Help-Gnu-Emacs" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.6604 (9.0.2911.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 X-Whitelist: TRUE X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:36159 Archived-At: 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?