unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
Subject: RE: Query Major Mode
Date: Thu, 21 Jul 2005 12:58:24 -0700	[thread overview]
Message-ID: <DNEMKBNJBGPAOPIJOOICCEMPCKAA.drew.adams@oracle.com> (raw)
In-Reply-To: <20050721193258.GF2692@johnsons-web.com>

      Let's suppose I want to write a subroutine that first, queries
      the major mode, and then calls the appropriate subroutine for
      the mode. *pseudo-code* example:

    (defun previous-subroutine ()
      (cond
        (eq major-mode "python")(previous-python-subroutine)
        (eq major-mode "C")(previous-C-subroutine)
        (eq major-mode "rebol")(previous-rebol-subroutine)
      ))

Wrap your conditions in parens, define your `previous-*' routines, and you
should be more or less good to go.

IOW, you query the major mode programmatically via variable `major-mode',
just as you have done - it's not pseudocode; it's code.

`M-x apropos RET major' shows you variable `major-mode'.

See node "Major Modes" in the Elisp manual (info: `C-h i') for lots of info
on major modes. (I wonder why they picked that name for the node?)

  parent reply	other threads:[~2005-07-21 19:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-07-21 18:33 Query Major Mode Tim Johnson
2005-07-21 18:45 ` Drew Adams
2005-07-21 19:32   ` Tim Johnson
2005-07-21 19:46     ` Peter Dyballa
2005-07-21 20:03       ` Tim Johnson
2005-07-21 19:58     ` Drew Adams [this message]
2005-07-21 22:55     ` Kevin Rodgers
     [not found]   ` <mailman.1216.1121974434.20277.help-gnu-emacs@gnu.org>
2005-07-21 22:59     ` drkm
2005-07-22  5:51     ` Tim X
2005-07-21 18:45 ` Peter Dyballa

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=DNEMKBNJBGPAOPIJOOICCEMPCKAA.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).