all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: emacs-devel@gnu.org
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	[thread overview]
Message-ID: <20170104133948.GA7373@acm.fritz.box> (raw)
In-Reply-To: <jwv1swj4yao.fsf-monnier+Inbox@gnu.org>

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 <foo>),
> 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 <foo>) 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).



  reply	other threads:[~2017-01-04 13:39 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-03 14:14 Can't M-x compile-defun `edebug' because dynamic variables are falsely taken as lexical Alan Mackenzie
2017-01-03 18:35 ` Stefan Monnier
2017-01-03 21:32   ` Alan Mackenzie
2017-01-03 21:48     ` Stefan Monnier
2017-01-04 13:39       ` Alan Mackenzie [this message]
2017-01-04 15:23         ` Stefan Monnier
2017-01-04 20:04           ` Alan Mackenzie
2017-01-04 21:49             ` Stefan Monnier
2017-01-04 22:02               ` Alan Mackenzie
2017-01-04 22:26                 ` Stefan Monnier
2017-01-04 22:44                   ` Drew Adams
2017-01-05 10:54                   ` Alan Mackenzie
2020-02-13 16:42             ` Drew Adams
2020-02-13 20:02               ` Stefan Monnier
2020-02-13 20:43                 ` Drew Adams
2020-02-13 22:09                   ` Stefan Monnier
2020-02-14  1:07                     ` Drew Adams
2020-02-14  2:24                       ` Stefan Monnier
2020-02-14 17:25                         ` Drew Adams
2020-02-14 19:19                           ` Stefan Monnier
2020-02-17 18:23                           ` Drew Adams
2020-02-13 22:11                   ` Stefan Monnier
2020-02-14  1:13                     ` Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170104133948.GA7373@acm.fritz.box \
    --to=acm@muc.de \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@IRO.UMontreal.CA \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.