help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question about cl-flet and cl-letf


From: Michael Heerdegen
Subject: Re: Question about cl-flet and cl-letf
Date: Sun, 29 Oct 2023 02:14:10 +0200
User-agent: Gnus/5.13 (Gnus v5.13)

Arash Esbati <arash@gnu.org> writes:

> Michael Heerdegen <michael_heerdegen@web.de> 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.


Michael.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]