0

I new with elpa/melpa, and can not understand: should package (installed from melpa repository) be autoload by emacs during start or not?

I install 'company' from melpa repo, and (require 'company) in my ".emacs" failed: LANG=C emacs --debug-init show such error:

Debugger entered--Lisp error: (file-error "Cannot open load file" "No such file or directory" "company") require(company) eval-buffer(# nil "/home/user/.emacs" nil t) ; Reading at buffer position 9609

position 9609 is exactly where (require 'company) ends.

At the same time, when I install "magit" from melpa, all work fine without ".emacs" modification.

So after I install something using M-x list-packages and restart emacs, should installed package be autoload by default? If they should be autoload, why company have different behavior?

I used GNU Emacs 24.5.1

fghj
  • 193
  • 7
  • 'when I install "magit" from melpa, all work fine without ".emacs" modification' - so you don't have `(require 'magit)` in your .emacs? – npostavs Oct 28 '15 at 03:32
  • Yes, I use diff-hl and magit from melpa, and no note about them in .emacs – fghj Oct 28 '15 at 03:34
  • (package-initialize) at the top of .emacs helps, but not clear why magit and diff-hl works without them. – fghj Oct 28 '15 at 03:53
  • I think it's explained in the answer the at the dup target, but basically, Emacs calls `(package-initialize)` after loading your .emacs if you haven't done so. – npostavs Oct 28 '15 at 13:39

1 Answers1

0

(require 'company) in my ".emacs" failed

How did it fail? What message do you get? (See the messages buffer).

If they should be autoload, why company have different behavior?

It is standard as far as I can tell. Install from M-x list-packages and then M-x company-mode to enable it. No need to edit .emacs.d or init.el files unless you want to customize. See usage section of company mode's main web page for more details.

Emacs User
  • 5,553
  • 18
  • 48
  • Perhaps the OP is missing `package-initialize` – lawlist Oct 28 '15 at 02:48
  • @lawlist Probably not since the OP mentions magit works from a melpa install. – Emacs User Oct 28 '15 at 02:53
  • added note about failure message for require company to main post – fghj Oct 28 '15 at 03:12
  • I have several different packages, for example diff-hl, and "diff-hl" works after start without any ".emacs" modification, but not write any where about `package-initialize` in my .emacs – fghj Oct 28 '15 at 03:16