From: Alan Mackenzie <acm@muc.de>
To: Philipp Stephani <p.stephani2@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: With lexical-binding t, how do I bind an external symbol dynamicall?
Date: Sat, 29 Aug 2015 18:07:05 +0000 [thread overview]
Message-ID: <20150829180705.GC20484@acm.fritz.box> (raw)
In-Reply-To: <CAArVCkRr-0yYyGh3=0ueN7FLYfEatDUfhztAouGJVTcJsvkP0g@mail.gmail.com>
Hello, Philipp.
On Sat, Aug 29, 2015 at 05:30:20PM +0000, Philipp Stephani wrote:
> Alan Mackenzie <acm@muc.de> schrieb am Sa., 29. Aug. 2015 um 18:34 Uhr:
> > Hello, Emacs!
> > In some Elisp with no knowledge of the variable `some-flag', which will
> > be defined elsewhere, I want to write
> > (let (some-flag) ....)
> > to bind `some-flag' dynamically. The byte-compiler give me the warning:
> > Unused lexical variable `some-flag'
> > . Somehow, I need to tell the byte-compiler that `some-flag' will be an
> > external dynamic variable. How do I do this?
> Use (defvar some-flag) before using some-flag. That will do nothing except
> marking some-flag as special (dynamic).
Ah! It's obvious, isn't it? ;-) Thank you very much indeed! I've now
restored the lexical-binding to the pertinent file.el
> > I've had a look around the "Variables" page, and its sub-pages, in the
> > elisp manual, yet didn't find any instructions on how to get round this
> > problem. Where in the manual is it described?
> It's mentioned in 16.6 Compiler Errors, but without mentioning dynamic
> binding. I discovered the behavior by looking at the Emacs source code; but
> this should be stated more prominently in the Elisp manual because it can
> lead to subtle errors if the warning is ignored or silenced.
Yes. I think a bug report is in order.
--
Alan Mackenzie (Nuremberg, Germany).
prev parent reply other threads:[~2015-08-29 18:07 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-29 16:35 With lexical-binding t, how do I bind an external symbol dynamicall? Alan Mackenzie
2015-08-29 17:30 ` Philipp Stephani
2015-08-29 18:07 ` Alan Mackenzie [this message]
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150829180705.GC20484@acm.fritz.box \
--to=acm@muc.de \
--cc=emacs-devel@gnu.org \
--cc=p.stephani2@gmail.com \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).