all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Emanuel Berg <embe8573@student.uu.se>
To: help-gnu-emacs@gnu.org
Subject: Re: Compilation warnings of ELisp seem wrong and misleading
Date: Tue, 31 Mar 2015 02:53:20 +0200	[thread overview]
Message-ID: <87iodij8cf.fsf@debian.uxu> (raw)
In-Reply-To: mailman.3018.1427724507.31049.help-gnu-emacs@gnu.org

"Ludwig, Mark" <ludwig.mark@siemens.com> writes:

> emacs.el:255:10:Warning: reference to free variable
> `if' emacs.el:219:8:Warning: reference to free
> variable `save-excursion' emacs.el:331:41:Warning:
> reference to free variable `forward-char'
> emacs.el:261:17:Warning: reference to free variable
> `insert' emacs.el:261:17:Warning: reference to free
> variable `forward-sexp'
>
> Those are all valid functions. For example, here are
> lines 255-258:
>
> (if (not (= ans ?q)) (progn (goto-char found-start)
> (delete-region found-start found-end)))
>
> This is inside a large-ish "let*" form (111 lines).

It shouldn't say that of functions. Are you sure the
syntax is correct?

Nonetheless, I agree that the messages from the
compiler are sometimes cryptic and sometimes annoying.
But I've never experienced such crazy messages as
you report!

As for "should you compile your code?": one of the
reasons to do that apart from the supposed but seldom
noticed gains is that you can improve the quality of
your code and become a better lisper. It is
automatized feedback. And, because of that, it is even
more important that the error/warning messages
are understandable.

If you get the free variable warning when it is indeed
a variable that is mentioned, use the help -
`describe-variable' - to find out where it is defined,
then put (require 'library) above. If you don't want
to do that - for example for infrequently used modes -
use `defvar' yourself, e.g.

    (defvar ada-mode-hook)
    (setq ada-mode-hook
              (lambda ()
                (enable-line-mode)
                (setq ada-auto-case nil)
                (disable-super-global-keys) ))

> emacs.el:1326:76:Warning: Use `with-current-buffer'
> rather than save-excursion+set-buffer

Apart from them not adding even a single line
explanation why you should "rather" do that, this
warning is clear: instead of first `save-excursion'
(which has to do with point movement) and then
`set-buffer', you do `with-current-buffer'.
Those stuff do not seem to relate (to me), which is
why I'd be happy to see an explanation, but apparently
it is an intuitive (bad) thing to do, which they have
seen often, hence the warning.

> Mark Ludwig Lifecycle Coll Product Lifecycle
> Management
>
> Siemens Industry Sector Siemens Product Lifecycle
> Management Software Inc. 5939 Rice Creek Parkway
> Shoreview, MN 55126 United States Tel. :+1 (651)
> 855-6140 Fax :+1 (651) 855-6280
> ludwig.mark@siemens.com www.siemens.com/plm

Hint: Put your signature on a new line immediately
under two dashes and a whitespace, i.e. "-- ".
Go to this page [1] and make a search for
"Signature Convention" if you like details.

[1] http://www.ietf.org/rfc/rfc3676.txt

-- 
underground experts united
http://user.it.uu.se/~embe8573


  parent reply	other threads:[~2015-03-31  0:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.3018.1427724507.31049.help-gnu-emacs@gnu.org>
2015-03-30 14:39 ` Compilation warnings of ELisp seem wrong and misleading Pascal J. Bourguignon
2015-03-30 15:40   ` Ludwig, Mark
2015-03-30 16:59     ` tomas
2015-03-30 19:09       ` Ludwig, Mark
     [not found]   ` <mailman.3032.1427730039.31049.help-gnu-emacs@gnu.org>
2015-03-30 17:08     ` Pascal J. Bourguignon
2015-03-31  0:53 ` Emanuel Berg [this message]
2015-04-01 11:45   ` Ludwig, Mark
2015-04-01 12:02     ` tomas
2015-04-02 10:20     ` Philipp Stephani
     [not found]   ` <mailman.3123.1427888711.31049.help-gnu-emacs@gnu.org>
2015-04-01 23:08     ` Emanuel Berg
2015-03-30 13:47 Ludwig, Mark

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=87iodij8cf.fsf@debian.uxu \
    --to=embe8573@student.uu.se \
    --cc=help-gnu-emacs@gnu.org \
    /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.