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: Emanuel Berg
Subject: Re: How to shadow a function temporarily? (flet and cl-flet)
Date: Sun, 26 Jan 2014 17:22:10 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Alex Kost <alezost@gmail.com> writes:

> 1. The main question is: how can I override a
> function with another compatible function (with the
> same args) temporarily?

Why do you want to do that? It might help if you tell
us, because there might be other (better) ways to do
what you want.

I don't know of an interface to do that, if you want to
do it habitually, but on a per function-basis, you can
use fset to redefine (set) the functions of symbols:

(fset '+ (lambda (&rest args) (apply '- args)))

And it is "temporary" in the sense that it works as
long as you don't reset it. But if you go around
mucking about like that, I don't know what will break
first - Emacs or your mind. So I don't think you have
to worry about the "temporary" aspect :)

-- 
underground experts united:
http://user.it.uu.se/~embe8573


reply via email to

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