From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: =?ISO-8859-15?Q?Andreas_R=F6hler?= Newsgroups: gmane.emacs.help Subject: Re: flet, cl-flet, cl-letf in 24.3 Date: Mon, 22 Apr 2013 17:09:30 +0200 Message-ID: <517552AA.9080003@easy-emacs.de> References: <5c1e7b99-1d04-46fe-a0d0-3709a468add7@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1366646987 21890 80.91.229.3 (22 Apr 2013 16:09:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 22 Apr 2013 16:09:47 +0000 (UTC) Cc: Stefan Monnier To: "help-gnu-emacs@gnu.org List" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Apr 22 18:09:51 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UUJJN-0001Zx-Mf for geh-help-gnu-emacs@m.gmane.org; Mon, 22 Apr 2013 18:09:49 +0200 Original-Received: from localhost ([::1]:43388 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUIRM-0003Ki-NQ for geh-help-gnu-emacs@m.gmane.org; Mon, 22 Apr 2013 11:14:00 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:54313) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUIL7-0003Np-Dq for help-gnu-emacs@gnu.org; Mon, 22 Apr 2013 11:07:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UUIL5-0002OB-B6 for help-gnu-emacs@gnu.org; Mon, 22 Apr 2013 11:07:33 -0400 Original-Received: from moutng.kundenserver.de ([212.227.17.8]:60201) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UUIL5-0002Nh-2l for help-gnu-emacs@gnu.org; Mon, 22 Apr 2013 11:07:31 -0400 Original-Received: from [192.168.178.21] (brln-4d0c27ff.pool.mediaWays.net [77.12.39.255]) by mrelayeu.kundenserver.de (node=mrbap3) with ESMTP (Nemesis) id 0LrsTu-1UerIl1ZxW-013hxS; Mon, 22 Apr 2013 17:07:29 +0200 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130307 Thunderbird/17.0.4 In-Reply-To: X-Provags-ID: V02:K0:9QJoK/zzWysIGSP++v+K6ZMFPDpv9wq/M0yXjDQuA4/ yHsJ4BHuru1Q2SIGMVVzdOnSChQ9ugGCOxkCoHED7OOUNwOQV3 ULKaNUNo1ei1M4gc/SgcudHmOIJNOgFmDx53IxcH9xso4RJwbE i3Ky7gjmdEcvRYTgdQ7/CkoV/GI+atkSgS4RjsI34V156nXmK6 kJJsPpelXS3uNWMWDDKWHxMhozxUebmLk9zwogAasj2871U70I 4pQfWI/Od2jsSwkCCmYxlMcOtjsoR0uuwMjbfGflI3wX7Eo+Fa HPABoC1aQLH5jONl1Gb6sARZzyZtCoNUrvsl3sd3bcqcKcx5KK 7r36Hfihz6vq7eFEPy8qPrWFbrLGivujfcR2GPXx9 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 212.227.17.8 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:90289 Archived-At: 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