Subject: Re: bug#13212: 24.2.90; setf (symbol-function ...) does not set buffer local variable if present
From: Stefan Monnier <[email-masked]>
To: Burton Samograd <[email-masked]>
Cc: [email-masked]
Date: Mon, 17 Dec 2012 15:06:38 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

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

-- Stefan