[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: |
Stefan Monnier |
Subject: |
bug#13212: 24.2.90; setf (symbol-function ...) does not set buffer local variable if present |
Date: |
Mon, 17 Dec 2012 15:06:38 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
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