AFAIK, that has always been the case: variables that are let-bound in a function are not known to the C-h v
(aka describe-variable
) mechanism. I don't think edebug
does anything to change this.
Try the following experiment:
(defun foo ()
(let ((bar "baz"))
(setq bar "hunoz")
(princ bar)
(describe-variable 'bar)))
When you call the function with (foo)
in the *scratch*
buffer, you get the most recent value printed out (hunoz
), but describe-variable
does not know about it, so the return value of foo
(which is what the describe-variable
call returns) says that bar is void as a variable
:
hunoz#("bar is void as a variable.
Not documented as a variable.
Probably introduced at or before Emacs version 16.
" 108 110 (button (t) category help-news-button help-args ("/usr/local/share/emacs/29.0.50/etc/NEWS.1-17" 43356)))
OTOH, if you try
(defun foo ()
(let ((bar "baz"))
(setq bar "hunoz")
(princ bar)
(describe-variable 'bar)
(describe-variable 'major-mode)
))
the same value is printed out, but the return value now is what the last call of describe-variable
returns which is the description of major-mode
:
hunoz#("major-mode is a variable defined in ‘C source code’.
Its value is ‘lisp-interaction-mode’
Original value was ‘fundamental-mode’
Local in buffer *scratch*; global value is fundamental-mode
Symbol for current buffer’s major mode.
The default value (normally ‘fundamental-mode’) affects new buffers.
A value of nil means to use the current buffer’s major mode, provided
it is not marked as \"special\".
Automatically becomes buffer-local when set.
You can customize this variable.
" 37 50 (help-args (major-mode C-source) category help-variable-def-button button (t)) 458 467 (help-args (major-mode) category help-customize-variable-button button (t)))
That shows that edebug
has nothing to do with it.
EDIT: It seems that the behavior the OP describes was lost when lexical binding became the default for let-bound variables. As @phils says in a comment:
describe-variable
is looking at the symbol (there's a boundp
call), so a lexically-bound value is invisible to it. So I think this sounds normal. Under dynamic binding if I call (debug)
or (recursive-edit)
then I can see the let-bound value via its symbol.
EDIT: in order to evaluate expresssions in Edebug
, use e <EXP>
(you can use minibuffer history with M-n/M-p
to avoid typing an expresssion more than once) or C-x C-e
for the expression before point - see Edebug eval.