From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sebastien Vauban Newsgroups: gmane.emacs.help Subject: Re: Flycheck reports are never satisfying!? Date: Thu, 28 Aug 2014 17:39:18 +0200 Organization: Sebastien Vauban Message-ID: <86bnr4wrmh.fsf@somewhere.org> References: <86ha0w95vp.fsf@somewhere.org> <61C65218-4004-4FD5-ABE0-6C863E5F60A6@lunaryorn.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1409240456 7273 80.91.229.3 (28 Aug 2014 15:40:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 28 Aug 2014 15:40:56 +0000 (UTC) Cc: help-gnu-emacs-mXXj517/zsQ@public.gmane.org To: Sebastian Wiesner Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org-mXXj517/zsQ@public.gmane.org Thu Aug 28 17:40:51 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 1XN1og-0002MS-KW for geh-help-gnu-emacs@m.gmane.org; Thu, 28 Aug 2014 17:40:50 +0200 Original-Received: from localhost ([::1]:37614 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XN1og-0001LX-6w for geh-help-gnu-emacs@m.gmane.org; Thu, 28 Aug 2014 11:40:50 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51755) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XN1oD-0001BQ-HY for help-gnu-emacs-mXXj517/zsQ@public.gmane.org; Thu, 28 Aug 2014 11:40:25 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XN1o5-0005z9-Of for help-gnu-emacs-mXXj517/zsQ@public.gmane.org; Thu, 28 Aug 2014 11:40:21 -0400 Original-Received: from dd5e0353a.access.telenet.be ([213.224.53.58]:22747 helo=mail.missioncriticalit.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XN1o5-0005yk-Fd for help-gnu-emacs-mXXj517/zsQ@public.gmane.org; Thu, 28 Aug 2014 11:40:13 -0400 Original-Received: from MUNDANEUM.i-did-not-set--mail-host-address--so-tickle-me (unknown [10.10.10.51]) by mail.missioncriticalit.com (Postfix) with ESMTPSA id 7CA1E5002C9; Thu, 28 Aug 2014 17:40:11 +0200 (CEST) X-Url: Under construction... X-Archive: encrypt In-Reply-To: <61C65218-4004-4FD5-ABE0-6C863E5F60A6-MMJ3jE1zGgOaMJb+Lgu22Q@public.gmane.org> (Sebastian Wiesner's message of "Thu, 28 Aug 2014 17:25:56 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.93 (windows-nt) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 213.224.53.58 X-BeenThere: help-gnu-emacs-mXXj517/zsQ@public.gmane.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-mXXj517/zsQ@public.gmane.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org-mXXj517/zsQ@public.gmane.org Xref: news.gmane.org gmane.emacs.help:99471 Archived-At: Hello Sebastian, Sebastian Wiesner wrote: > Am 28.08.2014 um 14:05 schrieb Sebastien Vauban : > >> 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=E2=80=99s not. Flycheck runs the byte compiler on your init.el, and= =E2=80=A6 > >> 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/=E2=80=9E) > > =E2=80=A6this expression is **not** evaluated by the byte compiler, so=E2= =80=A6 Anything to do about this? > (in an unrelated note, this is a *very strange thing to do*. The path su= ggests > that you are using package.el to install Flycheck, but in that case you s= hould > *not* set up the load-path manual. Instead call "(package-initialize)") I know package, and I'm using it. Here, in an ECM ("Minimal Working Example", in French), I've added that line to my .emacs to really show that the path was correctly set up. In my real example, I just have a call to package-initialize (in some GNUEmacs macro, though) but I have the same problems about free variables. I added explicit require's to be sure as well that packages were loaded. But, as you say... >> (require =E2=80=9Aflycheck) > > =E2=80=A6when the byte compiler tries to evaluate this expression, Flyche= ck is not in > your load-path, hence the error below. ... if the path is not updated, it never will find the packages... > Top-level "require"s are a special case. The byte compiler evaluates the= se to > load dependencies and macros, but it will **not** generally evaluated oth= er > expressions. And many parts of my .emacs are in macros such as RunningWindows, GNUEmacs, RunningCygwinVersion, etc. >> ;; 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, flyc= heck (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 =E2=80=9Aflycheck) > > As said above, the byte compiler doesn=E2=80=99t evaluate arbitrary expre= ssions, and it > doesn=E2=80=99t evaluate this call either. Hence, it never attempts to a= ctually load > Flycheck, so there=E2=80=99s no error, but since Flycheck isn=E2=80=99t l= oaded, 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" s= yntax > checker [1] to set the "load-path" for Flycheck, or enable "package.el" f= or > 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 ope= n an > issue in Flycheck's issue tracker at https://github.com/flycheck/flycheck= /issues In my case, in fact, my init.el is just a stub with my really really personal settings. It calls another file with more general settings, which I share with colleagues. All my problems are in this last file, which is of course much bigger. This particularity can explain that package is not enabled, right? > [1]: http://flycheck.readthedocs.org/en/latest/guide/languages.html#el.fl= ycheck-checker.emacs-lisp Best regards, Seb --=20 Sebastien Vauban