1

I installed haskell-mode, and I follow this tutorial to install company here. But it only ran once; now when I launch Emacs I get this error:

Warning (initialization): An error occurred while loading /home/lowley/.emacs':
File error: Cannot open load file, company
To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the --debug-init' option to view a complete error backtrace.

on M-x company-mode, the company mode is activated but if I enter putS it proposes putStrLn only (no putStr) and the mode turns to company-<dabbrev-code.

Here is my emacs config file :

(require 'package)
(custom-set-variables
 '(package-archives
   (quote
    (("gnu" . "http://elpa.gnu.org/packages/")
     ("melpa-stable" . "http://stable.melpa.org/packages/")))))


(custom-set-variables
 '(custom-enabled-themes (quote (misterioso))))
(custom-set-faces
 )

(add-hook 'haskell-mode-hook 'turn-on-haskell-indentation)

(let ((my-cabal-path (expand-file-name "~/.cabal/bin")))
  (setenv "PATH" (concat my-cabal-path ":" (getenv "PATH")))
  (add-to-list 'exec-path my-cabal-path))

(add-to-list 'load-path "~/.cabal/share/ghc-mod-5.4.0.0")

(autoload 'ghc-init "ghc" nil t)
(autoload 'ghc-debug "ghc" nil t)
(add-hook 'haskell-mode-hook (lambda () (ghc-init)))

(require 'company)
(add-hook 'after-init-hook 'global-company-mode)

(add-to-list 'company-backends 'company-ghc)
(custom-set-variables '(company-ghc-show-info t))
1

If you want to have the ELPA packages activated already when the init script runs, you should call (package-initialize) first.

-1

The error indicates that emacs cannot find the company package when it hits the (require 'company) in your init file. Use M-x list-packages to install it.

  • Yes, that's what I beleived but when I tried to install it emacs told me it was already installed. Do you know how to repair it, in case of a corrupted package ? – lolveley Nov 12 '15 at 12:16
  • package-install followed by company produces a downloading and some compilations but there is an error : Compiling file /home/lowley/.emacs.d/elpa/company-0.8.12/test/async-tests.el at Thu Nov 12 13:45:49 2015 async-tests.el:22:1:Error: Cannot open load file: company-tests. I tried package-install company-tests but it seems to be not recognised. – lolveley Nov 12 '15 at 12:58
  • Disregard the error about company-tests; it's a packaging problem. You don't need the tests to use it anyway. – Dmitry Dec 5 '15 at 23:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.