unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Question about cl-flet and cl-letf
@ 2023-10-26 20:10 Arash Esbati
  2023-10-26 21:53 ` Michael Heerdegen
  0 siblings, 1 reply; 6+ messages in thread
From: Arash Esbati @ 2023-10-26 20:10 UTC (permalink / raw)
  To: emacs-help

Hi all,

my understanding of the manual and docstring of the macros mentioned
above is that these two pieces of code should be equivalent:

  (cl-flet ((y-or-n-p #'always))
    (while (...)
      BODY))

  (cl-letf (((symbol-function 'y-or-n-p) #'always))
    (while (...)
      BODY))

I have an use-case where they are not.  Before getting into details
about the function (which is long) and trying to come up with a reduced
version: Am I correct with the assumption above?  Currently, my function
works with `cl-left' as expected and with `cl-flet' not, i.e.,
`y-or-no-p' returns t inside BODY with `cl-letf' and not with `cl-flet'.

I'd appreciate if somebody would enlighten me.

Best, Arash



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2023-10-31  9:38 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-26 20:10 Question about cl-flet and cl-letf Arash Esbati
2023-10-26 21:53 ` Michael Heerdegen
2023-10-28 21:07   ` Arash Esbati
2023-10-29  0:14     ` Michael Heerdegen
2023-10-29  6:19       ` tomas
2023-10-31  9:38         ` Arash Esbati

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).