help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to shadow a function temporarily? (flet and cl-flet)


From: Alex Kost
Subject: Re: How to shadow a function temporarily? (flet and cl-flet)
Date: Sun, 26 Jan 2014 23:31:04 +0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Marcin Borkowski (2014-01-26 23:03 +0400) wrote:

> Dnia 2014-01-26, o godz. 18:11:11
> Alex Kost <alezost@gmail.com> napisaƂ(a):
>
>> Hello, I have 2 questions.
>> 
>> 1. The main question is: how can I override a function with another
>> compatible function (with the same args) temporarily?
>> 
>> I want something like this:
>> 
>> (let-shadow ((+ '-))
>>   (+ 3 2))  ; should return 1, not 5
>> 
>> 2. If there is no such macro, I can use `flet' for my purposes, but it
>> is obsolete and `cl-flet' doesn't do what I need (see attached
>> example).
>> 
>> According to (info "(cl) Obsolete Macros"), `flet' makes a dynamic
>> binding (unlike `cl-flet').  So the second question is: how can I
>> avoid using obsolete `flet` if I need a dynamic binding?
>
> Am I right that this could be done with advising?

Thanks, but i don't want to make an advice mainly because i need it for
emacs package, not for my own config.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]