GNU bug report logs -
#10604
23.2; variable lookup: make-local-variable interaction with with-temp-buffer
Previous Next
Reported by: Trey Jackson <trey_jackson <at> mentor.com>
Date: Wed, 25 Jan 2012 21:52:01 UTC
Severity: normal
Tags: wontfix
Merged with 3467
Found in version 23.2
Done: Lars Ingebrigtsen <larsi <at> gnus.org>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 10604 in the body.
You can then email your comments to 10604 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#10604
; Package
emacs
.
(Wed, 25 Jan 2012 21:52:01 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Trey Jackson <trey_jackson <at> mentor.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 25 Jan 2012 21:52:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Switch to *scratch*, and do the following:
(defun func (my-var)
(with-temp-buffer
(message my-var)))
C-j
(func "z")
C-j
; no problem, works as expected
(make-local-variable 'my-var)
C-j
(func "z")
C-j
; ERROR with the stack trace
Debugger entered--Lisp error: (void-variable my-var)
(message my-var)
(progn (message my-var))
(unwind-protect (progn (message my-var)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))
(save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn ...) (and ... ...)))
(with-current-buffer temp-buffer (unwind-protect (progn ...) (and ... ...)))
(let ((temp-buffer ...)) (with-current-buffer temp-buffer (unwind-protect ... ...)))
(with-temp-buffer (message my-var))
func("z")
eval((func "z"))
eval-last-sexp-1(t)
eval-last-sexp(t)
eval-print-last-sexp()
call-interactively(eval-print-last-sexp nil nil)
First discovered by a SO post: http://stackoverflow.com/questions/9008359/why-does-code-in-with-temp-buffer-complain-about-void-variable-when-parent-buf
In GNU Emacs 23.2.1 (x86_64-unknown-linux-gnu, X toolkit, Xaw3d scroll bars)
of 2010-05-11 on quartzville
Windowing system distributor `The X.Org Foundation', version 11.0.60801000
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: C
value of $XMODIFIERS: nil
locale-coding-system: nil
default enable-multibyte-characters: t
Major mode: Debugger
Minor modes in effect:
tooltip-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-encryption-mode: t
auto-compression-mode: t
line-number-mode: t
transient-mark-mode: t
Recent input:
<help-echo> <help-echo> <help-echo> C-x <help-echo>
b <return> C-y C-p C-e C-j ( f u n c SPC " c <backspace>
z " ) C-j ( m a k e - l o c a l - v a r M-/ i a b l
e SPC ' m y - v a r ) C-j ( f u n c SPC " z " ) C-j
<help-echo> <help-echo> <help-echo> <help-echo> <help-echo>
M-x r e p o r t SPC e m a c s SPC <tab> <return>
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Mark set
z
Scanning for dabbrevs...99%
dabbrev-expand: No dynamic expansion for `make-local-var' found
Entering debugger...
Load-path shadows:
None found.
Features:
(shadow sort mail-extr message sendmail regexp-opt ecomplete rfc822 mml
mml-sec password-cache mm-decode mm-bodies mm-encode mailcap mail-parse
rfc2231 rfc2047 rfc2045 qp ietf-drums mailabbrev nnheader gnus-util
netrc time-date mm-util mail-prsvr gmm-utils wid-edit mailheader canlock
sha1 hex-util hashcash mail-utils emacsbug help-mode easymenu view debug
dabbrev tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd
font-setting tool-bar dnd fontset image fringe lisp-mode register page
menu-bar rfn-eshadow timer select scroll-bar mldrag 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 loaddefs button
minibuffer faces cus-face files text-properties overlay md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process font-render-setting x-toolkit x multi-tty
emacs)
--
Trey Jackson
trey_jackson <at> mentor.com
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#10604
; Package
emacs
.
(Thu, 26 Jan 2012 02:13:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 10604 <at> debbugs.gnu.org (full text, mbox):
tags 10604 wontfix
thanks
> Switch to *scratch*, and do the following:
> (defun func (my-var)
> (with-temp-buffer
> (message my-var)))
> C-j
> (func "z")
> C-j
> ; no problem, works as expected
> (make-local-variable 'my-var)
> C-j
> (func "z")
> C-j
> ; ERROR with the stack trace
> Debugger entered--Lisp error: (void-variable my-var)
Yes, that's how dynamic-scoping and buffer-local bindings interact.
Another way to trigger the problem:
(progn
(make-local-variable 'my-var)
(let ((my-var 1))
(with-temp-buffer
(message my-var)))
of course, it's the same because `let' works the same as the binding
done for function arguments.
Maybe there is a way to define the interaction of buffer-local bindings
and dynamically scoped vars in a way that doesn't suffer from this
problem, but it's probably going to suffer from other problems instead,
and it's highly unlikely to be compatible with existing code, so
you're better learning to live with it (the way to do that is to
usually avoid such interactions like the plague: either let-bind or
buffer-local but not both, tho sometimes you can't avoid combining
them).
Stefan
Added tag(s) wontfix.
Request was from
Stefan Monnier <monnier <at> iro.umontreal.ca>
to
control <at> debbugs.gnu.org
.
(Thu, 26 Jan 2012 02:13:02 GMT)
Full text and
rfc822 format available.
Merged 3467 10604.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Thu, 26 Jan 2012 18:16:01 GMT)
Full text and
rfc822 format available.
Added tag(s) patch.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sat, 01 Feb 2014 08:21:02 GMT)
Full text and
rfc822 format available.
Removed tag(s) patch.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Sat, 01 Feb 2014 19:58:01 GMT)
Full text and
rfc822 format available.
bug closed, send any further explanations to
3467 <at> debbugs.gnu.org and Lennart Borgman <lennart.borgman <at> gmail.com>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Tue, 29 Dec 2015 13:19:01 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 27 Jan 2016 12:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 9 years and 197 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.