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

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

Re: Surrounding Lexical Variable Reference in the Body of defun


From: Stefan Monnier
Subject: Re: Surrounding Lexical Variable Reference in the Body of defun
Date: Wed, 22 Aug 2012 11:11:06 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (gnu/linux)

>   1. Why does this restriction exists? Is it inevitable because of
>      some design decision of Emacs? Or is it temporary and removed in
>      a (near) future release?

It is because of a technical limitation in the byte-compiler's handling
of dynamically loaded docstrings.

You can work around this by replacing your defun
with (defalias counter (lambda () (setq x (1+ x)))).

I believe this is fixed in the Emacs trunk (where defun is just a macro
that expands to a defalias+lambda and where the docstrings handling was
improved accordingly).


        Stefan


reply via email to

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