From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sebastian Wiesner Newsgroups: gmane.emacs.help Subject: Re: Flycheck reports are never satisfying!? Date: Thu, 28 Aug 2014 17:25:56 +0200 Message-ID: <61C65218-4004-4FD5-ABE0-6C863E5F60A6@lunaryorn.com> References: <86ha0w95vp.fsf@somewhere.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1409240304 5322 80.91.229.3 (28 Aug 2014 15:38:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 28 Aug 2014 15:38:24 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Sebastien Vauban Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Aug 28 17:38:19 2014 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 1XN1mC-00007C-0q for geh-help-gnu-emacs@m.gmane.org; Thu, 28 Aug 2014 17:38:16 +0200 Original-Received: from localhost ([::1]:37575 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XN1mB-0005xx-LM for geh-help-gnu-emacs@m.gmane.org; Thu, 28 Aug 2014 11:38:15 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47320) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XN1aR-0002ms-03 for help-gnu-emacs@gnu.org; Thu, 28 Aug 2014 11:26:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XN1aM-0000X0-UH for help-gnu-emacs@gnu.org; Thu, 28 Aug 2014 11:26:06 -0400 Original-Received: from vega.uberspace.de ([95.143.172.245]:50593) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XN1aM-0000We-GJ for help-gnu-emacs@gnu.org; Thu, 28 Aug 2014 11:26:02 -0400 Original-Received: (qmail 30272 invoked from network); 28 Aug 2014 15:25:59 -0000 Original-Received: from localhost (HELO ?IPv6:2001:a60:16b4:ef01:a825:dc9:28fd:21d4?) (127.0.0.1) by vega.uberspace.de with SMTP; 28 Aug 2014 15:25:59 -0000 In-Reply-To: <86ha0w95vp.fsf@somewhere.org> X-Mailer: Apple Mail (2.1878.6) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 95.143.172.245 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:99470 Archived-At: Am 28.08.2014 um 14:05 schrieb Sebastien Vauban = : > Hello, >=20 > Trying to use, since short, Flycheck on all my prog modes; hence, on = my > Emacs configuration file as well. >=20 > Though, as you can see on http://screencast.com/t/gfzLGy2h6fH, it = never > is satisfying: there are always reports of errors or warnings, while = my > code is completely clean (IMO). It=92s not. Flycheck runs the byte compiler on your init.el, and=85 > Two ECM follow, showing what happens for all packages which I load and > customize. >=20 > Note that, here, I took an extract from Flycheck's configuration > itself, but the problem is the same with every third party > package... >=20 > 1. With an explicit package require: >=20 > --8<---------------cut here---------------start------------->8--- > ;;; .emacs-minimal.el --- Test file >=20 > ;;; Commentary: >=20 > ;;; Code: >=20 > (add-to-list 'load-path "~/.emacs.d/elpa/flycheck-20140824.731/=84) =85this expression is **not** evaluated by the byte compiler, so=85 (in an unrelated note, this is a *very strange thing to do*. The path = suggests that you are using package.el to install Flycheck, but in that = case you should *not* set up the load-path manual. Instead call = "(package-initialize)") > (require =82flycheck) =85when the byte compiler tries to evaluate this expression, Flycheck is = not in your load-path, hence the error below. Top-level "require"s are a special case. The byte compiler evaluates = these to load dependencies and macros, but it will **not** generally = evaluated other expressions. > ;; modern on-the-fly syntax checking > (when (try-require 'flycheck) >=20 > ;; indicate errors and warnings via icons in the left fringe > (setq flycheck-indication-mode 'left-fringe) >=20 > ;; enable Flycheck mode in all buffers > (add-hook 'after-init-hook 'global-flycheck-mode)) >=20 > (provide '.emacs-minimal) >=20 > ;;; .emacs-minimal.el ends here > --8<---------------cut here---------------end--------------->8--- >=20 > Flycheck reports one ERROR: >=20 > --8<---------------cut here---------------start------------->8--- > 9 1 error Cannot open load file: no such file or directory, = flycheck (emacs-lisp) > --8<---------------cut here---------------end--------------->8--- >=20 > 2. With an implicit package require (call to function `try-require'): >=20 > --8<---------------cut here---------------start------------->8--- > ;;; .emacs-minimal2.el --- Test file >=20 > ;;; Commentary: >=20 > ;;; Internal function: >=20 > (defun try-require (feature) > "Attempt to load a FEATURE (or library). > Return true if the library given as argument is successfully loaded. = If > not, just print a message." > (condition-case err > (progn (if (stringp feature) > (load-library feature) > (require feature)) t) > (file-error (message "Missing package `%s'!" feature) nil))) >=20 > ;;; Code: >=20 > (add-to-list 'load-path "~/.emacs.d/elpa/flycheck-20140824.731/") >=20 > ;; modern on-the-fly syntax checking > (when (try-require =82flycheck) As said above, the byte compiler doesn=92t evaluate arbitrary = expressions, and it doesn=92t evaluate this call either. Hence, it = never attempts to actually load Flycheck, so there=92s no error, but = since Flycheck isn=92t loaded, you get the warnings about free = variables. > ;; indicate errors and warnings via icons in the left fringe > (setq flycheck-indication-mode 'left-fringe) >=20 > ;; enable Flycheck mode in all buffers > (add-hook 'after-init-hook 'global-flycheck-mode)) >=20 > (provide '.emacs-minimal2) >=20 > ;;; .emacs-minimal2.el ends here > --8<---------------cut here---------------end--------------->8--- >=20 > Flycheck reports one warning: >=20 > --8<---------------cut here---------------start------------->8--- > 25 9 warning assignment to free variable = `flycheck-indication-mode' (emacs-lisp) > --8<---------------cut here---------------end--------------->8--- >=20 > How am I supposed to do, if Flycheck reports things that shouldn't be > reported? Generally, you should set the corresponding options of the "emacs-lisp" = syntax checker [1] to set the "load-path" for Flycheck, or enable = "package.el" for Flycheck. However, as far as "init.el" is concerned, Flycheck should automatically = enable package.el for syntax checking. This doesn't seem to work in = your case, and indicates that there is something unusual about your = setup, so please open an issue in Flycheck's issue tracker at = https://github.com/flycheck/flycheck/issues [1]: = http://flycheck.readthedocs.org/en/latest/guide/languages.html#el.flycheck= -checker.emacs-lisp