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:45:24 +0200 Message-ID: References: <86ha0w95vp.fsf@somewhere.org> <61C65218-4004-4FD5-ABE0-6C863E5F60A6@lunaryorn.com> <86bnr4wrmh.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 1409240759 11044 80.91.229.3 (28 Aug 2014 15:45:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 28 Aug 2014 15:45:59 +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:45:53 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 1XN1tZ-0006da-2B for geh-help-gnu-emacs@m.gmane.org; Thu, 28 Aug 2014 17:45:53 +0200 Original-Received: from localhost ([::1]:37653 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XN1tY-0004pV-Nj for geh-help-gnu-emacs@m.gmane.org; Thu, 28 Aug 2014 11:45:52 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:52900) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XN1tF-0004nv-K4 for help-gnu-emacs@gnu.org; Thu, 28 Aug 2014 11:45:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XN1tA-0007YW-5m for help-gnu-emacs@gnu.org; Thu, 28 Aug 2014 11:45:33 -0400 Original-Received: from vega.uberspace.de ([95.143.172.245]:57620) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XN1t9-0007YS-Sc for help-gnu-emacs@gnu.org; Thu, 28 Aug 2014 11:45:28 -0400 Original-Received: (qmail 14998 invoked from network); 28 Aug 2014 15:45:26 -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:45:26 -0000 In-Reply-To: <86bnr4wrmh.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:99472 Archived-At: Am 28.08.2014 um 17:39 schrieb Sebastien Vauban = : > Hello Sebastian, >=20 > Sebastian Wiesner wrote: >> Am 28.08.2014 um 14:05 schrieb Sebastien Vauban = : >>=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). >>=20 >> It=92s not. Flycheck runs the byte compiler on your init.el, and=85 >>=20 >>> 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) >>=20 >> =85this expression is **not** evaluated by the byte compiler, so=85 >=20 > Anything to do about this? eval-and-compile >=20 >> (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)") >=20 > I know package, and I'm using it. >=20 > 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. I found that confusing. >=20 >> 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. >=20 > And many parts of my .emacs are in macros such as RunningWindows, > GNUEmacs, RunningCygwinVersion, etc. >=20 >>> ;; 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) >>=20 >> 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. >>=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-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? >>=20 >> 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. >>=20 >> 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 >=20 > 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. >=20 > This particularity can explain that package is not enabled, right? I presume that this =93shared=94 file is not in "~/.emacs.d/", is it? = In that case, Flycheck can't know that it's part of your Emacs = configuration, and treats it as if it were any random Emacs Lisp file, = which means that packages aren't enabled. Add "flycheck-emacs-lisp-initialize-packages" to the file-local = variables of that file, with a value of t. This forces Flycheck to = enable packages when checking the file. >=20 >> [1]: = http://flycheck.readthedocs.org/en/latest/guide/languages.html#el.flycheck= -checker.emacs-lisp >=20 > Best regards, > Seb >=20 > --=20 > Sebastien Vauban