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

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

bug#13212: 24.2.90; setf (symbol-function ...) does not set buffer local


From: Burton Samograd
Subject: bug#13212: 24.2.90; setf (symbol-function ...) does not set buffer local variable if present
Date: Mon, 17 Dec 2012 13:31:29 -0700
User-agent: Gnus/5.1299999999999999 (Gnus v5.13) Emacs/24.2.90 (cygwin)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> tags 13212 notabug
> thanks
>
>> (make-local-variable 'cons)
>> (setf (symbol-function 'cons) (lambda (x y) (+ x y)))
>
> buffer-local variables affect only variables, not functions.
> I.e. they affect symbol-value, not symbol-function.  Elisp does not provide
> buffer-local functions, so you have to use things like
> (if (derived-mode-p 'foo-mode) ...) instead.
> An alternative is:
>
>    (defvar-local my-foo-function (lambda () (some (default) behavior)))
>
>    (defun my-foo ()
>      (funcall my-foo-function))

Thanks for the explanation.

--
Burton Samograd





reply via email to

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