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?)



_______________________________________________
Help-gnu-emacs mailing list
Help-gnu-emacs@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs

Reply via email to