all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Sebastien Vauban <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
To: Sebastian Wiesner <swiesner-MMJ3jE1zGgOaMJb+Lgu22Q@public.gmane.org>
Cc: help-gnu-emacs-mXXj517/zsQ@public.gmane.org
Subject: Re: Flycheck reports are never satisfying!?
Date: Thu, 28 Aug 2014 17:39:18 +0200	[thread overview]
Message-ID: <86bnr4wrmh.fsf@somewhere.org> (raw)
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")

Hello Sebastian,

Sebastian Wiesner wrote:
> Am 28.08.2014 um 14:05 schrieb Sebastien Vauban <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org>:
>
>> Trying to use, since short, Flycheck on all my prog modes; hence, on my
>> Emacs configuration file as well.
>> 
>> 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’s not.  Flycheck runs the byte compiler on your init.el, and…
>
>> Two ECM follow, showing what happens for all packages which I load and
>> customize.
>> 
>>    Note that, here, I took an extract from Flycheck's configuration
>>    itself, but the problem is the same with every third party
>>    package...
>> 
>> 1. With an explicit package require:
>> 
>> --8<---------------cut here---------------start------------->8---
>> ;;; .emacs-minimal.el --- Test file
>> 
>> ;;; Commentary:
>> 
>> ;;; Code:
>> 
>> (add-to-list 'load-path "~/.emacs.d/elpa/flycheck-20140824.731/„)
>
> …this expression is **not** evaluated by the byte compiler, so…

Anything to do about this?

> (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)")

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 ‚flycheck)
>
> …when the byte compiler tries to evaluate this expression, Flycheck 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 these to
> load dependencies and macros, but it will **not** generally evaluated other
> 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)
>> 
>>  ;; indicate errors and warnings via icons in the left fringe
>>  (setq flycheck-indication-mode 'left-fringe)
>> 
>>  ;; enable Flycheck mode in all buffers
>>  (add-hook 'after-init-hook 'global-flycheck-mode))
>> 
>> (provide '.emacs-minimal)
>> 
>> ;;; .emacs-minimal.el ends here
>> --8<---------------cut here---------------end--------------->8---
>> 
>> Flycheck reports one ERROR:
>> 
>> --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---
>> 
>> 2. With an implicit package require (call to function `try-require'):
>> 
>> --8<---------------cut here---------------start------------->8---
>> ;;; .emacs-minimal2.el --- Test file
>> 
>> ;;; Commentary:
>> 
>> ;;; Internal function:
>> 
>> (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)))
>> 
>> ;;; Code:
>> 
>> (add-to-list 'load-path "~/.emacs.d/elpa/flycheck-20140824.731/")
>> 
>> ;; modern on-the-fly syntax checking
>> (when (try-require ‚flycheck)
>
> As said above, the byte compiler doesn’t evaluate arbitrary expressions, and it
> doesn’t evaluate this call either.  Hence, it never attempts to actually load
> Flycheck, so there’s no error, but since Flycheck isn’t loaded, you get the
> warnings about free variables.
>
>>  ;; indicate errors and warnings via icons in the left fringe
>>  (setq flycheck-indication-mode 'left-fringe)
>> 
>>  ;; enable Flycheck mode in all buffers
>>  (add-hook 'after-init-hook 'global-flycheck-mode))
>> 
>> (provide '.emacs-minimal2)
>> 
>> ;;; .emacs-minimal2.el ends here
>> --8<---------------cut here---------------end--------------->8---
>> 
>> Flycheck reports one warning:
>> 
>> --8<---------------cut here---------------start------------->8---
>>   25   9 warning  assignment to free variable `flycheck-indication-mode' (emacs-lisp)
>> --8<---------------cut here---------------end--------------->8---
>> 
>> 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

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.flycheck-checker.emacs-lisp

Best regards,
  Seb

-- 
Sebastien Vauban



  parent reply	other threads:[~2014-08-28 15:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-28 12:05 Flycheck reports are never satisfying!? Sebastien Vauban
2014-08-28 13:40 ` Stefan Monnier
2014-08-28 15:15   ` Sebastian Wiesner
2014-08-28 15:48     ` Stefan Monnier
2014-08-29  9:01       ` Sebastian Wiesner
2014-08-29 13:05         ` Stefan Monnier
     [not found]     ` <mailman.7732.1409240949.1147.help-gnu-emacs@gnu.org>
2014-08-28 17:35       ` Sebastien Vauban
2014-08-29  3:32         ` Stefan Monnier
     [not found] ` <mailman.7720.1409233288.1147.help-gnu-emacs@gnu.org>
2014-08-28 14:14   ` Sebastien Vauban
2014-08-28 14:38     ` Stefan Monnier
2014-08-28 15:51       ` worrying about byte-compiler warnings [was: Flycheck reports are never satisfying!?] Drew Adams
2014-08-28 15:25 ` Flycheck reports are never satisfying!? Sebastian Wiesner
     [not found]   ` <61C65218-4004-4FD5-ABE0-6C863E5F60A6-MMJ3jE1zGgOaMJb+Lgu22Q@public.gmane.org>
2014-08-28 15:39     ` Sebastien Vauban [this message]
2014-08-28 15:45       ` Sebastian Wiesner
     [not found]         ` <B540BE8A-D03C-4F2D-ADB7-2A17F8E55F4E-MMJ3jE1zGgOaMJb+Lgu22Q@public.gmane.org>
2014-08-28 18:35           ` Sebastien Vauban
     [not found]         ` <mailman.7753.1409250970.1147.help-gnu-emacs@gnu.org>
     [not found]           ` <mailman.7753.1409250970.1147.help-gnu-emacs-mXXj517/zsQ@public.gmane.org>
2014-09-01 10:00             ` Sebastien Vauban
2014-09-01 10:23               ` Sebastian Wiesner
2014-09-01 12:27 ` sokobania.01
2014-09-01 12:30 ` sokobania.01

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=86bnr4wrmh.fsf@somewhere.org \
    --to=sva-news-d0wtavr13harg/idocfnwg@public.gmane.org \
    --cc=help-gnu-emacs-mXXj517/zsQ@public.gmane.org \
    --cc=swiesner-MMJ3jE1zGgOaMJb+Lgu22Q@public.gmane.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.