Path: csiph.com!news.nrbbs.org!border-1.nntp.ord.giganews.com!nntp.giganews.com!local-2.nntp.ord.giganews.com!local-1.nntp.ord.giganews.com!Xl.tags.giganews.com!local-4.nntp.ord.giganews.com!news.giganews.com.POSTED!not-for-mail NNTP-Posting-Date: Tue, 06 Oct 2026 00:13:48 +0000 From: steve g Newsgroups: comp.lang.lisp Subject: Re: GNU Emacs native compiled functions 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> <87wlsmo83m.fsf@debian> <27310.37495.390148.32696@parhasard.net> <118n0hq$2klsb$2@dont-email.me> <27311.2978.832624.294330@parhasard.net> <87qzioixej.fsf@nightsong.com> <27312.20006.551518.782946@parhasard.net> <118pt43$3in8b$1@dont-email.me> Date: Mon, 05 Oct 2026 20:13:46 -0400 Message-ID: <878q4beldx.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Cancel-Lock: sha1:qJPPc/+DmVs9KlPaDovY/+cqS0c= MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Lines: 80 X-Usenet-Provider: http://www.giganews.com X-Trace: sv3-X6B6+ULq8vc02OR5zua/vpwDR4R7pLtlQKbUw1b0t3Ox+pW+KYZW5hlXYQlj9QfyUYIJtOKtXYufH34!dLp0sHlL93qbUOaoe57RmNBcIdVbYnMM7G1//GwAiSCgbcI= X-Complaints-To: abuse@giganews.com X-DMCA-Notifications: http://www.giganews.com/info/dmca.html X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 Xref: csiph.com comp.lang.lisp:61705 Lawrence D’Oliveiro writes: > On Sun, 20 Sep 2026 22:20:38 +0100, Aidan Kehoe wrote: > >> Common Lisp has dynamic binding for globals and lexical scope for >> locals. > > How does “dynamic binding for globals” work, exactly? A global can > only be declared once, so how can the binding ever be overridden by > another declaration? It can be "shadowed", excuse my poor vocabulary. You are correct that a global cannot/should not be overridden by a another declaration. I forget the words... This is an ugly one. I dislike the &aux binding but I do use it as well. (defvar mode-keymap) (defvar *keymap-modes* '(esc help cx super)) (setq my-modes (cdr *keymap-modes*)) (defun print-modes (lst) (dolist (mode lst) (let ((mode-keymap mode)) (print mode-keymap)))) (defun print-my-modes (&aux (mode-keymap *keymap-modes*)) (dolist (mode mode-keymap) (print mode))) => CL-USER> (print-my-modes) ESC HELP CX SUPER NIL (print-modes my-modes) HELP CX SUPER NIL (let ((mode-keymap '(1 2 3 4))) (dolist (i mode-keymap) (print i))) 1 2 3 4 The basic idea is 'minor-mode' is a variable without a default binding in the global (heap) position, so it can be bound with (setq minor-mode 'fundamental-mode) Now minor mode is default. When you switch buffers the open-buffer command will rebind minor-mode to accomidate. Returning to your previous buffer will do the same. It is like a list (LISP and list?) instead of searching a list of available modes, it can be faster for the open-buffer command to just set the value. Lexical binding is unrealistic in this situation. I still like the &aux key but not too many people use it. Unfortunately this mechanism can be very difficult to program with, especially with something as large as Gnu Emacs. This is close enough...