I'd rather not use cl-lib and cl at the same time. However, I really like using lexical-let to specify the usage of lexical binding on a more granular level.
Is there any equivalent in cl-lib or vanilla Emacs Lisp?
I'd rather not use cl-lib and cl at the same time. However, I really like using lexical-let to specify the usage of lexical binding on a more granular level.
Is there any equivalent in cl-lib or vanilla Emacs Lisp?
cl and cl-lib are not "either or". The former requires the latter and defines lexical-let.
If you want lexical bindings, you can turn them on using the variable lexical-binding.
You can also set it on a per-file basis using file variables.
Simply require library cl at compile time, to get the use of its macros (and not get any runtime load). That is where macro lexical-let is defined.
So all you need is this, to use lexical-let:
(eval-when-compile (require 'cl)) ;; lexical-let
(I put the stuff I use from the library in a comment like that, just to let me know what I'm using from it.)
Oh, and lexical-let works in all Emacs versions (at least Emacs 20 and later). And yes, it lets you use dynamic binding by default and use lexical binding in a granular way, when you want it.
(cl.el is vanilla Emacs, BTW, not a 3rd-party library. It is simply not preloaded. It has the same status as something like Org mode or Calc or dired-x.el.)