GNU bug report logs -
#79320
30.2; Doc of `dolist'
Previous Next
To reply to this bug, email your comments to 79320 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#79320
; Package
emacs
.
(Tue, 26 Aug 2025 19:51:02 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
.
(Tue, 26 Aug 2025 19:51:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Minor enhancement request.
I believe it's the case that the first arg to `dolist' can be a defvar
(special/dynamic variable).
Grepping shows that this is _very rarely_ done. I gave up scanning a
full grep of the Emacs sources - I came across _only_ `apropos-item' as
a defvar: (dolist (apropos-item p) ...)
It's possible that users aren't aware of this possibility, and if they
were then their code could sometimes be a bit simpler. E.g., instead of
this:
(let ((v my-defvar))
(dolist (v some-list)
(setq my-defvar v)
...))
They can do this: (dolist (my-defvar some-list) ...).
Maybe it would be good to point out in the doc that the VAR argument can
be either a lexical variable or a dynamic variable.
The same could be said for other, similar macros, such as `dotimes'.
The doc does say that VAR is bound..., so it doesn't say it _can't_ be a
dynamic variable. But maybe it would help to make this clearer.
In GNU Emacs 30.2 (build 2, x86_64-w64-mingw32) of 2025-08-14 built on
AVALON
Windowing system distributor 'Microsoft Corp.', version 10.0.26100
System Description: Microsoft Windows 10 Pro (v10.0.2009.26100.4652)
Configured using:
'configure --with-modules --without-dbus --with-native-compilation=aot
--without-compress-install --with-tree-sitter CFLAGS=-O2
prefix=/g/rel/install-emacs-30.2'
Configured features:
ACL GIF GMP GNUTLS HARFBUZZ JPEG LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XPM ZLIB
(NATIVE_COMP present but libgccjit not available)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#79320
; Package
emacs
.
(Wed, 27 Aug 2025 11:38:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 79320 <at> debbugs.gnu.org (full text, mbox):
> Date: Tue, 26 Aug 2025 19:49:42 +0000
> From: Drew Adams via "Bug reports for GNU Emacs,
> the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>
> Minor enhancement request.
>
> I believe it's the case that the first arg to `dolist' can be a defvar
> (special/dynamic variable).
>
> Grepping shows that this is _very rarely_ done. I gave up scanning a
> full grep of the Emacs sources - I came across _only_ `apropos-item' as
> a defvar: (dolist (apropos-item p) ...)
Where does the documentation say that the first argument to dolist
_cannot_ be a dynamically-bounded variable?
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#79320
; Package
emacs
.
(Wed, 27 Aug 2025 14:26:02 GMT)
Full text and
rfc822 format available.
Message #11 received at 79320 <at> debbugs.gnu.org (full text, mbox):
> Where does the documentation say that the first argument to dolist
> _cannot_ be a dynamically-bounded variable?
I already said that it does not say that. It correctly
says that "VAR is bound...". The point is that it might
not be obvious that VAR can be a defvar; that's all.
That users might not be aware of this isn't the end of
the world. But it wouldn't hurt to point it out.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#79320
; Package
emacs
.
(Sat, 30 Aug 2025 02:00:03 GMT)
Full text and
rfc822 format available.
Message #14 received at 79320 <at> debbugs.gnu.org (full text, mbox):
[[[ To any NSA and FBI agents reading my email: please consider ]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> I already said that it does not say that. It correctly
> says that "VAR is bound...". The point is that it might
> not be obvious that VAR can be a defvar; that's all.
I agree it would be good to say this explicitly.
Explaining consequences that are not obvious
is part of what makes for a good manual.
Thanks for the suggestion.
--
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#79320
; Package
emacs
.
(Tue, 02 Sep 2025 13:35:02 GMT)
Full text and
rfc822 format available.
Message #17 received at 79320 <at> debbugs.gnu.org (full text, mbox):
Eli Zaretskii <eliz <at> gnu.org> writes:
> Where does the documentation say that the first argument to dolist
> _cannot_ be a dynamically-bounded variable?
It's not absolutely trivial what the semantics are. It could be that
dolist always created a fresh lexical variable VAR of the same name
(although the docstring rather suggests that dolist directly uses the
given variable, and not some new variable of the same name of any kind).
Anyway, like Richard I think it could be good to add a hint nonetheless
because the fact and its consequences are probably not obvious to a lot
of users.
Michael.
This bug report was last modified 5 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.