Re: master e4df903f6b5 2/2: ; Fix last change

Michael Albinus <[email protected]> Sat, 25 Jul 2026 16:57:24 +0200
Newsgroups gmane.emacs.devel
Message-ID <[email protected]>
Richard Stallman <[email protected]> writes:

Hi Richard,

> I agree.  I think we should eliminate all binding of symbol function
> definitions.  The way to start would be to make `letf' give a warning
> for attempts to bind symbol function definitions.
>
> Indeed, maybe we should discourage let-binding of anything except
> symbols' values.  Perhaps `letf' is simply a bad idea.  It looks like
> that was added for the sake of completeness.,
>
> Can anyone suggest a case for which `letf' is a good method?

Writing tests in *-tests.el. For example, if I want to test a function,
which calls yes-or-no-p internally, I'll test both code paths like

--8<---------------cut here---------------start------------->8---
(cl-letf (((symbol-function #'yes-or-no-p) #'always))
  ...)

(cl-letf (((symbol-function #'yes-or-no-p) #'ignore))
  ...)
--8<---------------cut here---------------end--------------->8---

Best regards, Michael.