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: João Távora
Subject: Re: problems with flet on last emacs
Date: Sat, 10 Nov 2012 23:07:05 +0000

On Sat, Nov 10, 2012 at 10:46 PM, Stefan Monnier
<address@hidden> wrote:
> No, cl-flet is like Common-Lisp's `flet', i.e. lexically scoped, like
> `labels', but without the mutual-recursion.  If you want the "function
> redefinition" behavior, you need defadvice.

Hmmm, OK, good to know that then, but 'defadvice' feels strange,
what's the problem
with using  a combo of 'fset', 'symbol-function' and 'unwind-protect'?
Something like

(defun foo ()
  (message "foo"))

(defun meta-foo ()
  (foo))

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

--
João Távora



reply via email to

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