unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Error byte compiling a file
@ 2007-05-28  2:59 Davin Pearson
  2007-05-28  6:32 ` Daniel Jensen
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Davin Pearson @ 2007-05-28  2:59 UTC (permalink / raw)
  To: help-gnu-emacs

Here is my trashcan system:

http://www.geocities.com/davinpearson/research/2006/trashcan.el.html

When I try to byte compile this file I get the following error
message:

Compiling file d:/home/mylisp/trashcan.el at Mon May 28 14:51:54 2007
  ** reference to free variable trashcan--refresh-count
  ** assignment to free variable trashcan--refresh-count

The problem is that I WANT TO assign to the free variable trashcan--
refresh-count.

Should I simply ignore this error message then?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Error byte compiling a file
  2007-05-28  2:59 Error byte compiling a file Davin Pearson
@ 2007-05-28  6:32 ` Daniel Jensen
  2007-05-28  8:53 ` Xavier Maillard
       [not found] ` <mailman.1346.1180342540.32220.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 5+ messages in thread
From: Daniel Jensen @ 2007-05-28  6:32 UTC (permalink / raw)
  To: help-gnu-emacs

Davin Pearson <davin.pearson@gmail.com> writes:

> Here is my trashcan system:
>
> http://www.geocities.com/davinpearson/research/2006/trashcan.el.html
>
> When I try to byte compile this file I get the following error
> message:
>
> Compiling file d:/home/mylisp/trashcan.el at Mon May 28 14:51:54 2007
>   ** reference to free variable trashcan--refresh-count
>   ** assignment to free variable trashcan--refresh-count
>
> The problem is that I WANT TO assign to the free variable trashcan--
> refresh-count.
>
> Should I simply ignore this error message then?

Define the variable with defvar before use. You use the variable only
buffer-locally, so put a call to make-variable-buffer-local after the
defvar form. Then you don't need to use make-local-variable.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Error byte compiling a file
  2007-05-28  2:59 Error byte compiling a file Davin Pearson
  2007-05-28  6:32 ` Daniel Jensen
@ 2007-05-28  8:53 ` Xavier Maillard
       [not found] ` <mailman.1346.1180342540.32220.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 5+ messages in thread
From: Xavier Maillard @ 2007-05-28  8:53 UTC (permalink / raw)
  To: Davin Pearson; +Cc: help-gnu-emacs

Hi,

   Should I simply ignore this error message then?

This is not an error message but a warning. Best is to fix it to
"silent" the byte compiler but anyway you can ignore it. Try to
defvar your variable to nil and see what happens (it is often
enough).

	Xavier
-- 
http://www.gnu.org
http://www.april.org
http://www.lolica.org

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Error byte compiling a file
       [not found] ` <mailman.1346.1180342540.32220.help-gnu-emacs@gnu.org>
@ 2007-05-28  9:01   ` Davin Pearson
  2007-06-02  9:15     ` Johan Bockgård
  0 siblings, 1 reply; 5+ messages in thread
From: Davin Pearson @ 2007-05-28  9:01 UTC (permalink / raw)
  To: help-gnu-emacs

On May 28, 8:53 pm, Xavier Maillard <x...@gnu.org> wrote:
> Hi,
>
>    Should I simply ignore this error message then?
>
> This is not an error message but a warning. Best is to fix it to
> "silent" the byte compiler but anyway you can ignore it. Try to
> defvar your variable to nil and see what happens (it is often
> enough).
>
>         Xavier
> --http://www.gnu.orghttp://www.april.orghttp://www.lolica.org


Thanx it work fine with (defvar <variable> nil)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Error byte compiling a file
  2007-05-28  9:01   ` Davin Pearson
@ 2007-06-02  9:15     ` Johan Bockgård
  0 siblings, 0 replies; 5+ messages in thread
From: Johan Bockgård @ 2007-06-02  9:15 UTC (permalink / raw)
  To: help-gnu-emacs

Davin Pearson <davin.pearson@gmail.com> writes:

> Thanx it work fine with (defvar <variable> nil)

Or use this method:


D.5 Tips for Avoiding Compiler Warnings

   * Try to avoid compiler warnings about undefined free variables, by
     adding dummy `defvar' definitions for these variables, like this:

          (defvar foo)

     Such a definition has no effect except to tell the compiler not to
     warn about uses of the variable `foo' in this file.

    [...]

-- 
Johan Bockgård

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-06-02  9:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-28  2:59 Error byte compiling a file Davin Pearson
2007-05-28  6:32 ` Daniel Jensen
2007-05-28  8:53 ` Xavier Maillard
     [not found] ` <mailman.1346.1180342540.32220.help-gnu-emacs@gnu.org>
2007-05-28  9:01   ` Davin Pearson
2007-06-02  9:15     ` Johan Bockgård

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