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

From: Lars Ingebrigtsen <[email-masked]>
Date: Tue, 20 Sep 2022 14:13:08 +0200

Stefan Monnier <[email-masked]> writes:

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

Just recapping a bit here.  A less confusing function to reproduce the
problem:

;;; -*- lexical-binding: t -*-

(let ((data-item 1)
      (more-data 2))
  (defun echo-data (data)
    (interactive (list data-item))
    (message "data: %s %s" more-data data)))

This leads to the following warnings on the trunk:

In toplevel form:
foo.el:3:8: Warning: Unused lexical variable `data-item'
foo.el:6:24: Warning: reference to free variable ‘data-item’