help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: equivalent of make-local-variable for defun?


From: Kevin Rodgers
Subject: Re: equivalent of make-local-variable for defun?
Date: Wed, 05 Nov 2008 03:01:47 -0700
User-agent: Thunderbird 2.0.0.17 (Macintosh/20080914)

jrwats wrote:
I'm trying to fix a mode using comint for an inferior lisp that
apparently needs to overwrite  comint-send-region.  I'd rather it not
overwrite ALL buffers' (including my shell-mode buffer) comint-send-
region function.

Is there a way to define a function but local to the current buffer as
when you define a local variable in make-local-variable?

Not really, but you can get the same effect like this:

(defadvice comint-send-region (around inferior-lisp-mode activate)
  "In Inferior Lisp mode, call `inferior-lisp-send-region' instead."
  (if (eq major-mode 'inferior-lisp-mode)
      (apply 'inferior-lisp-send-region (ad-get-args 0))
    ad-do-it))

--
Kevin Rodgers
Denver, Colorado, USA





reply via email to

[Prev in Thread] Current Thread [Next in Thread]