[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Howto override a function only locally in elisp?
From: |
Andreas Politz |
Subject: |
Re: Howto override a function only locally in elisp? |
Date: |
Wed, 08 Dec 2010 15:08:30 -0000 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
LanX <lanx.perl@googlemail.com> writes:
> Hi
>
> what's the best approach to replace a function only for another
> function?
>
> My use case is to replace calls to `message' with `tooltip-show'
> within some function in certain programming modes.
>
> But I don't want to copy and change the whole function, it would be
> sufficient to override locally any call to `message' with a `my-
> message' function without globally messing up message.
>
> Any idea? Perhaps with `defadvice'?
>
> Cheers
> Rolf
(require 'cl)
(flet ((message (fmt &rest args)
(tooltip-show (apply 'format fmt args))))
(message "Hello World"))
-ap