GNU bug report logs - #9469
buffer-local variables seem to remember previous values

Previous Next

Package: emacs;

Reported by: Le Wang <l26wang <at> gmail.com>

Date: Sat, 10 Sep 2011 17:12:01 UTC

Severity: normal

Tags: notabug

Done: Lars Magne Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Le Wang <l26wang <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: buffer-local variables seem to remember previous values
Date: Sun, 11 Sep 2011 01:07:21 +0800
I've reproed in both Emacs 23.3 and bzr build from a few days ago both
on windows.

Steps:

1. emacs -Q

2. eval this region:

(setq buf-a (create-file-buffer "a"))

(setq foo nil)
(make-variable-buffer-local 'foo)

(defun test1 ()
  (interactive)
  (let (alist)
    (push '(:var . 0) alist)
    (with-current-buffer buf-a
      (setq foo alist))))

(defun test2 ()
  (interactive)
  (with-current-buffer buf-a
    (setcdr (assq :var foo) 20)))

(defun show ()
  (interactive)
  (with-current-buffer buf-a
    (format "    ; foo in 'a' is %s" foo)))

(defun test3 ()
  (interactive)
  (let (alist)
    (push `(:var . ,(+ 0)) alist)
    (with-current-buffer buf-a
      (setq foo alist))))


(test1)
(test2)
(test1)
(insert (show))
(test3)
(insert (show))

Note results on both `insert' lines should be identical but the first
insert some how remembers a previous value.  I find it surprising that
no one has ever come across this before.

-- 
Le




This bug report was last modified 13 years and 307 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.