Recent versions of Emacs support lexical binding for variables in elisp code. Is it also possible to lexically redefine functions? In other words, does Emacs Lisp have something like lexical-flet?
Recent versions of Emacs support lexical binding for variables in elisp code. Is it
Share
In Emacs<24.3, you can
(require 'cl)and then uselabels. In Emacs-24.3 and up, you can also do(require 'cl-lib)and then use eithercl-fletorcl-labels.All of those are “complex macros” that generate code that looks like
(let ((fun (lambda (args) (body)))) ... (funcall fun my-args) ...), because the underlying language does not natively support local function definitions.