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

Richard Stallman <[email protected]> Mon, 03 Aug 2026 00:05:56 -0400
Newsgroups gmane.emacs.devel
Message-ID <[email protected]>
[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]


  > I like this idea. We could add the following macro to ERT:

  > --8<---------------cut here---------------start------------->8---
  > (defmacro ert-with-forced-function-value (name value &rest body)
  >   "Bind function NAME to return always VALUE, and evaluate BODY."
  >   (declare (indent 2) (debug (functionp sexp body)))
  >   `(cl-letf (((symbol-function ',name) (lambda (&rest _) ,value)))
  >      ,@body))
  > --8<---------------cut here---------------end--------------->8---

What I had in mind is to use a special mechanism to force a certain function's
value to VALUE, without ever altering a symbol's function definition.

It would be evidently unclean to use this mechanism in ordinary code,
and the point is that we would not accept code to do so.

-- 
Dr Richard Stallman (https://stallman.org)
Chief GNUisance of the GNU Project (https://gnu.org)
Founder, Free Software Foundation (https://fsf.org)
Internet Hall-of-Famer (https://internethalloffame.org)