emacs-devel
[Top][All Lists]
Advanced

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

Re: problems with flet on last emacs


From: Stefan Monnier
Subject: Re: problems with flet on last emacs
Date: Sat, 10 Nov 2012 18:38:53 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> (let ((saved (symbol-function 'foo)))
>   (unwind-protect
>       (progn
>         (fset 'foo #'(lambda ()
>                        (message "bar!")))
>         (meta-foo))
>     (fset 'foo saved)))

Same problem as with flet: the redefinition is hard to find, dynamically
scoped, etc...

Better use

   (defvar foo-bar nil)
   (defadvice foo (around blabla activate)
     (if foo-bar (message "bar!") ad-do-it))

and then

   ...
   (let ((foo-bar t))
     ...)

So C-h f foo RET will tell you about the redefinition and you can
recover the non-redefined behavior with a simple (setq foo-bar nil).


        Stefan



reply via email to

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