alexeyr / company-auctex

company-mode autocompletion for auctex
49 stars 18 forks source link

error: Unable to activate package 'company-auctex'. #27

Open c02y opened 6 years ago

c02y commented 6 years ago

Every time I git clone my configuration of Emacs into a new machine and start Emacs, there will be error message in Emacs:

error: Unable to activate package 'company-auctex'.
Required package 'auctex-11.87' is unavailable

I know I can fix this problem by package-install auctex manually, but is there a way that I can check if activating company-auctex package failed and then install auctex automatically?

I've trying to use the following in my init.el:

(unless (package-installed-p 'auctex)
    (package-install 'auctex))

But it doesn't work at all and keeps saying the same error message everytime I start my emacs.

So how to fix this problem?

rememberYou commented 6 years ago

Sorry for the late response, I am allowing myself to answer you in order to help others who may encounter this error.

You should know that the auctex package is first available on GNU ELPA which is the default source. I recommend you add the following package sources in your GNU Emacs configuration:

(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
                         ("melpa" . "http://melpa.org/packages/")
                         ("org" . "http://orgmode.org/elpa/")))

NOTE: don't forget to evaluate (package-refresh-contents) to refresh your packages.

In order to better manage your packages, I start you use-package again. Therefore, with the following code:

(use-package company-auctex
  :after (auctex company)
  :config (company-auctex-init))

I hope I helped.