GNU bug report logs - #79320
30.2; Doc of `dolist'

Previous Next

Package: emacs;

Reported by: Drew Adams <drew.adams <at> oracle.com>

Date: Tue, 26 Aug 2025 19:51:02 UTC

Severity: minor

Found in version 30.2

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Drew Adams <drew.adams <at> oracle.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: 30.2; Doc of `dolist'
Date: Tue, 26 Aug 2025 19:49:42 +0000
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)




This bug report was last modified 6 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.