commercialhaskell / stack-ide

Stack-based JSON interface to ide-backend
98 stars 23 forks source link

Flycheck: File mode specification error: (wrong-type argument stringp nil) #91

Closed mtesseract closed 5 years ago

mtesseract commented 8 years ago

Hi,

I am trying to setup stack-mode in Emacs 24 for the first time -- so far with no luck. My ~/.emacs is this:

(when (>= emacs-major-version 24)
  (require 'package)
  (add-to-list
   'package-archives
   '("melpa" . "http://melpa.org/packages/")
   t)
  (package-initialize))

(add-to-list 'load-path "~/src/stack-ide/stack-mode/")
(require 'stack-mode)
(add-hook 'haskell-mode-hook 'stack-mode)

I have installed flycheck from melpa and stack-mode by following the steps on https://github.com/commercialhaskell/stack-ide. When I open a Haskell source file Emacs throws the following error:

File mode specification error: (wrong-type-argument stringp nil)

The relevant part of the backtrace is:

signal(wrong-type-argument (stringp nil))
#[257 "300 210301@A"207" [flycheck-report-failed-syntax-check signal] 4 "nn(fn ERR)"]((wrong-type-argument stringp nil))
funcall(#[257 "300 210301@A"207" [flycheck-report-failed-syntax-check signal] 4 "nn(fn ERR)"] (wrong-type-argument stringp nil))
flycheck-buffer()
flycheck-select-checker(stack-ide)
(progn (flycheck-mode 1) (flycheck-select-checker (quote stack-ide)) (flycheck-buffer))
(if stack-mode-manage-flycheck (progn (flycheck-mode 1) (flycheck-select-checker (quote stack-ide)) (flycheck-buffer)))
(progn (if (and (boundp (quote interactive-haskell-mode)) interactive-haskell-mode) (progn (if (y-or-n-p "interactive-haskell-mode is enabled. Disable it?") (progn (interactive-haskell-mode -1))))) (if stack-mode-manage-flycheck (progn (flycheck-mode 1) (flycheck-select-checker (quote stack-ide)) (flycheck-buffer))))
(if stack-mode (progn (if (and (boundp (quote interactive-haskell-mode)) interactive-haskell-mode) (progn (if (y-or-n-p "interactive-haskell-mode is enabled. Disable it?") (progn (interactive-haskell-mode -1))))) (if stack-mode-manage-flycheck (progn (flycheck-mode 1) (flycheck-select-checker (quote stack-ide)) (flycheck-buffer)))) (if stack-mode-manage-flycheck (progn (flycheck-mode -1))))
(progn (if stack-mode (progn (if (and (boundp (quote interactive-haskell-mode)) interactive-haskell-mode) (progn (if (y-or-n-p "interactive-haskell-mode is enabled. Disable it?") (progn (interactive-haskell-mode -1))))) (if stack-mode-manage-flycheck (progn (flycheck-mode 1) (flycheck-select-checker (quote stack-ide)) (flycheck-buffer)))) (if stack-mode-manage-flycheck (progn (flycheck-mode -1)))))
(if (buffer-file-name) (progn (if stack-mode (progn (if (and (boundp (quote interactive-haskell-mode)) interactive-haskell-mode) (progn (if (y-or-n-p "interactive-haskell-mode is enabled. Disable it?") (progn ...)))) (if stack-mode-manage-flycheck (progn (flycheck-mode 1) (flycheck-select-checker (quote stack-ide)) (flycheck-buffer)))) (if stack-mode-manage-flycheck (progn (flycheck-mode -1))))))
(let ((last-message (current-message))) (setq stack-mode (if (eq arg (quote toggle)) (not stack-mode) (> (prefix-numeric-value arg) 0))) (if (buffer-file-name) (progn (if stack-mode (progn (if (and (boundp ...) interactive-haskell-mode) (progn (if ... ...))) (if stack-mode-manage-flycheck (progn (flycheck-mode 1) (flycheck-select-checker ...) (flycheck-buffer)))) (if stack-mode-manage-flycheck (progn (flycheck-mode -1)))))) (run-hooks (quote stack-mode-hook) (if stack-mode (quote stack-mode-on-hook) (quote stack-mode-off-hook))) (if (called-interactively-p (quote any)) (progn nil (if (and (current-message) (not (equal last-message (current-message)))) nil (message "Stack mode %sabled" (if stack-mode "en" "dis"))))))
stack-mode()

Am I doing something wrong here?

Thanks ~ M

mtesseract commented 8 years ago

To keep it simple, I had been testing this stack-ide setup with a small Haskell source file, without any .cabal file, just a plain .hs file. It seems that this triggered the above problem. I cannot reproduce the problem anymore when loading a Haskell source file inside a cabalized project.

temco commented 5 years ago

When I dropped either clj file into the emacs with flycheck mode enabled, a similar error was shown at the message windows. If I dumped the backtrace with toggle the debug-on-the-error, it said

signal(wrong-type-argument listp 1)

#[257 "\300\301@DA@E\207" [put-clojure-indent quote] ...

I thought maybe it's a conflict when flycheck processes the clojure-mode.elc?

mtesseract commented 5 years ago

I would have suggested to close this issue. @temco You know that the issue documented here is about editing Haskell code in Emacs, right? Maybe I misunderstood your point, but triggering Flycheck errors with Clojure code should probably reported elsewhere.

mgsloan commented 5 years ago

Hmm, yeah this project should probably be archived (https://help.github.com/articles/archiving-a-github-repository/). Closing this issue.