[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Query Major Mode
From: |
Drew Adams |
Subject: |
RE: Query Major Mode |
Date: |
Thu, 21 Jul 2005 12:58:24 -0700 |
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?)