On Sun, Oct 29, 2023 at 02:14:10AM +0200, Michael Heerdegen wrote: > Arash Esbati writes: > > > Michael Heerdegen writes: > > > > > No - they very different. `cl-flet' creates lexical bindings. Your > > > `cl-letf' call OTOH temporarily changes the function binding of the > > > symbol `y-or-n-p' - which more or less gives you dynamical binding. > > > > Thanks for your response. I basically want to temporarily make > > `y-or-n-p' act like `always'; and from what I read in the docstrings, > > both version should work, but `cl-flet' does not. Are the bindings > > relevant in this case? > > Yes. Please read about scoping rules: > > (info "(elisp) Variable Scoping") > > the analogue rules apply for function bindings. > > When the call of `y-or-n-p' does not occur textually inside the > `cl-flet' form, it will not be affected by a lexical function binding. It can be confusing. Look at it this way: y-or-no-p is most probably not called directly in your (while ...) construct (which is a special form) but from some functions called from there. So it's not in your lexical environment, but on somewhere else's. So a dynamic binding does the trick. Cheers -- t