GNU bug report logs -
#21252
25.0.50; `describe-variable': use current buffer, not minibuffer, in `completing-read' PREDICATE
Previous Next
Reported by: Drew Adams <drew.adams <at> oracle.com>
Date: Thu, 13 Aug 2015 15:45:03 UTC
Severity: minor
Tags: fixed
Found in version 25.0.50
Fixed in version 26.1
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 21252 in the body.
You can then email your comments to 21252 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#21252
; Package
emacs
.
(Thu, 13 Aug 2015 15:45:03 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Drew Adams <drew.adams <at> oracle.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 13 Aug 2015 15:45:03 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
This bug is at least as old as Emacs 20! Never noticed it before.
1. emacs -Q
2. Type this in *scratch* and evaluate it using `C-x C-e':
(set (make-local-variable 'toto) 42)
3. C-h v tot TAB
There is no completion for variable `toto'.
The reason is that the PREDICATE arg passed to `completing-read' gets
evaluated with the minibuffer as the current buffer, and `toto' is not
bound in the minibuffer.
The predicate should use `with-current-buffer' to make the originally
current buffer current for the test.
For example, instead of this:
(interactive
(let ((v (variable-at-point))
(enable-recursive-minibuffers t)
val)
(setq val (completing-read (if (symbolp v)
(format
"Describe variable (default %s): " v)
"Describe variable: ")
obarray
(lambda (vv)
(or (get vv 'variable-documentation)
(and (boundp vv) (not (keywordp vv)))))
t nil nil
(if (symbolp v) (symbol-name v))))
(list (if (equal val "")
v (intern val)))))
Use this (or similar - since the file now binds `lexical-binding to t,
you need not resort to backquote+comma for CURBUF):
(interactive
(let ((v (variable-at-point))
(enable-recursive-minibuffers t)
(curbuf (current-buffer))
val)
(setq val (completing-read (if (symbolp v)
(format
"Describe variable (default %s): " v)
"Describe variable: ")
obarray
`(lambda (vv)
(with-current-buffer ',curbuf
(or (get vv 'variable-documentation)
(and (boundp vv) (not (keywordp vv))))))
t nil nil
(if (symbolp v) (symbol-name v))))
(list (if (equal val "")
v (intern val)))))
In GNU Emacs 25.0.50.1 (i686-pc-mingw32)
of 2014-10-20 on LEG570
Bzr revision: 118168 rgm <at> gnu.org-20141020195941-icp42t8ttcnud09g
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
`configure --enable-checking=yes,glyphs CPPFLAGS=-DGLYPH_DEBUG=1'
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#21252
; Package
emacs
.
(Sat, 30 Apr 2016 22:10:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 21252 <at> debbugs.gnu.org (full text, mbox):
Drew Adams <drew.adams <at> oracle.com> writes:
> This bug is at least as old as Emacs 20! Never noticed it before.
>
> 1. emacs -Q
> 2. Type this in *scratch* and evaluate it using `C-x C-e':
>
> (set (make-local-variable 'toto) 42)
>
> 3. C-h v tot TAB
>
> There is no completion for variable `toto'.
>
> The reason is that the PREDICATE arg passed to `completing-read' gets
> evaluated with the minibuffer as the current buffer, and `toto' is not
> bound in the minibuffer.
>
> The predicate should use `with-current-buffer' to make the originally
> current buffer current for the test.
Makes sense. I applied your changes, slightly changed.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
Added tag(s) fixed.
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sat, 30 Apr 2016 22:10:02 GMT)
Full text and
rfc822 format available.
bug marked as fixed in version 25.2, send any further explanations to
21252 <at> debbugs.gnu.org and Drew Adams <drew.adams <at> oracle.com>
Request was from
Lars Ingebrigtsen <larsi <at> gnus.org>
to
control <at> debbugs.gnu.org
.
(Sat, 30 Apr 2016 22:10:03 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
.
(Sun, 29 May 2016 11:24:09 GMT)
Full text and
rfc822 format available.
bug unarchived.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Sun, 04 Dec 2016 02:50:08 GMT)
Full text and
rfc822 format available.
bug Marked as fixed in versions 26.1.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Sun, 04 Dec 2016 02:50:08 GMT)
Full text and
rfc822 format available.
bug No longer marked as fixed in versions 25.2.
Request was from
Glenn Morris <rgm <at> gnu.org>
to
control <at> debbugs.gnu.org
.
(Sun, 04 Dec 2016 02:50:08 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
.
(Sun, 01 Jan 2017 12:24:17 GMT)
Full text and
rfc822 format available.
This bug report was last modified 8 years and 230 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.