bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#51695: 29.0.50; lexical scope closure, interactive spec byte compile


From: Michael Heerdegen
Subject: bug#51695: 29.0.50; lexical scope closure, interactive spec byte compiler warnings/usage issue
Date: Wed, 10 Nov 2021 00:32:03 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of
text editors" <bug-gnu-emacs@gnu.org> writes:

> [...] so in the mean time I recommend you find some workaround

Since one seems to need to make use of the global environment at some
point, I suggest to use a named function as workaround, like in

#+begin_src emacs-lisp
(let* ((data-item 1)
       (more-data 2))
  (defalias 'echo-data--interactive
    (lambda ()
      (list (read-number "number: " (or data-item more-data)))))
  (declare-function echo-data--interactive test) ;defun was not top-level
  (defun echo-data (&optional data)
    (interactive (echo-data--interactive))
    (message "data: %s" (or data data-item)) ))
#+end_src

Michael





reply via email to

[Prev in Thread] Current Thread [Next in Thread]