From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Can't M-x compile-defun `edebug' because dynamic variables are falsely taken as lexical. Date: Tue, 03 Jan 2017 16:48:15 -0500 Message-ID: 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 X-Trace: blaine.gmane.org 1483480123 4176 195.159.176.226 (3 Jan 2017 21:48:43 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 3 Jan 2017 21:48:43 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) Cc: emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jan 03 22:48:39 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 1cOWwa-0007wC-Nz for ged-emacs-devel@m.gmane.org; Tue, 03 Jan 2017 22:48:32 +0100 Original-Received: from localhost ([::1]:36199 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cOWwd-0008MV-9g for ged-emacs-devel@m.gmane.org; Tue, 03 Jan 2017 16:48:35 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47377) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cOWwX-0008Is-1u for emacs-devel@gnu.org; Tue, 03 Jan 2017 16:48:30 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cOWwP-00039T-Bu for emacs-devel@gnu.org; Tue, 03 Jan 2017 16:48:24 -0500 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:42859) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cOWwP-000392-6V for emacs-devel@gnu.org; Tue, 03 Jan 2017 16:48:21 -0500 Original-Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id v03LmFZm019225; Tue, 3 Jan 2017 16:48:16 -0500 Original-Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 135FDAE6B9; Tue, 3 Jan 2017 16:48:15 -0500 (EST) In-Reply-To: <20170103213228.GB2085@acm.fritz.box> (Alan Mackenzie's message of "Tue, 3 Jan 2017 21:32:28 +0000") X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 2 Rules triggered EDT_SA_DN_PASS=0, RV5908=0 X-NAI-Spam-Version: 2.3.0.9418 : core <5908> : inlines <5617> : streams <1727522> : uri <2352001> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.20 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:211094 Archived-At: > 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). > , 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. 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. Stefan