clojure-emacs / squiggly-clojure

Flycheck checker for Clojure, using eastwood and core.typed.
GNU General Public License v3.0
204 stars 25 forks source link

Flycheck mode needs to be manually enabled sometimes. #17

Closed pnf closed 9 years ago

pnf commented 9 years ago

If a .clj file is opened before there is an appropriate Cider connection, the predicate will fail and flycheck will not be enabled. This results in a fiddly required workflow that can be confusing. Move the Cider check into the checkers themselves, rendering them noops but allowing them to run. @lunaryorn - Is this awful? I'm trying it out in master but not versioning it yet.

pnf commented 9 years ago

Done in 4aa6769. Keeping issue open until convinced that this is the right answer. You can now do the following:

  1. Start emacs, flycheck-clojure-setup, flycheck-global-mode, etc.
  2. Open a .clj; flycheck mode will be enabled, but checkers will be noops.
  3. cider-jack-in; checkers are no longer noops on the emacs side, but the Clojure functions report nothing, since nothing's been loaded.
  4. cider-load-file; flycheck-clojure is now active, but of course shows nothing until you
  5. tickle the buffer
swsnr commented 9 years ago

@pnf Well, I think it's an issue in Global Flycheck Mode itself, actually. The current logic which checks whether to enable Flycheck Mode in a buffer predates generic checkers.

Nowadays, new syntax checkers could become available any time, so Global Flycheck Mode should unconditionally enable Flycheck Mode, even if there's no syntax checker et.

See flycheck/flycheck#568. I'll merge it if the test suite passes, because I'm not sure yet whether this has implications with other parts of Flycheck, and I'm too lazy to run the test suite locally. Travis CI ftw.

I'll ping you if it's merged. By then, you should be able to just keep the Clojure checkers as they were, and Flycheck Mode will automatically pick them up once a Cider REPL spawns.

mwfogleman commented 9 years ago

:+1: Thanks! :)

swsnr commented 9 years ago

@pnf @mwfogleman It's merged. Flycheck Mode is now always enabled for Clojure Mode, and will pick up these syntax checkers as soon as Cider becomes available.

pnf commented 9 years ago

With 0.1.3, the original predicate logic is restored, corresponding with flycheck 0.22, which will now allow flycheck mode to be started automatically, even if the predicate fails. It is verified that, if flycheck-global-mode is true and flycheck-clojure-setup has been run, then opening a .clj file with no associated Cider connection will result in a "FlyC-" annunciator. Once Cider is connected, flycheck will report no errors ("FlyC:0/0") until the Clojure file is loaded, at which point all checkers will run and display appropriate errors.

swsnr commented 9 years ago

@pnf Did you release 0.1.3 already?

If not, you might want to wait for some days. I would then release Flycheck 0.23 this weekend, including the patch. squiggly-clojure could then add a hard dependency on Flycheck 0.23 before the release, so that users which install from MELPA Stable don't get to install two “incompatible” versions.

What do you think?

pnf commented 9 years ago

Unfortunately, I did.


Sent from my VAX-11/780

On Jan 16, 2015, at 06:18, Sebastian Wiesner notifications@github.com wrote:

@pnf Did you release 0.1.3 already?

If not, you might want to wait for some days. I would then release Flycheck 0.23 this weekend, including the patch. squiggly-clojure could then add a hard dependency on Flycheck 0.23 before the release, so that users which install from MELPA Stable don't get to install two “incompatible” versions.

What do you think?

— Reply to this email directly or view it on GitHub.

swsnr commented 9 years ago

@pnf Never mind :)

benedekfazekas commented 9 years ago

@lunaryorn (cc @pns) 0.23 still does not seem to be out. that is blocking clojure-emacs/example-config/pull/3 any chance this can make to melpa?

swsnr commented 9 years ago

@benedekfazekas It is on MELPA, just not on MELPA Stable, so whom am I blocking and why?! Please give me a summary of the issue you referenced.

benedekfazekas commented 9 years ago

it is basically a project with sample config for new starters of clojure in emacs. we want to add flycheck clojure (that is the PR about). for the sake of stability we only pull packages from melpa stable. any chance 0.23 can make stable soonish?

swsnr commented 9 years ago

@benedekfazekas Pretty low.

I do not believe that MELPA is any less stable than MELPA Stable, and it definitely doesn't hold for Flycheck, so as far as I'm concerned you might as well pull from MELPA.

For the same reason I don't release regularly, and when I do there should be more than a bunch of bug fixes. Making a release doesn't come for free after all, particularly with regards to making a proper release announcement post.

If it's really so damn important to you, I can probably make a release this weekend, but you'll need to remember me, or I'll forget, since I for my part care little about releases—the vast majority of Flycheck's users come from MELPA.

benedekfazekas commented 9 years ago

fair enough. will look into going around this and pull flycheck from melpa instead of stable. will ping you only if i don't manage for some reason which is not very likely. thx for looking into this

swsnr commented 9 years ago

@benedekfazekas I'm afraid that the way package.el currently works makes it very hard for you to only Flycheck from MELPA. But I don't see any harm in pulling everything from MELPA. YMMV, of course, but in that case you'll have to wait until I make a release.