|
From: | Andreas Röhler |
Subject: | Re: flet, cl-flet, cl-letf in 24.3 |
Date: | Mon, 22 Apr 2013 17:09:30 +0200 |
User-agent: | Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130307 Thunderbird/17.0.4 |
Am 22.04.2013 15:32, schrieb Stefan Monnier:
as reported here [5], this documentation does not really tell me what to do if I want to keep relying on the dynamic scoping of flet. A brief google search [6] leads me to believe that(cl-letf (((symbol-function 'foo) #'(lambda (...) ...))) ...)is the suggested solution,That's the case.Does that always have dynamic scope?How could it not?however I wanted to make sure that is the case.Even better in most cases is: (defvar my-enable-foo-advice nil) (defadvice foo (...) (if my-enable-foo-advice ... ...)) and then replace (flet ((foo ...)) ...) with (let ((my-enable-foo-advice t)) ...) Stefan
Hi Stefan, until now, a let bound variable was easy to use, there was no difficulty wrt global namespace. From this would expect some confusion, as a defvar is Emacs-wide. Isn't a defvar setting init-value only at first time? I.e. if another program already used (defvar my-enable-foo-advice 'my-init-value) (defvar my-enable-foo-advice nil) should have not effect. May someone point me to the thread where that was discussed? Thanks, Andreas
[Prev in Thread] | Current Thread | [Next in Thread] |