haskell / haskell-mode

Emacs mode for Haskell
http://haskell.github.io/haskell-mode/
GNU General Public License v3.0
1.32k stars 340 forks source link

Unable to load haskell-mode due to file not found #726

Closed k0ral closed 9 years ago

k0ral commented 9 years ago

I've recently updated haskell-mode from 13.7 to 13.14.2, using Emacs 24.5.1 . Now, when I try M-x haskell-mode while editing a haskell source file, I get the following error:

apply: Searching for program: no such file or directory, %s

I've also tried with the HEAD version of the master branch, but got the same error.

Could you please assist ? Thank you.

gracjan commented 9 years ago

Sure, you seem to have enabled some advanced features of haskell-mode and those sadly stopped working. Can you find out all customizations and init.el code that relates to haskell-mode?

k0ral commented 9 years ago

I've tried commenting out almost all of my init.el file, only a couple of non-haskell-related stuff remains, but I'm still getting the error. Using toggle-debug-on-error, I was able to get the stack:

Debugger entered--Lisp error: (file-error "Searching for program" "no such file or directory" "%s")
  call-process("%s" nil t nil "-c" "ghc --supported-extensions")
  apply(call-process "%s" nil t nil ("-c" "ghc --supported-extensions"))
  process-file("%s" nil t nil "-c" "ghc --supported-extensions")
  shell-command-to-string("ghc --supported-extensions")
  (split-string (shell-command-to-string "ghc --supported-extensions"))
  eval((split-string (shell-command-to-string "ghc --supported-extensions")))
  byte-code("\303\304N\211\203   @\202\n)!\207" [symbol sv exp eval saved-value] 4)
  custom-initialize-reset(haskell-ghc-supported-extensions (split-string (shell-command-to-string "ghc --supported-extensions")))
  custom-declare-variable(haskell-ghc-supported-extensions (split-string (shell-command-to-string "ghc --supported-extensions")) "List of language extensions supported by the installed version of GHC." :group haskell :type (repeat string))
  byte-code("\300\301\302\303\304\305\306\307&\210\300\310\302\311\304\312\306\307&\210\300\313\314\315\304\312\306\307&\210\300\316\314\317\304\312\306\307&\210\300\320\321\322\304\323\306\307&\210\300\324\325\326\306\327\304\330&\210\300\331\332\333\306\334\304\335&\210\300\336\337\340\306\334\304\341&\207" [custom-declare-variable haskell-interactive-mode-eval-mode nil "Use the given mode's font-locking to render some text." :type (choice function (const :tag "None" nil)) :group haskell-interactive haskell-interactive-mode-hide-multi-line-errors "Hide collapsible multi-line compile messages by default." boolean haskell-interactive-mode-delete-superseded-errors t "Whether to delete compile messages superseded by recompile/reloads." haskell-interactive-mode-include-file-name "Include the file name of the module being compiled when\nprinting compilation messages." haskell-import-mapping (quote nil) "Support a mapping from module to import lines.\n\nE.g. '((\"Data.Map\" . \"import qualified Data.Map as M\nimport Data.Map (Map)\n\"))\n\nThis will import\n\nimport qualified Data.Map as M\nimport Data.Map (Map)\n\nwhen Data.Map is the candidate.\n\n" (repeat (cons (string :tag "Module name") (string :tag "Import lines"))) haskell-language-extensions (quote nil) "Language extensions in use. Should be in format: -XFoo, -XNoFoo etc." shm (repeat (quote string)) haskell-ghc-supported-extensions (split-string (shell-command-to-string "ghc --supported-extensions")) "List of language extensions supported by the installed version of GHC." haskell (repeat string) haskell-ghc-supported-options (split-string (shell-command-to-string "ghc --show-options")) "List of options supported by the installed version of GHC." (repeat string)] 8)
  require(haskell-customize)
  eval-buffer(#<buffer  *load*> nil "/home/koral/.emacs.d/elpa/haskell-mode-13.14.2/haskell-mode.el" nil t)  ; Reading at buffer position 4487
  load-with-code-conversion("/home/koral/.emacs.d/elpa/haskell-mode-13.14.2/haskell-mode.el" "/home/koral/.emacs.d/elpa/haskell-mode-13.14.2/haskell-mode.el" nil t)
  autoload-do-load((autoload "haskell-mode" "Major mode for editing Haskell programs.\n\nFor more information aee also Info node `(haskell-mode)Getting Started'.\n\n\\<haskell-mode-map>\n\nLiterate Haskell scripts are supported via `literate-haskell-mode'.\nThe variable `haskell-literate' indicates the style of the script in the\ncurrent buffer.  See the documentation on this variable for more details.\n\nUse `haskell-version' to find out what version of Haskell mode you are\ncurrently using.\n\nAdditional Haskell mode modules can be hooked in via `haskell-mode-hook'.\n\nIndentation modes:\n\n    `haskell-indentation-mode', Kristof Bastiaensen, Gergely Risko\n      Intelligent semi-automatic indentation Mk2\n\n    `haskell-indent-mode', Guy Lapalme\n      Intelligent semi-automatic indentation.\n\n    `haskell-simple-indent-mode', Graeme E Moss and Heribert Schuetz\n      Simple indentation.\n\nInteraction modes:\n\n    `interactive-haskell-mode'\n      Interact with per-project GHCi processes through a REPL and\n      directory-aware sessions.\n\n    `inf-haskell-mode'\n      Interact with a GHCi process using comint-mode. Deprecated.\n\nOther modes:\n\n    `haskell-decl-scan-mode', Graeme E Moss\n      Scans top-level declarations, and places them in a menu.\n\n    `haskell-doc-mode', Hans-Wolfgang Loidl\n      Echoes types of functions or syntax of keywords when the cursor is idle.\n\nTo activate a minor-mode, simply run the interactive command. For\nexample, `M-x haskell-doc-mode'. Run it again to disable it.\n\nTo enable a mode for every haskell-mode buffer, add a hook in\nyour Emacs configuration. To do that you can customize\n`haskell-mode-hook' or add lines to your .emacs file. For\nexample, to enable `haskell-indent-mode' and\n`interactive-haskell-mode', use the following:\n\n    (add-hook 'haskell-mode-hook 'haskell-indentation-mode)\n    (add-hook 'haskell-mode-hook 'interactive-haskell-mode)\n\nFor more details see Info node `(haskell-mode)haskell-mode-hook'.\n\nWarning: do not enable more than one of the above indentation\nmodes. See Info node `(haskell-mode)indentation' for more\ndetails.\n\nMinor modes that work well with `haskell-mode':\n\n- `smerge-mode': show and work with diff3 conflict markers used\n  by git, svn and other version control systems.\n\n(fn)" t nil) haskell-mode)
  command-execute(haskell-mode record)
  execute-extended-command(nil "haskell-mode")
  call-interactively(execute-extended-command nil nil)
  command-execute(execute-extended-command)
gracjan commented 9 years ago

Are you by chance on Windows?

This is the problem:

call-process("%s" nil t nil "-c" "ghc --supported-extensions")

Now, this "%s" comes from variable called shell-file-name. Why is that you have it setup to be "%s" is a mystery you need to check. Its default value is "/bin/bash" (on unix-like) and "cmd.exe" on Windows. Why and what has changed this variable?

k0ral commented 9 years ago

I'm on linux. It looks like shell-file-name is incorrect indeed:

shell-file-name is a variable defined in `C source code'.
Its value is "%s"
Original value was "/bin/bash"

Looking at the documentation, this variable is determined by the SHELL environment variable when Emacs is started, and my $SHELL is indeed incorrectly set to %s, for some reason.

As this is not related to haskell-mode, I'm closing this issue. Thank you very much for your help.