unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* How to shadow a function temporarily? (flet and cl-flet)
@ 2014-01-26 14:11 Alex Kost
  2014-01-26 14:50 ` Stefan Monnier
  2014-01-26 19:03 ` Marcin Borkowski
  0 siblings, 2 replies; 16+ messages in thread
From: Alex Kost @ 2014-01-26 14:11 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 575 bytes --]

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?


[-- Attachment #2: Type: application/emacs-lisp, Size: 327 bytes --]

[-- Attachment #3: Type: text/plain, Size: 15 bytes --]


-- 
Alex Kost

^ permalink raw reply	[flat|nested] 16+ messages in thread
[parent not found: <mailman.12843.1390745495.10748.help-gnu-emacs@gnu.org>]

end of thread, other threads:[~2014-01-27 14:59 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-26 14:11 How to shadow a function temporarily? (flet and cl-flet) Alex Kost
2014-01-26 14:50 ` Stefan Monnier
2014-01-26 19:24   ` Alex Kost
2014-01-26 22:08     ` Stefan Monnier
2014-01-27  5:57       ` Alex Kost
2014-01-27 13:40         ` Stefan Monnier
2014-01-27 14:59           ` Alex Kost
2014-01-26 19:03 ` Marcin Borkowski
2014-01-26 19:31   ` Alex Kost
     [not found] <mailman.12843.1390745495.10748.help-gnu-emacs@gnu.org>
2014-01-26 16:22 ` Emanuel Berg
2014-01-26 19:25   ` Alex Kost
2014-01-26 18:32 ` Emanuel Berg
2014-01-26 19:38   ` Alex Kost
2014-01-26 19:36 ` Barry Margolin
2014-01-26 19:45   ` Michael Heerdegen
2014-01-26 22:07   ` Alex Kost

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).