Subject: Re: bug#51695: 29.0.50; lexical scope closure, interactive spec byte compiler warnings/usage issue

From: Stefan Monnier <[email-masked]>
Date: Tue, 09 Nov 2021 08:14:03 -0500

> (this should sum it up but see thread on gmane.emacs.help for background,
> https://lists.gnu.org/archive/html/help-gnu-emacs/2021-11/msg00000.html
> . keep it real)
>
> ;;; -*- lexical-binding: t -*-
> ;;;
> ;;; this file:
> ;;;   http://user.it.uu.se/~embe8573/emacs-init/geh.el
> ;;;   https://dataswamp.org/~incal/emacs-init/geh.el
>
> (let ((data-item 1)
>       (more-data 2) )
>     (defun echo-data (&optional data)
>       (interactive (list (read-number "number: " (or data-item more-data))))
>       (message "data: %s" (or data data-item)) ))
> ;; (echo-data 5)
> ;; (echo-data)
> ;; (call-interactively #'echo-data)
>
> ;; Emacs bugs:
> ;;
> ;; 1. Byte compiler warnings (two cases) relating to the
> ;;    interactive spec:
> ;;
> ;;    geh.el:7:1: Warning: Unused lexical variable `more-data'
> ;;    geh.el:10:54: Warning: reference to free variable ‘data-item’
> ;;    geh.el:10:64: Warning: reference to free variable ‘more-data’
> ;;
> ;; 2. When the compiled version is used interactively:
> ;;
> ;;    Symbol's value as variable is void: data-item

Thanks.  This is a limitation in `cconv.el` tho it will likely require
further changes in `bytecomp.el` and/or `callint.c`.

Not sure when I'll find the time to tackle it, so in the mean time
I recommend you find some workaround,

        Stefan