all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Luís Oliveira" <luismbo@gmail.com>
Cc: joaotavora@gmail.com, 33828@debbugs.gnu.org
Subject: bug#33828: 26.1; Unbound defvar across compilation units
Date: Fri, 21 Dec 2018 22:02:49 +0200	[thread overview]
Message-ID: <83muoybqc6.fsf@gnu.org> (raw)
In-Reply-To: <CAB-HnLR2XkWKBNRxiyTpYv6RzMu94CywdpFsWDjYp0_sVj1Yig@mail.gmail.com> (message from Luís Oliveira on Fri, 21 Dec 2018 12:02:55 +0000)

> From: Luís Oliveira <luismbo@gmail.com>
> Date: Fri, 21 Dec 2018 12:02:55 +0000
> Cc: João Távora <joaotavora@gmail.com>
> 
> I think I've come across a bug.

Doesn't look like a bug to me.

>     (defun f2-foo ()
>       (let ((my-special 123))
>         (f2-bar)))
> 
>     (defun f2-bar ()
>       my-special)
> 
>     (print (f2-bar))
> 
> 
> 
>     $ emacs -Q -L . -f batch-byte-compile f2.el
> 
>     In toplevel form:
>     f2.el:5:1:Warning: Unused lexical variable `my-special'

That's because you do nothing with the value of f2-bar.

>     In f2-bar:
>     f2.el:10:3:Warning: reference to free variable `my-special'
> 
> 
> Also:
> 
>     $ emacs -Q -L . -batch -l f2.el
>     Symbol's value as variable is void: my-special

You need to use defvar in the same file.





  parent reply	other threads:[~2018-12-21 20:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-21 12:02 bug#33828: 26.1; Unbound defvar across compilation units Luís Oliveira
2018-12-21 13:50 ` Luís Oliveira
2018-12-21 20:02 ` Eli Zaretskii [this message]
2018-12-22  2:45   ` João Távora
2018-12-22  7:43     ` Eli Zaretskii
2018-12-22 22:40     ` Philipp Stephani
2018-12-23  1:16       ` João Távora

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=83muoybqc6.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=33828@debbugs.gnu.org \
    --cc=joaotavora@gmail.com \
    --cc=luismbo@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 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.