Article View: comp.lang.lisp
Article #33Re: GNU Emacs native compiled functions
From: Stefan Monnier
Date: Fri, 16 Oct 2026 13:27
Date: Fri, 16 Oct 2026 13:27
39 lines
3422 bytes
3422 bytes
> I still find some quirks in the way Emacs does lexical binding; do you
> need a β;;; -*- lexical-binding: t; -*-β header comment line, or can
> it be done with regular lisp code as β(setq lexical-binding t)β? Also,
> the above code is followed by this line
>
> (setq lexical-binding nil)
>
> because otherwise I found that subsequent use of β(deactivate-mark)β
> was liable to misbehave otherwise. (This might be fixed in newer Emacs
> versions.)
Static-vs-dynamic binding is not just a boolean in the state of the
"Lisp machine" (something which you could change with a `setq`) but is
better thought of as an attribute of source code. At any given time,
you can have several functions using the static dialect of ELisp and
several other functions using the dynamic dialect, and they can all call
each other.
IOW, the static-vs-dynamic property is a static rather than
a dynamic property. π
Imagine compiling a file like:
(setq lexical-binding nil)
(defun my-fun1 (..)
...)
(setq lexical-binding t)
(defun my-fun2 (..)
...)
and take into account that we're only *compiling* the file, so the
`setq`s are not executed: they're just turned into code which will set
the variable when/if the code is later executed.
=== Stefan
Technical Details
Message-ID:
<jwv33u5zsy5.fsf-monnier+comp.lang.lisp@gnu.org>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<113ovuj$23t9c$1@dont-email.me> <114h26m$2b0po$3@dont-email.me> <114kain$3erqe$1@dont-email.me> <114oc02$qbqp$1@dont-email.me> <114odai$qp0b$1@dont-email.me> <114piou$14lmv$2@dont-email.me> <114pno3$16g53$1@dont-email.me> <114pqg5$17lne$1@dont-email.me> <5T_bS.71191$4Fu9.56234@fx05.ams4> <27248.58134.739884.512819@parhasard.net> <87v78mz15a.fsf_-_@debian> <m3h5k5n2au.fsf@pison.robolove.meer.net> <87wlsmo83m.fsf@debian> <m3tsno4bob.fsf@pison.robolove.meer.net> <jwveceqwtg2.fsf-monnier+comp.lang.lisp@gnu.org> <118kcc1$1mri1$2@dont-email.me> <87wlrvendh.fsf@gmail.com> <20261005164228.546@kylheku.com> <jwvo6d7hv2g.fsf-monnier+comp.lang.lisp@gnu.org> <11a3mvl$29qvc$1@dont-email.me> <11argqv$2p8h1$3@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Stefan Monnier <monnier@iro.umontreal.ca> Newsgroups: comp.lang.lisp Subject: Re: GNU Emacs native compiled functions Date: Fri, 16 Oct 2026 09:27:43 -0400 Organization: A noiseless patient Spider Lines: 39 Message-ID: <jwv33u5zsy5.fsf-monnier+comp.lang.lisp@gnu.org> References: <113ovuj$23t9c$1@dont-email.me> <114h26m$2b0po$3@dont-email.me> <114kain$3erqe$1@dont-email.me> <114oc02$qbqp$1@dont-email.me> <114odai$qp0b$1@dont-email.me> <114piou$14lmv$2@dont-email.me> <114pno3$16g53$1@dont-email.me> <114pqg5$17lne$1@dont-email.me> <5T_bS.71191$4Fu9.56234@fx05.ams4> <27248.58134.739884.512819@parhasard.net> <87v78mz15a.fsf_-_@debian> <m3h5k5n2au.fsf@pison.robolove.meer.net> <87wlsmo83m.fsf@debian> <m3tsno4bob.fsf@pison.robolove.meer.net> <jwveceqwtg2.fsf-monnier+comp.lang.lisp@gnu.org> <118kcc1$1mri1$2@dont-email.me> <87wlrvendh.fsf@gmail.com> <20261005164228.546@kylheku.com> <jwvo6d7hv2g.fsf-monnier+comp.lang.lisp@gnu.org> <11a3mvl$29qvc$1@dont-email.me> <11argqv$2p8h1$3@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Date: Fri, 16 Oct 2026 18:45:31 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3748696"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+nDmXoWSgMXV8K6txlKuYf0PBU6IOaahI="; posting-host="d7919aac202ca68b264e52916154b1b8" User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:Qt7AIcQNMCcpBN5WIvoChm2+fiU= sha1:GCBiQIDXheIWSrz55AnK8a5K6mM= sha256:10ttcCm0RKzmiPKpQeIfdVR8sPzxEfg9J8cK8gI66jc= sha1:1rCNe1e8xsVqq5vWsRvCAZc03M8= sha256:YlD+oLSxrrpjTraT+Wt0yqua1Bk8RFfOJm753Ft7wLM= In-Reply-To: <11argqv$2p8h1$3@dont-email.me> (message from Lawrence DβOliveiro <ldo@nz.invalid> on Thu, 15 Oct 2026 21:33:19 -0000 (UTC))