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

pause on save and errors with no errors #39

Closed fommil closed 8 years ago

fommil commented 8 years ago

I've just started with clojure, this is my complete emacs config

(use-package flycheck-clojure)
(use-package cider)
(add-hook 'clojure-mode-hook
          (lambda ()
            (setq show-trailing-whitespace t)
            (show-paren-mode)
            (whitespace-mode-with-local-variables)
            ;;(focus-mode)
            (rainbow-mode)
            ;;(prettify-symbols-mode)
            (eldoc-mode)
            (flycheck-clojure-setup)
            (flycheck-mode)
            (yas-minor-mode)
            (company-mode)
            (smartparens-strict-mode)
            (rainbow-delimiters-mode)))
(add-hook 'cider-repl-mode-hook #'eldoc-mode)

and my ~/.lein/profiles.clj looks like this

{:repl {
        :plugins [[cider/cider-nrepl "0.11.0"]]
        :dependencies [[acyclic/squiggly-clojure "0.1.4"]
                       ^:replace [org.clojure/tools.nrepl "0.2.12"]]
        }
}

I added the :plugins bit after following the CIDER installation instructions and I added the :dependencies bit after following your instructions (although I think your README is missing a closing }).

I am not seeing any squigglies in my clojure code (my example project is https://github.com/fommil/twitter-teflon/blob/7a1a50b33c6336865ba1d6cf1951750764585cb6/src/fommil/teflon/core.clj ) e.g. if I introduce any errors in that file such as (Thread/slee 1) I don't see anything.

And when I save the buffer, Emacs freezes for a few seconds and I see the following messages in *Messages*

error in process filter: Wrong number of arguments: (4 . 4), 0 [2 times]
Error from syntax checker clojure-cider-eastwood: Done with no errors

enabling debug-on-error and saving the file gives

Debugger entered--Lisp error: (wrong-number-of-arguments (4 . 4) 0)
  #[1028 "\301\303\304\305\302\300$\"\207" [clojure-cider-eastwood #[128 "\301\302\300#\207" [[cl-struct-flycheck-syntax-check #<buffer core.clj> clojure-cider-eastwood #[0 "\301\300!\207" [[cl-struct-spinner ["[    ]" "[=   ]" "[==  ]" "[=== ]" "[====]" "[ ===]" "[  ==]" "[   =]"] -10 10 [nil 22253 19914 400000 0.1 spinner--timer-function ... nil 80957] nil #<buffer *cider-repl twitter-teflon*> 1] spinner-stop] 2 "\n\n(fn)"]] apply flycheck-report-buffer-checker-status] 5 "\n\n(fn &rest ARGS)"] #[257 "\300\301\"\207" [format "(do (require 'squiggly-clojure.core) (squiggly-clojure.core/check-ew '%s))"] 4 "\n\n(fn NS)"] errored format "Form %s of checker %s failed: %s"] 11 "\n\n(fn BUFFER EX ROOTEX SESS)"]()
  #[257 "\307\310\"\307\311\"\307\312\"\307\313\"\307\314\"\307\315\"\307\316\"\317\300!\2038r\300q\210\2037\320\321!\2047\322!\210)\203I\301\205\303\301\300\"\202\303\203Y\302\205\303\302\300\"\202\303\211\203s\306\203h\306\300\"\202\303\302\205\303\302\300\"\202\303\203\202\303\205\303\303\300\"\202\303\205\303\323\235\203\220\324\325!\210\326\235\203\236\305\206\234 \210\327\235\203\250\324\330!\210\331\235\203\262\332\300!\210\333\235\205\303\334!\210\304\205\303\304\300!\207" [#<buffer core.clj> #[514 "\301\302rq\210\303\300\")\"\207" [clojure-cider-eastwood #[128 "\301\302\300#\207" [[cl-struct-flycheck-syntax-check #<buffer core.clj> clojure-cider-eastwood #[0 "\301\300!\207" [[cl-struct-spinner ["[    ]" "[=   ]" "[==  ]" "[=== ]" "[====]" "[ ===]" "[  ==]" "[   =]"] -10 10 [nil 22253 19914 400000 0.1 spinner--timer-function ... nil 80957] nil #<buffer *cider-repl twitter-teflon*> 1] spinner-stop] 2 "\n\n(fn)"]] apply flycheck-report-buffer-checker-status] 5 "\n\n(fn &rest ARGS)"] finished flycheck-clojure-parse-cider-errors] 7 "\n\n(fn BUFFER VALUE)"] nil nil #[257 "\300\301\302\"\207" [#[128 "\301\302\300#\207" [[cl-struct-flycheck-syntax-check #<buffer core.clj> clojure-cider-eastwood #[0 "\301\300!\207" [[cl-struct-spinner ["[    ]" "[=   ]" "[==  ]" "[=== ]" "[====]" "[ ===]" "[  ==]" "[   =]"] -10 10 [nil 22253 19914 400000 0.1 spinner--timer-function ... nil 80957] nil #<buffer *cider-repl twitter-teflon*> 1] spinner-stop] 2 "\n\n(fn)"]] apply flycheck-report-buffer-checker-status] 5 "\n\n(fn &rest ARGS)"] errored "Done with no errors"] 4 "\n\n(fn ##)"] #[1028 "\301\303\304\305\302\300$\"\207" [clojure-cider-eastwood #[128 "\301\302\300#\207" [[cl-struct-flycheck-syntax-check #<buffer core.clj> clojure-cider-eastwood #[0 "\301\300!\207" [[cl-struct-spinner ["[    ]" "[=   ]" "[==  ]" "[=== ]" "[====]" "[ ===]" "[  ==]" "[   =]"] -10 10 [nil 22253 19914 400000 0.1 spinner--timer-function ... nil 80957] nil #<buffer *cider-repl twitter-teflon*> 1] spinner-stop] 2 "\n\n(fn)"]] apply flycheck-report-buffer-checker-status] 5 "\n\n(fn &rest ARGS)"] #[257 "\300\301\"\207" [format "(do (require 'squiggly-clojure.core) (squiggly-clojure.core/check-ew '%s))"] 4 "\n\n(fn NS)"] errored format "Form %s of checker %s failed: %s"] 11 "\n\n(fn BUFFER EX ROOTEX SESS)"] nil nrepl-dict-get "value" "ns" "out" "err" "status" "id" "pprint-out" buffer-live-p derived-mode-p clojure-mode cider-set-buffer-ns "interrupted" message "Evaluation interrupted." "eval-error" "namespace-not-found" "Namespace not found." "need-input" cider-need-input "done" nrepl--mark-id-completed nrepl-err-handler] 11 "\n\n(fn RESPONSE)"]((dict "ex" "class java.io.FileNotFoundException" "id" "93" "root-ex" "class java.io.FileNotFoundException" "session" "62eaa928-4a58-415d-9b70-ac11388fc8b0" "status" ("eval-error")))
  #[257 "\303\300!\203*\304\305\"\306\235\206\307\235\206\310\235\262\203*r\300q\210\n\203)\311 \210)\301!\207" [#<buffer *cider-repl twitter-teflon*> #[257 "\307\310\"\307\311\"\307\312\"\307\313\"\307\314\"\307\315\"\307\316\"\317\300!\2038r\300q\210\2037\320\321!\2047\322!\210)\203I\301\205\303\301\300\"\202\303\203Y\302\205\303\302\300\"\202\303\211\203s\306\203h\306\300\"\202\303\302\205\303\302\300\"\202\303\203\202\303\205\303\303\300\"\202\303\205\303\323\235\203\220\324\325!\210\326\235\203\236\305\206\234 \210\327\235\203\250\324\330!\210\331\235\203\262\332\300!\210\333\235\205\303\334!\210\304\205\303\304\300!\207" [#<buffer core.clj> #[514 "\301\302rq\210\303\300\")\"\207" [clojure-cider-eastwood #[128 "\301\302\300#\207" [[cl-struct-flycheck-syntax-check #<buffer core.clj> clojure-cider-eastwood #[0 "\301\300!\207" [[cl-struct-spinner ["[    ]" "[=   ]" "[==  ]" "[=== ]" "[====]" "[ ===]" "[  ==]" "[   =]"] -10 10 [nil 22253 19914 400000 0.1 spinner--timer-function ... nil 80957] nil #<buffer *cider-repl twitter-teflon*> 1] spinner-stop] 2 "\n\n(fn)"]] apply flycheck-report-buffer-checker-status] 5 "\n\n(fn &rest ARGS)"] finished flycheck-clojure-parse-cider-errors] 7 "\n\n(fn BUFFER VALUE)"] nil nil #[257 "\300\301\302\"\207" [#[128 "\301\302\300#\207" [[cl-struct-flycheck-syntax-check #<buffer core.clj> clojure-cider-eastwood #[0 "\301\300!\207" [[cl-struct-spinner ["[    ]" "[=   ]" "[==  ]" "[=== ]" "[====]" "[ ===]" "[  ==]" "[   =]"] -10 10 [nil 22253 19914 400000 0.1 spinner--timer-function ... nil 80957] nil #<buffer *cider-repl twitter-teflon*> 1] spinner-stop] 2 "\n\n(fn)"]] apply flycheck-report-buffer-checker-status] 5 "\n\n(fn &rest ARGS)"] errored "Done with no errors"] 4 "\n\n(fn ##)"] #[1028 "\301\303\304\305\302\300$\"\207" [clojure-cider-eastwood #[128 "\301\302\300#\207" [[cl-struct-flycheck-syntax-check #<buffer core.clj> clojure-cider-eastwood #[0 "\301\300!\207" [[cl-struct-spinner ["[    ]" "[=   ]" "[==  ]" "[=== ]" "[====]" "[ ===]" "[  ==]" "[   =]"] -10 10 [nil 22253 19914 400000 0.1 spinner--timer-function ... nil 80957] nil #<buffer *cider-repl twitter-teflon*> 1] spinner-stop] 2 "\n\n(fn)"]] apply flycheck-report-buffer-checker-status] 5 "\n\n(fn &rest ARGS)"] #[257 "\300\301\"\207" [format "(do (require 'squiggly-clojure.core) (squiggly-clojure.core/check-ew '%s))"] 4 "\n\n(fn NS)"] errored format "Form %s of checker %s failed: %s"] 11 "\n\n(fn BUFFER EX ROOTEX SESS)"] nil nrepl-dict-get "value" "ns" "out" "err" "status" "id" "pprint-out" buffer-live-p derived-mode-p clojure-mode cider-set-buffer-ns "interrupted" message "Evaluation interrupted." "eval-error" "namespace-not-found" "Namespace not found." "need-input" cider-need-input "done" nrepl--mark-id-completed nrepl-err-handler] 11 "\n\n(fn RESPONSE)"] spinner-current buffer-live-p nrepl-dict-get "status" "done" "eval-error" "error" spinner-stop] 4 "\n\n(fn RESPONSE)"]((dict "ex" "class java.io.FileNotFoundException" "id" "93" "root-ex" "class java.io.FileNotFoundException" "session" "62eaa928-4a58-415d-9b70-ac11388fc8b0" "status" ("eval-error")))
  nrepl--dispatch-response((dict "ex" "class java.io.FileNotFoundException" "id" "93" "root-ex" "class java.io.FileNotFoundException" "session" "62eaa928-4a58-415d-9b70-ac11388fc8b0" "status" ("eval-error")))
  nrepl-client-filter(#<process nrepl-connection> "d2:ex35:class java.io.FileNotFoundException2:id2:937:root-ex35:class java.io.FileNotFoundException7:session36:62eaa928-4a58-415d-9b70-ac11388fc8b06:statusl10:eval-erroree")
fommil commented 8 years ago

looks like this might be https://github.com/clojure-emacs/squiggly-clojure/issues/29

fommil commented 8 years ago

by following the hints in the linked ticket, I changed the profiles to

{:repl {
        :plugins [[cider/cider-nrepl "0.11.0"]]
        }
 :user {
        :dependencies [[acyclic/squiggly-clojure "0.1.4"]]
        }
}

and restarted Emacs. I no longer get pauses or errors on save, although errors now fail in a compile phase when I run lein run (which is good) but still no squigglies.

tanzoniteblack commented 8 years ago

Hey, @fommil , welcome to the Clojure world!

About the errors in checking: I don't believe you're actually using the right (i.e. latest) versions of either cider-nrepl or squiggly-clojure, which might be part of your problem.

Both of these projects now auto-inject these values for you without you having to set up a ~/.lein/profiles.clj at all now (this is a somewhat recent change, so not all documentation is making this overly clear yet). Try just deleting your ~/.lein/profile.clj if you don't have anything not-cider related in it and see if it fixes the problem.

About the long pauses: I have a pull request open to fix this issue (https://github.com/clojure-emacs/squiggly-clojure/pull/38) , but it seems to have hung in having a decision made around it @pnf ?

fommil commented 8 years ago

ok, cool! That actually worked. Let's leave this open as a documentation ticket. i.e. the fix is "ignore the docs, they are wrong."

tanzoniteblack commented 8 years ago

There is a very small comment on it in the documentation (see the paragraph immediately above https://github.com/clojure-emacs/squiggly-clojure#configuration ), but we should probably make that a bit more obvious :) .

pnf commented 8 years ago

@tanzoniteblack I was hoping for a comment from @expez on https://github.com/clojure-emacs/squiggly-clojure/pull/38, as it seemed to be a partial revert of one his commits. I think I'll go ahead and merge it though, as it looks right to me.

pnf commented 8 years ago

@fommil Welcome to clojureland. After your indoctrination is complete, I may enlist you in my effort to foist transducers on a certain scala shop. The configuration instructions are a perennial mess. We should be using squiggly-clojure 0.1.5 and cider-nrepl 0.11.0-snapshot, to be consistent with the "latest" cider. Cloning your repo and using a minimal .lein/profiles.clj that specifies these for the :repl profile, I get the expected

    3   1 warning         Constant value is discarded: "I can say hello."... (clojure-cider-eastwood)

I'm tempted to just refer people to the main cider docs for all cider-related dependencies.

pnf commented 8 years ago

With the last commit, the README encourages use of cider-jack-in dependency injection and refers cider-connecters to the Cider docs for exact version numbers.

fommil commented 8 years ago

I am afraid my indocrination is suffering major problems, as I can't get OAuth 1.0A to work against twitter. Pretty much every auth library I can see in clojure has been dormant for 5 years.

pnf commented 8 years ago

It is a JVM language, you know.

On Mar 19, 2016, at 13:47, Sam Halliday notifications@github.com wrote:

I am afraid my indocrination is suffering major problems, as I can't get OAuth 1.0A to work against twitter. Pretty much every auth library I can see in clojure has been dormant for 5 years.

— You are receiving this because you modified the open/close state. Reply to this email directly or view it on GitHub