Questions tagged [lexical-binding]
The lexical-binding tag has no summary.
32 questions
2 votes
1 answer
68 views
setf'able let-binding
An let-binding takes a copy of a value and thus setf does not modify the structure where the value came from. (let ((x (list 1 2))) (let ((y (car x))) (setf y 7)) x) ; (1 2) rather than (7 2) ...
2 votes
1 answer
279 views
file local "variable must be set at the start of the file"?
Having heard that lexical binding may well become the default in Emacs 31, I wanted to start adding the "lexcial binding cookie" (ie. the lexical-binding: nil file local variable setting) to ...
4 votes
2 answers
841 views
lexical binding in a tangled init.el file
How can I enable lexical binding in an init.el file that is tangled from an org mode file? I have an org mode file called Emacs.org which is used to tangle the init.el file using the command M-x org-...
0 votes
0 answers
24 views
Lexical-binding and multiple buffers [duplicate]
I want to use a function that is taking advantage of lexical-binding: (defun comp (funcs) "Function composition" (let (f0 ff) (if (not funcs) (lambda (x &rest args) ...
3 votes
1 answer
184 views
why lexical environment alist ends with a `t'?
(let ((test 233)) (lambda ())) ;; ==> (closure ((test . 233) t) ;; ==> nil) I am wondering why not simply choose a proper alist, e.g.: ((test . 233)) ; instead of ((test . 233) t) As far ...
4 votes
0 answers
275 views
Using a `defconst' or `defvar' While the Variable Has a Local Binding Sets the Global Binding?
The GNU Emacs Lisp Reference Manual, 12.5 Defining Global Variables: If you use a defconst or defvar special form while the variable has a local binding (made with let, or a function argument), it ...
0 votes
1 answer
50 views
Testing lexically-bound, nested functions with ERT
I am experimenting with writing elisp in a more scheme-y style where helper functions are definded inside another function's lexical envirnonment like this (with lexical binding turned on): (defun my-...
1 vote
1 answer
340 views
How do I call a function within a lambda?
I would like to define a function that generates lambdas, as such: (defun my-func (FUNCTION) (lambda () (FUNCTION))) But when I evaluate the following (defun my-func1 () (message &...