Tim Johnson writes:
> (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)
> ))
You can also use something like:
(defvar previous-subroutine-function 'previous-subroutine-default
"...")
(make-variable-buffer-local 'previous-subroutine-function)
(defun previous-subroutine ()
"..."
(funcall previous-subroutine-function ...))
(defun previous-python-subroutine ()
...)
(add-hook 'python-mode-hook (lambda ()
(setq previous-subroutine-function
previous-python-subroutine)))
;; ...
You can be interested in the mechanism CEDET provides to
overload functions in a per-mode basis. Cfr. the documentation:
(info "(semantic-langdev)Semantic Overload Mechanism").
--drkm
_______________________________________________
Help-gnu-emacs mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-gnu-emacs