emacs-devel
[Top][All Lists]
Advanced

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

Re: Conditional binding and testing of `lexical-binding'


From: Po Lu
Subject: Re: Conditional binding and testing of `lexical-binding'
Date: Sun, 02 Jan 2022 20:41:55 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.60 (gnu/linux)

LdBeth <andpuke@foxmail.com> writes:

> (static-if (assoc 'lexical-binding (buffer-local-variables))
>    (provide 'lexical-binding))
>
> instead of doing `boundp' test.

I think it should be runtime, because transferring compiled code between
Emacs 23 and more recent versions is relatively common IME.

>> Is this the thing to do?  If not, what advice
>> do you have for adapting a library to use
>> lexical binding when available (Emacs 24+) but
>> to also work when it's unavailable (Emacs < 24)?

>> [The doc just tells you how to convert code to
>> use lexical binding.  I see nothing about how
>> to code compatibly for old and new Emacs.]

+1, there should at least be a paragraph or two in the Lisp reference
manual about that.

OTOH, I don't think there's much to be gained by using lexical binding
at all in code that's supposed to be compatible with versions of Emacs
without lexical binding.

It's not that important.


reply via email to

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