From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ndemmel@gmail.com Newsgroups: gmane.emacs.help Subject: Re: flet, cl-flet, cl-letf in 24.3 Date: Sat, 27 Apr 2013 04:16:02 -0700 (PDT) Message-ID: <098b3b26-6cfa-478b-8870-7a7bdb806611@googlegroups.com> 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-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1367064569 17280 80.91.229.3 (27 Apr 2013 12:09:29 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 27 Apr 2013 12:09:29 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Apr 27 14:09:34 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 1UW3wa-0000PM-Gk for geh-help-gnu-emacs@m.gmane.org; Sat, 27 Apr 2013 14:09:32 +0200 Original-Received: from localhost ([::1]:59696 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UW3wZ-0001Mj-TQ for geh-help-gnu-emacs@m.gmane.org; Sat, 27 Apr 2013 08:09:31 -0400 X-Received: by 10.224.217.195 with SMTP id hn3mr33559309qab.5.1367061363049; Sat, 27 Apr 2013 04:16:03 -0700 (PDT) X-Received: by 10.49.103.135 with SMTP id fw7mr4080013qeb.38.1367061363016; Sat, 27 Apr 2013 04:16:03 -0700 (PDT) Original-Path: usenet.stanford.edu!s14no40292qam.0!news-out.google.com!ef9ni25954qab.0!nntp.google.com!s14no40284qam.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=188.99.118.4; posting-account=MrzOPQoAAAADHmNl_-Qkvaq87JqsOJwW Original-NNTP-Posting-Host: 188.99.118.4 User-Agent: G2/1.0 Injection-Date: Sat, 27 Apr 2013 11:16:03 +0000 Original-Xref: usenet.stanford.edu gnu.emacs.help:198104 X-Mailman-Approved-At: Sat, 27 Apr 2013 08:09:14 -0400 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:90371 Archived-At: On Monday, April 22, 2013 3:32:05 PM UTC+2, Stefan Monnier wrote: > > as reported here [5], this documentation does not really tell me what t= o do >=20 > > if I want to keep relying on the dynamic scoping of flet. A brief goog= le >=20 > > search [6] leads me to believe that >=20 >=20 >=20 > > (cl-letf (((symbol-function 'foo) #'(lambda (...) ...))) ...)=20 >=20 >=20 >=20 > > is the suggested solution, >=20 >=20 >=20 > That's the case. Thanks! >=20 > > Does that always have dynamic scope? >=20 > How could it not? >=20 I'm not sure. What makes you say that? I can see how a lexical binding to a= generalized place (not a variable) would not neccessarily make sense; is t= hat what you mean? Otoh cl-flet does exactly that, for the special case of = (symbol-function ...), or is that not how I should view it? >=20 > > however I wanted to make sure that is the case. >=20 >=20 >=20 > Even better in most cases is: >=20 >=20 >=20 > (defvar my-enable-foo-advice nil) >=20 > (defadvice foo (...) >=20 > (if my-enable-foo-advice ... ...)) >=20 >=20 >=20 > and then replace (flet ((foo ...)) ...) >=20 > with (let ((my-enable-foo-advice t)) ...) >=20 I see. In my case I was concerned with keeping legacy code working without = changing much. Thanks! Niko