-1

I've entered into the fabulous world of Emacs about 2 weeks ago and I like it more and more, but at this point there are some mysterious point that make me freak a little because I don't want to mess up my Emacs. It's about the package manager, I've installed auctex and the autocomplete mode for latex and now I want to try it's newest equivalent company. So I've installed packages company, company-auctex and company-math but it seems that it's not enabled after installing and it's not the behaviour of the manager I was waiting for, according to the GNU Emacs page on installing package. So have I to add lines (which I am not familiar with yet) in .emacs for each package ? Also, what is the "packagename"-autoloads.el file for ? I guess it should do what I am asking for but it doesn't on my session, I can say it because when I type \su like on the company-math Github page there are no completion...

Thank you for reading, I've said a lot ! And sorry if my English is not entirely correct.

  • Have you added (company-auctex-init) to your .emacs file? – caisah Oct 10 '15 at 10:45
  • The question is a bit unclear. Try showing the code that you use, or provide a step-by-step description of what you've done. – Drew Oct 10 '15 at 14:55
  • He said he is new to emacs and he is saying that he is not sure if he needs to add stuff to his .emacs file, so my guess is that no, he hasn't added that line to his .emacs file and he doesn't have any code to show. – Vivi Oct 12 '15 at 11:46
0

This is the bit of configuration I have that works. First, I added the following to my .emacs file

;; puts my .emacs.d folder in emacs' load path
     (let ((base "~/Dropbox/.emacs.d"))
       (add-to-list 'load-path base)
       (dolist (f (directory-files base))
         (let ((name (concat base "/" f)))
           (when (and (file-directory-p name)
                      (not (equal f ".."))
                      (not (equal f ".")))
             (add-to-list 'load-path name)))))

Then I set up my package manager to install all new packages in the folder ~/Dropbox/.emacs.d/packages (which is in the load path as it is inside the .emacs.d folder I set up above)

 ;; Package installation - MELPA . Use M-x list-packages
 (require 'package) ;; You might already have this line
 (add-to-list 'package-archives
              '("melpa" . "https://melpa.org/packages/"))
 (when (< emacs-major-version 24)
;; ;; For important compatibility libraries like cl-lib
   (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
 (setq package-user-dir "~/Dropbox/.emacs.d/packages")
 (package-initialize) ;; You might already have this line
 (put 'downcase-region 'disabled nil)

Then all packages you install will go to your .emacs.d/packages folder. Then all you need to do when you install a new package is to look at the packagename.el file and see what is required to get it to work. For example, company-auctex (in the company-auctex.el file linked) says in the "preamble" the first bit of information commented out (with ;; before each line):

To use:
;; (require 'company-auctex)
;; (company-auctex-init)

So you add those two lines to your .emacs after the two pieces of code above. You need to do this for each package you install. Some packages don't require anything and just work, but others need a few lines to initialise and others you will want to customize as well.

  • You should not add your .emacs.d/ dir to load-path. Instead set the user-emacs-directory variable to your .emacs.d/ dir path. – Kaushal Modi Oct 12 '15 at 13:37
  • Also, please remove the code not relevant to the solution, like: (put 'downcase-region 'disabled nil). – Kaushal Modi Oct 12 '15 at 13:38
  • @kaushalmodi feel free to edit my answer – Vivi Oct 12 '15 at 14:00

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.