Subject: Re: bug#12895: 24.3.50; Replacement for flet

From: Antoine Levitt <[email-masked]>
Date: Thu, 15 Nov 2012 16:01:58 +0100

11/15/2012 15:46, Stefan Monnier
>> (defun something ()
>>   (message "hi"))
>> (letf ((message (lambda () (&rest args) nil)))
>>   (something))
>> Is this because message is a built-in?
>
> No, it's because what you want is not a local function, but an override
> of an existing function.

Ah, sorry. Letf redirects to cl-letf, which says

Temporarily bind to PLACEs. This is the analogue of `let', but with
generalized variables

If it excludes overrides, I think it should say so explicitely. Right
now I'm led to think it's like let for functions, and I've been using
let for overriding just fine.

> Such override should be done with an advice.

Unless I'm missing something easier, using an advice would be cumbersome
(define the advice, activate it, run the function, then deactivate the
advice, protecting for errors). Would you consider un-obsoleting flet?
It isn't deprecated by either cl-flet or cl-letf.