Subject: 31.0.50; cond* bind* variable scope - documentation

From: Lester Longley <[email-masked]>
Date: Fri, 15 Aug 2025 14:14:02 -0400

Please see the following excerpt from lisp/emacs-lisp/cond-star.el:

     `(bind* BINDINGS...)' means to bind BINDINGS (as if they were in
`let*')
     for the body of the clause, and all subsequent clauses, since the
`bind*'
     clause is always a non-exit clause.  As a condition, it counts as true
     and runs the body of the clause if the first binding's value is
non-nil.

However, the above qualifier "and all subsequent clauses" is missing from
(info "(elisp) cond* Macro") / doc/lispref/control.texi:

     ‘(bind* BINDINGS...)’ means to bind BINDINGS (like the bindings
     list in ‘let*’, *note Local Variables::) for the body of the
     clause.  As a condition, it counts as true if the first binding’s
     value is non-‘nil’.

I believe that it would be helpful for doc/lispref/control.texi to be
updated with that additional information (i.e., from
lisp/emacs-lisp/cond-star.el), since it's useful in understanding how & why
bind* works.

This aspect was explained in
https://lists.gnu.org/archive/html/emacs-devel/2025-01/msg00429.html:

> That is the purpose of bind*: to bind variables that reach over
subsequent clauses.

... which is where I first noticed it, since (I think) it's not in the
manual.

Thanks,
Lester

In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.38, cairo version 1.16.0) of 2025-08-11 built on penguin
Repository revision: 66eead6fd06d40b919ee6d1de86099592729d671
Repository branch: master
System Description: Debian GNU/Linux 12 (bookworm)

Configured using:
 'configure --with-pgtk 'CFLAGS=-g -O2
 -ffile-prefix-map=/tmp/emacs.git=. -fstack-protector-strong -Wformat
 -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP NOTIFY
INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SOUND THREADS TIFF
TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XIM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-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
  minibuffer-regexp-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr compile comint ansi-osc ansi-color ring comp-run
bytecomp byte-compile comp-common rx emacsbug lisp-mnt message mailcap
yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache
epa derived epg rfc6068 epg-config gnus-util text-property-search
time-date subr-x mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047
rfc2045 ietf-drums mm-util mail-prsvr mail-utils rmc iso-transl tooltip
cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type
elisp-mode mwheel term/pgtk-win pgtk-win term/common-win touch-screen
pgtk-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list
replace newcomment text-mode lisp-mode prog-mode register page tab-bar
menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse
jit-lock font-lock syntax font-core term/tty-colors frame minibuffer
nadvice seq simple cl-generic indonesian philippine cham georgian
utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean
japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european
ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop
case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify dynamic-setting system-font-setting
font-render-setting cairo gtk pgtk lcms2 multi-tty move-toolbar
make-network-process tty-child-frames native-compile emacs)

Memory information:
((conses 16 66922 14238) (symbols 48 6803 0) (strings 32 17289 2551)
 (string-bytes 1 550776) (vectors 16 11399)
 (vector-slots 8 154109 11674) (floats 8 22 13) (intervals 56 252 0)
 (buffers 1064 11))