Subject: bug#13212: closed (Re: bug#13212: 24.2.90; setf (symbol-function ...) does not set buffer local variable if present)

From: [email-masked] (GNU bug Tracking System)
Date: Mon, 17 Dec 2012 20:08:03 +0000

Your bug report

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

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
13212: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13212
GNU Bug Tracking System
Contact [email-masked] with problems

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

Subject: 24.2.90; setf (symbol-function ...) does not set buffer local variable if present
From: Burton Samograd <[email-masked]>
To: [email-masked]
Date: Mon, 17 Dec 2012 10:26:50 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

In *scratch*

(make-local-variable 'cons)

(setf (symbol-function 'cons) (lambda (x y) (+ x y)))

(cons 1 2)
3

Killing *scratch* and creating a new one gives:

(cons 1 2)
3

Setf on symbol-function is not setting the buffer local binding of the
given variable after is has been made a buffer local variable.

In GNU Emacs 24.2.90.1 (i686-pc-cygwin, X toolkit, Xaw3d scroll bars)
 of 2012-12-12 on CDW764-BURTONS
Windowing system distributor `The Cygwin/X Project', version 11.0.11300000
Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Info

Minor modes in effect:
  diff-auto-refine-mode: t
  winner-mode: t
  display-time-mode: t
  jabber-activity-mode: t
  rcirc-track-minor-mode: t
  shell-dirtrack-mode: t
  show-paren-mode: t
  desktop-save-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  buffer-read-only: t
  line-number-mode: t

Recent input:
<M-backspace> l o c a l - v a r i a b l e SPC ' c o 
n s ) C-j ( c o n s SPC x SPC y ) M-b M-b M-d M-d 1 
SPC 2 C-e C-j C-p C-k C-k C-p C-k ( s e t f SPC ( s 
y m b o l - f u n c t i o n SPC ' c o n s ) S-SPC ( 
l a m b d a SPC ( x SPC y ) S-SPC ( + S-SPC x SPC y 
) ) ) <return> C-p C-e C-j ( c o n s SPC x SPC y <M-backspace> 
<M-backspace> 1 SPC 2 ) C-j M-: ( c o n s SPC 1 SPC 
2 ) <return> M-; M-: M-p <return> M-; M-: M-p <return> 
M-: M-; C-g M-; M-: M-p C-g C-x b * e s h <tab> <return> 
M-: M-p <return> c o n s SPC 1 SPC 2 <return> C-x b 
<return> C-p C-p C-p C-p C-p C-k C-n C-n C-p C-e <return> 
C-n C-k C-k C-n C-k 3 C-p C-p C-p C-p C-p C-p C-p C-a 
C-k C-k C-k M-; M-; C-n C-n M-f M-f M-b C-h f <return> 
C-e M-; C-e M-b <return> M-; M-; M-v C-v C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n M-; M-; C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n 
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-x 2 C-x b <return> 
C-p C-p C-p C-n C-a C-SPC C-n C-n C-n C-n C-n M-; M-; 
C-x b * i n <tab> <return> n u C-n C-n C-n C-n C-n 
<return> M-; C-k M-; M-; M-x r e p o r <tab> <retu
rn>

Recent messages:
Checking 77 files in /home/burton.samograd/src/emacs-git/lisp/obsolete...
Checking for load-path shadows...done
user-error: Node has no Next
3 (#o3, #x3) [3 times]
Quit [2 times]
let: Command attempted to use minibuffer while in minibuffer
Quit
3 (#o3, #x3)
Type "q" in help window to restore its previous buffer.
Mark activated

Load-path shadows:
~/.emacs.d/emacs-jabber-0.8.91/srv hides /usr/local/share/emacs/site-lisp/srv
~/.emacs.d/emacs-jabber-0.8.91/jabber hides /usr/local/share/emacs/site-lisp/jabber
~/.emacs.d/emacs-jabber-0.8.91/jabber-xml hides /usr/local/share/emacs/site-lisp/jabber-xml
~/.emacs.d/emacs-jabber-0.8.91/jabber-xmessage hides /usr/local/share/emacs/site-lisp/jabber-xmessage
~/.emacs.d/emacs-jabber-0.8.91/jabber-wmii hides /usr/local/share/emacs/site-lisp/jabber-wmii
~/.emacs.d/emacs-jabber-0.8.91/jabber-widget hides /usr/local/share/emacs/site-lisp/jabber-widget
~/.emacs.d/emacs-jabber-0.8.91/jabber-watch hides /usr/local/share/emacs/site-lisp/jabber-watch
~/.emacs.d/emacs-jabber-0.8.91/jabber-version hides /usr/local/share/emacs/site-lisp/jabber-version
~/.emacs.d/emacs-jabber-0.8.91/jabber-vcard hides /usr/local/share/emacs/site-lisp/jabber-vcard
~/.emacs.d/emacs-jabber-0.8.91/jabber-vcard-avatars hides /usr/local/share/emacs/site-lisp/jabber-vcard-avatars
~/.emacs.d/emacs-jabber-0.8.91/jabber-util hides /usr/local/share/emacs/site-lisp/jabber-util
~/.emacs.d/emacs-jabber-0.8.91/jabber-truncate hides /usr/local/share/emacs/site-lisp/jabber-truncate
~/.emacs.d/emacs-jabber-0.8.91/jabber-time hides /usr/local/share/emacs/site-lisp/jabber-time
~/.emacs.d/emacs-jabber-0.8.91/jabber-socks5 hides /usr/local/share/emacs/site-lisp/jabber-socks5
~/.emacs.d/emacs-jabber-0.8.91/jabber-si-server hides /usr/local/share/emacs/site-lisp/jabber-si-server
~/.emacs.d/emacs-jabber-0.8.91/jabber-si-common hides /usr/local/share/emacs/site-lisp/jabber-si-common
~/.emacs.d/emacs-jabber-0.8.91/jabber-si-client hides /usr/local/share/emacs/site-lisp/jabber-si-client
~/.emacs.d/emacs-jabber-0.8.91/jabber-search hides /usr/local/share/emacs/site-lisp/jabber-search
~/.emacs.d/emacs-jabber-0.8.91/jabber-screen hides /usr/local/share/emacs/site-lisp/jabber-screen
~/.emacs.d/emacs-jabber-0.8.91/jabber-sawfish hides /usr/local/share/emacs/site-lisp/jabber-sawfish
~/.emacs.d/emacs-jabber-0.8.91/jabber-sasl hides /usr/local/share/emacs/site-lisp/jabber-sasl
~/.emacs.d/emacs-jabber-0.8.91/jabber-roster hides /usr/local/share/emacs/site-lisp/jabber-roster
~/.emacs.d/emacs-jabber-0.8.91/jabber-register hides /usr/local/share/emacs/site-lisp/jabber-register
~/.emacs.d/emacs-jabber-0.8.91/jabber-ratpoison hides /usr/local/share/emacs/site-lisp/jabber-ratpoison
~/.emacs.d/emacs-jabber-0.8.91/jabber-private hides /usr/local/share/emacs/site-lisp/jabber-private
~/.emacs.d/emacs-jabber-0.8.91/jabber-presence hides /usr/local/share/emacs/site-lisp/jabber-presence
~/.emacs.d/emacs-jabber-0.8.91/jabber-ping hides /usr/local/share/emacs/site-lisp/jabber-ping
~/.emacs.d/emacs-jabber-0.8.91/jabber-ourversion hides /usr/local/share/emacs/site-lisp/jabber-ourversion
~/.emacs.d/emacs-jabber-0.8.91/jabber-osd hides /usr/local/share/emacs/site-lisp/jabber-osd
~/.emacs.d/emacs-jabber-0.8.91/jabber-newdisco hides /usr/local/share/emacs/site-lisp/jabber-newdisco
~/.emacs.d/emacs-jabber-0.8.91/jabber-muc hides /usr/local/share/emacs/site-lisp/jabber-muc
~/.emacs.d/emacs-jabber-0.8.91/jabber-muc-nick-completion hides /usr/local/share/emacs/site-lisp/jabber-muc-nick-completion
~/.emacs.d/emacs-jabber-0.8.91/jabber-muc-nick-coloring hides /usr/local/share/emacs/site-lisp/jabber-muc-nick-coloring
~/.emacs.d/emacs-jabber-0.8.91/jabber-modeline hides /usr/local/share/emacs/site-lisp/jabber-modeline
~/.emacs.d/emacs-jabber-0.8.91/jabber-menu hides /usr/local/share/emacs/site-lisp/jabber-menu
~/.emacs.d/emacs-jabber-0.8.91/jabber-logon hides /usr/local/share/emacs/site-lisp/jabber-logon
~/.emacs.d/emacs-jabber-0.8.91/jabber-libnotify hides /usr/local/share/emacs/site-lisp/jabber-libnotify
~/.emacs.d/emacs-jabber-0.8.91/jabber-keymap hides /usr/local/share/emacs/site-lisp/jabber-keymap
~/.emacs.d/emacs-jabber-0.8.91/jabber-keepalive hides /usr/local/share/emacs/site-lisp/jabber-keepalive
~/.emacs.d/emacs-jabber-0.8.91/jabber-iq hides /usr/local/share/emacs/site-lisp/jabber-iq
~/.emacs.d/emacs-jabber-0.8.91/jabber-history hides /usr/local/share/emacs/site-lisp/jabber-history
~/.emacs.d/emacs-jabber-0.8.91/jabber-gmail hides /usr/local/share/emacs/site-lisp/jabber-gmail
~/.emacs.d/emacs-jabber-0.8.91/jabber-ft-server hides /usr/local/share/emacs/site-lisp/jabber-ft-server
~/.emacs.d/emacs-jabber-0.8.91/jabber-ft-common hides /usr/local/share/emacs/site-lisp/jabber-ft-common
~/.emacs.d/emacs-jabber-0.8.91/jabber-ft-client hides /usr/local/share/emacs/site-lisp/jabber-ft-client
~/.emacs.d/emacs-jabber-0.8.91/jabber-festival hides /usr/local/share/emacs/site-lisp/jabber-festival
~/.emacs.d/emacs-jabber-0.8.91/jabber-feature-neg hides /usr/local/share/emacs/site-lisp/jabber-feature-neg
~/.emacs.d/emacs-jabber-0.8.91/jabber-export hides /usr/local/share/emacs/site-lisp/jabber-export
~/.emacs.d/emacs-jabber-0.8.91/jabber-events hides /usr/local/share/emacs/site-lisp/jabber-events
~/.emacs.d/emacs-jabber-0.8.91/jabber-disco hides /usr/local/share/emacs/site-lisp/jabber-disco
~/.emacs.d/emacs-jabber-0.8.91/jabber-core hides /usr/local/share/emacs/site-lisp/jabber-core
~/.emacs.d/emacs-jabber-0.8.91/jabber-console hides /usr/local/share/emacs/site-lisp/jabber-console
~/.emacs.d/emacs-jabber-0.8.91/jabber-conn hides /usr/local/share/emacs/site-lisp/jabber-conn
~/.emacs.d/emacs-jabber-0.8.91/jabber-compose hides /usr/local/share/emacs/site-lisp/jabber-compose
~/.emacs.d/emacs-jabber-0.8.91/jabber-chatstates hides /usr/local/share/emacs/site-lisp/jabber-chatstates
~/.emacs.d/emacs-jabber-0.8.91/jabber-chatbuffer hides /usr/local/share/emacs/site-lisp/jabber-chatbuffer
~/.emacs.d/emacs-jabber-0.8.91/jabber-chat hides /usr/local/share/emacs/site-lisp/jabber-chat
~/.emacs.d/emacs-jabber-0.8.91/jabber-browse hides /usr/local/share/emacs/site-lisp/jabber-browse
~/.emacs.d/emacs-jabber-0.8.91/jabber-bookmarks hides /usr/local/share/emacs/site-lisp/jabber-bookmarks
~/.emacs.d/emacs-jabber-0.8.91/jabber-awesome hides /usr/local/share/emacs/site-lisp/jabber-awesome
~/.emacs.d/emacs-jabber-0.8.91/jabber-avatar hides /usr/local/share/emacs/site-lisp/jabber-avatar
~/.emacs.d/emacs-jabber-0.8.91/jabber-autoloads hides /usr/local/share/emacs/site-lisp/jabber-autoloads
~/.emacs.d/emacs-jabber-0.8.91/jabber-autoaway hides /usr/local/share/emacs/site-lisp/jabber-autoaway
~/.emacs.d/emacs-jabber-0.8.91/jabber-alert hides /usr/local/share/emacs/site-lisp/jabber-alert
~/.emacs.d/emacs-jabber-0.8.91/jabber-ahc hides /usr/local/share/emacs/site-lisp/jabber-ahc
~/.emacs.d/emacs-jabber-0.8.91/jabber-ahc-presence hides /usr/local/share/emacs/site-lisp/jabber-ahc-presence
~/.emacs.d/emacs-jabber-0.8.91/jabber-activity hides /usr/local/share/emacs/site-lisp/jabber-activity
~/.emacs.d/emacs-jabber-0.8.91/hexrgb hides /usr/local/share/emacs/site-lisp/hexrgb
~/.emacs.d/emacs-jabber-0.8.91/fsm hides /usr/local/share/emacs/site-lisp/fsm

Features:
(shadow emacsbug goto-addr view log-edit pcvs-util add-log debug
make-mode dired vc ffap org ob-tangle ob-ref ob-lob ob-table
org-footnote org-src ob-comint ob-keys org-pcomplete org-list org-faces
org-entities org-version ob-emacs-lisp ob org-compat org-macs ob-eval
org-loaddefs cal-menu calendar cal-loaddefs diff-mode grep compile
nxml-uchnm rng-xsd xsd-regexp rng-cmpct rng-nxml rng-valid rng-loc
rng-uri rng-parse nxml-parse rng-match rng-dt rng-util rng-pttrn nxml-ns
nxml-mode nxml-outln nxml-rap nxml-util nxml-glyph nxml-enc xmltok
pcmpl-unix tramp-cmds noutline outline gnus-fun mailalias smtpmail
sendmail epg find-func help-mode jka-compr info misearch multi-isearch
em-unix em-term em-script em-prompt em-ls em-hist em-pred em-glob
em-dirs em-cmpl em-basic em-banner em-alias esh-var esh-io esh-cmd
esh-opt esh-ext esh-proc esh-arg esh-groups eshell esh-module esh-mode
esh-util flow-fill mule-util canlock url-http url-gw url-auth url-queue
url-cache url url-proxy url-privacy url-expand url-methods url-history
url-cookie url-domsuf url-util url-parse url-vars smiley gnus-cite qp
gnus-dup sort shr-color color shr mm-archive mail-extr gnus-async
gnus-bcklg gnus-ml nndraft nnmh nnfolder utf-7 rfc2104 gnutls
network-stream nnimap parse-time utf7 netrc gnus-agent gnus-srvr
gnus-score score-mode nnvirtual gnus-msg gnus-art mm-uu mml2015
epg-config mm-view mml-smime smime dig nntp gnus-cache gnus-sum nnoo
gnus-group gnus-undo nnmail mail-source tramp-cache gnus-start gnus-spec
gnus-int gnus-range message rfc822 mml mml-sec mm-decode mm-bodies
mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums gmm-utils
mailheader gnus-win gnus gnus-ems tramp-sh nnheader mail-utils vc-git
eldoc imenu antlr-mode vc-dispatcher vc-svn cc-langs cc-mode cc-fonts
cc-guess cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
winner time cus-start cus-load etags slime-fancy slime-fontifying-fu
slime-package-fu slime-references slime-scratch slime-presentations
slime-fuzzy slime-fancy-inspector slime-c-p-c slime-editing-commands
slime-autodoc slime-parse slime-repl slime derived easy-mmode pp
hyperspec thingatpt browse-url jabber jabber-libnotify dbus
jabber-awesome jabber-osd jabber-wmii jabber-xmessage jabber-festival
jabber-sawfish jabber-ratpoison jabber-screen jabber-socks5
jabber-ft-server jabber-si-server jabber-ft-client jabber-ft-common
jabber-si-client jabber-si-common jabber-feature-neg jabber-truncate
jabber-time jabber-autoaway jabber-vcard-avatars jabber-chatstates
jabber-events jabber-vcard jabber-avatar mailcap jabber-activity
jabber-watch jabber-modeline jabber-ahc-presence jabber-ahc
jabber-version jabber-ourversion jabber-muc-nick-completion hippie-exp
jabber-browse jabber-search jabber-register jabber-roster
jabber-presence jabber-muc jabber-muc-nick-coloring assoc hexrgb
jabber-newdisco jabber-widget jabber-disco wid-edit jabber-chat
jabber-history jabber-chatbuffer jabber-alert jabber-iq jabber-core
jabber-console sgml-mode ewoc jabber-keymap jabber-sasl sasl
sasl-anonymous sasl-login sasl-plain fsm jabber-logon jabber-conn srv
dns starttls tls jabber-xml xml jabber-menu jabber-autoloads jabber-util
rcirc mailabbrev tramp tramp-compat auth-source eieio gnus-util mm-util
mail-prsvr password-cache tramp-loaddefs shell byte-opt warnings
pcomplete comint ansi-color format-spec advice help-fns advice-preload
edmacro kmacro cl-macs windmove term disp-table easymenu ehelp electric
ring bytecomp byte-compile cconv paren server gv desktop cl cl-lib
time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar
mouse jit-lock font-lock syntax facemenu font-core frame cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev
minibuffer loaddefs button faces cus-face macroexp files text-properties
overlay sha1 md5 base64 format env code-pages mule custom widget
hashtable-print-readable backquote make-network-process dbusbind
dynamic-setting system-font-setting font-render-setting x-toolkit x
multi-tty emacs)