From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Pascal J. Bourguignon" Newsgroups: gmane.emacs.devel Subject: Re: problems with flet on last emacs Date: Wed, 27 Jun 2012 14:49:48 +0200 Organization: Informatimago Message-ID: <87zk7oq5qr.fsf@kuiper.lan.informatimago.com> References: <87pq8lnd7v.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1340801421 21681 80.91.229.3 (27 Jun 2012 12:50:21 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 27 Jun 2012 12:50:21 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 27 14:50:20 2012 Return-path: Envelope-to: ged-emacs-devel@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 1SjrhM-0008M4-CA for ged-emacs-devel@m.gmane.org; Wed, 27 Jun 2012 14:50:20 +0200 Original-Received: from localhost ([::1]:55769 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SjrhM-0003xl-EZ for ged-emacs-devel@m.gmane.org; Wed, 27 Jun 2012 08:50:20 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:53042) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SjrhJ-0003xa-L5 for emacs-devel@gnu.org; Wed, 27 Jun 2012 08:50:19 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SjrhC-0008O3-Tt for emacs-devel@gnu.org; Wed, 27 Jun 2012 08:50:17 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:42770) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SjrhC-0008Mh-Mq for emacs-devel@gnu.org; Wed, 27 Jun 2012 08:50:10 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1Sjrh4-00083Z-Gs for emacs-devel@gnu.org; Wed, 27 Jun 2012 14:50:02 +0200 Original-Received: from 81.202.16.46.dyn.user.ono.com ([81.202.16.46]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 27 Jun 2012 14:50:02 +0200 Original-Received: from pjb by 81.202.16.46.dyn.user.ono.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 27 Jun 2012 14:50:02 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 67 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 81.202.16.46.dyn.user.ono.com Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) Cancel-Lock: sha1:NGE3MGIzYjU1MjhiN2VmN2JhNzk1M2QyMTZhNDkxNDljNmI1YWZiMw== X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:151212 Archived-At: Thierry Volpiatto writes: > Hi, > stranges things happen with recent Emacs. > All functions that use flet don't work anymore. > The anonymous function defined by the flet is not read. > (i.e void function foo) > I could make it working by restarting my computer, recompiling > some libraries, (helm, slime) and it worked. > When I recompile files, restart Emacs, the problem occur again. > I have not this problem on 24.1. > > Any ideas? > If not I will send a bug report. flet is a macro in cl-macs.el in emacs-version "23.4.2": (pp (macroexpand '(flet ((f (x) (+ x x))) (f 42)))) (let* ((#1=#:--cl-letf-bound-- (fboundp #2='f)) (#3=#:--cl-letf-save-- (and #1# (symbol-function #2#)))) (unwind-protect (progn (fset #2# (function* (lambda (x) (block f (+ x x))))) (f 42)) (if #1# (fset #2# #3#) (fmakunbound #2#)))) This is spooky, because it rebinds the function slot of the symbol (globally). In Common Lisp, flet is a lexical binding. An alternative (and more correct) implementation of flet would use a code walker to substitute any call to (f 42) by something like: (--cl-letf-function-- 42). To avoid problem with the current version of flet, you should use a function name that is not the name of a global function. For example: (defun pjb--do-something () (flet ((pjb--do-something--inner-fun (x) (+ x x))) (pjb--do-something--inner-fun 42))) If you use a simple name, such as string-compare, (there's no string-compare function in this emacs 23.4.2 instance), then it may break when you load some library that define that function, or when you switch to another version of emacs that define that function. -- __Pascal Bourguignon__ http://www.informatimago.com/ A bad day in () is better than a good day in {}.