Hi Keita,

Ikumi Keita <ik...@ikumi.que.jp> writes:

> I have little experience with cl-lib, so please bear with me if I'm
> saying something stupid.

No worries, now we are 2 :-)

> As far as I can read out of elisp reference and their doc strings,
>
> (cl-flet ((AAA BBB))
>   (AAA CCC))
>
> is basically the same as
>
> (cl-letf (((symbol-function 'AAA) BBB))
>   (AAA CCC)
>
> and, in my opinion, more clear. Acutually,
> (cl-letf (((symbol-function 'y-or-n-p) #'always))
>   (y-or-n-p "dummy"))
> and
> (cl-flet ((y-or-n-p #'always))
>   (y-or-n-p "dummy"))
> behave in the same way apparently.

You're right, I didn't check the docstring but only the elisp reference
which wasn't complete in that regard.  The elisp reference reads[1]:

  Macro: cl-flet (bindings…) forms… 

    This form establishes let-style bindings for functions rather than
    values. Each binding must be a list of the form ‘(name arglist
    body…)’. Within forms, any reference to the function name uses the local
    definition instead of the global one.

I submitted a bug report for Emacs.  Otherwise I installed some changes
which should address all the issues.  Again, thank you very much for
raising these points.  Please let me know if something is still not
working.

Best, Arash

Footnotes:
[1]  
https://www.gnu.org/software/emacs/manual/html_mono/cl.html#Function-Bindings


Reply via email to