all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* let vs. buffer local bindings
@ 2002-05-10 14:21 Kim F. Storm
  2002-05-10 13:22 ` Gareth Owen
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Kim F. Storm @ 2002-05-10 14:21 UTC (permalink / raw)
  Cc: Dave Pearson, Gareth Owen


Gareth Owen <usenet@gwowen.freeserve.co.uk> has found a peculiar
interference between let and buffer local bindings.

Does anyone care to comment on the following result:

First try evalling:

(progn
  (make-variable-buffer-local 'foo)
  (setq-default foo 1)
  (list foo
	(let ((foo 2) (buf (generate-new-buffer "baz")))
	  (set-buffer buf) foo)
	(let ((foo 3) (buf (generate-new-buffer "baz")))
	  (set-buffer buf) foo)
	(let ((foo 4) (buf (generate-new-buffer "baz")))
	  (set-buffer buf) foo)))

which produces what seems to be correct:

  (1 2 3 4)


But now eval this:

(progn
  (setq foo 0)
  (list foo
	(let ((foo 2) (buf (generate-new-buffer "baz")))
	  (set-buffer buf) foo)
	(let ((foo 3) (buf (generate-new-buffer "baz")))
	  (set-buffer buf) foo)
	(let ((foo 4) (buf (generate-new-buffer "baz")))
	  (set-buffer buf) foo)))

which produces what seems to be wrong:

  (0 1 3 4)


-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2002-05-13 20:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-05-10 14:21 let vs. buffer local bindings Kim F. Storm
2002-05-10 13:22 ` Gareth Owen
2002-05-10 13:48   ` Dave Pearson
2002-05-10 14:53   ` Kim F. Storm
2002-05-10 13:32 ` Andreas Schwab
2002-05-10 15:31   ` Kim F. Storm
2002-05-10 19:15 ` Stefan Monnier
2002-05-10 22:14   ` Kim F. Storm
2002-05-12 16:34     ` Richard Stallman
2002-05-13 20:07       ` Kim F. Storm

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.