From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Can't M-x compile-defun `edebug' because dynamic variables are falsely taken as lexical. Date: Wed, 4 Jan 2017 13:39:48 +0000 Message-ID: <20170104133948.GA7373@acm.fritz.box> References: <20170103141444.GA4649@acm.fritz.box> <20170103213228.GB2085@acm.fritz.box> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: blaine.gmane.org 1483537576 19149 195.159.176.226 (4 Jan 2017 13:46:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 4 Jan 2017 13:46:16 +0000 (UTC) User-Agent: Mutt/1.5.24 (2015-08-30) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jan 04 14:46:13 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cOltA-000396-Cf for ged-emacs-devel@m.gmane.org; Wed, 04 Jan 2017 14:46:00 +0100 Original-Received: from localhost ([::1]:39396 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cOltE-0001ct-7a for ged-emacs-devel@m.gmane.org; Wed, 04 Jan 2017 08:46:04 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54227) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cOlnc-0004ws-QB for emacs-devel@gnu.org; Wed, 04 Jan 2017 08:40:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cOlnX-0004mc-VI for emacs-devel@gnu.org; Wed, 04 Jan 2017 08:40:16 -0500 Original-Received: from ocolin.muc.de ([193.149.48.4]:55937 helo=mail.muc.de) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1cOlnX-0004kK-Kc for emacs-devel@gnu.org; Wed, 04 Jan 2017 08:40:11 -0500 Original-Received: (qmail 25378 invoked by uid 3782); 4 Jan 2017 13:40:09 -0000 Original-Received: from acm.muc.de (p548C6D63.dip0.t-ipconnect.de [84.140.109.99]) by colin.muc.de (tmda-ofmipd) with ESMTP; Wed, 04 Jan 2017 14:40:08 +0100 Original-Received: (qmail 7447 invoked by uid 1000); 4 Jan 2017 13:39:49 -0000 Content-Disposition: inline In-Reply-To: X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 9.x [fuzzy] X-Received-From: 193.149.48.4 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:211101 Archived-At: Hello, Stefan. On Tue, Jan 03, 2017 at 04:48:15PM -0500, Stefan Monnier wrote: > > It looks like you've already done that, possibly on 2015-10-29. Looking > > at the source (now I know what to look for), eval-sexp-add-defvars is > > also in Emacs 25.1's source for compile-defun. > Oh, indeed. Not sure why you're seeing what you're seeing, then. > At least on Emacs's master branch I can't seem to reproduce your problem > (don't have a fresh emacs-25 build to try it right now). For what it's worth, I can't reproduce the problem any more. I must have got my Emacs 25.1 into a strange state, somehow. > > , so the question becomes why is setting the declared_special flag done > > inside the "if (CONSP (tail))" rather than outside? I.e. why is it only > > done when a variable has an initialisation? > Because this code is only relevant when you evaluate (defvar ), > whereas here we're not evaluating it, we're only processing it for the > byte-compiler. Understood. Thanks. > There's also the important difference that a (defvar ) only > has effect for the code in the same file rather than having a global > effect, so you can do (defvar toto) and then use `toto` as > a dynamically-scoped variable in your file without wreaking havoc in all > other files which happen to also use `toto` as a (lexical) variable. Ouch! There seems to be a clash between symbols (which are global, dynamic) and lexical variables (which are local and "invisible"): the only way to mark a variable as lexical is at the global level. However, I'm seeing something else strange (still on 25.1). I do this: (i) M-x load-library edebug. (ii) visit edebug.el. (iii) instrument `edebug' for edebugging (yes, I know ;-). (iv) M-: (edebug). (v) step through the function to just after the let bindings. (vi) e (special-variable-p 'edebug-breakpoints). This last returns nil. This suggests edebug-breakpoints has been bound as a lexical variable, rather than a dynamic one. (There is a defvar for it earlier in the file.) This is surely not right. What is going on here? Is it, perhaps, a bug? However, edebug.elc still seems to work, though I haven't successfully mananged to run `edebug' recently. > Stefan -- Alan Mackenzie (Nuremberg, Germany).