From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.help Subject: Re: Compilation warnings of ELisp seem wrong and misleading Date: Tue, 31 Mar 2015 02:53:20 +0200 Organization: Aioe.org NNTP Server Message-ID: <87iodij8cf.fsf@debian.uxu> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1427763040 30795 80.91.229.3 (31 Mar 2015 00:50:40 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 31 Mar 2015 00:50:40 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Mar 31 02:50:28 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YckNn-0003y3-Bv for geh-help-gnu-emacs@m.gmane.org; Tue, 31 Mar 2015 02:50:19 +0200 Original-Received: from localhost ([::1]:36424 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YckNm-0006Dp-Cr for geh-help-gnu-emacs@m.gmane.org; Mon, 30 Mar 2015 20:50:18 -0400 Original-Path: usenet.stanford.edu!news.kjsl.com!feeder.erje.net!eu.feeder.erje.net!news2.arglkargh.de!news.mixmin.net!aioe.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 80 Original-NNTP-Posting-Host: feB02bRejf23rfBm51Mt7Q.user.speranza.aioe.org Original-X-Complaints-To: abuse@aioe.org User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) X-Notice: Filtered by postfilter v. 0.8.2 Cancel-Lock: sha1:S+farSabN72DLO3oDMWgESdRlLI= Mail-Copies-To: never Original-Xref: usenet.stanford.edu gnu.emacs.help:211180 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:103462 Archived-At: "Ludwig, Mark" 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