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: Marcin Borkowski
Subject: Re: How to shadow a function temporarily? (flet and cl-flet)
Date: Sun, 26 Jan 2014 20:03:27 +0100

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?

HTH,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Adam Mickiewicz University



reply via email to

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