Question

I've searched all over for an answer to this, and I can't seem to figure it out. I installed auctex using package.el (elpa) in GNU Emacs 24.3.1. I'm trying to use Github for version control, and I'm keeping all of my customizations and preferences in my .emacs.d/init.el (not using .emacs at all). I'm trying to keep all packages synced between multiple machines by being able to just pull my .emacs.d anytime I go to a new machine and have everything working fine.

I commited my entire .emacs.d using git add -A and then committing and pushing (from OS X). I then pull the repository to another machine (a Windows 7 machine). When I load I get the following error

Warning (initialization): An error occurred while loading `c:/Users/user/.emacs.d/init.el':

File error: Cannot open load file, c:/Users/user/.emacs.d/elpa/auctex-11.87.1/auctex-autoloads

I've tried including the following in my init.el

(setq package-enable-at-startup nil)
(package-initialize)
(require 'auctex)

but without any luck. Does anyone know what might be causing the issue?

EDIT: I just realized that when I was committing to GitHub, it wasn't adding all of the files that I was expecting that it would, including not adding auctex-autoloads.el. I'm not sure why this would be, but I think it has something to do with how I'm adding files to be committed to GitHub. Any help would be appreciated!

EDIT 2: I tried adding the option --force to git add -a --force and everything works as expected now. I'm still learning git, so I think that was a simple mistake. I'm still not entirely sure why it automatically excluded certain files and not others, but I'll try to figure that out.

Thanks!

Was it helpful?

Solution

Git automatically excludes certain files from the commit when you use git add -A, though I'm not sure why. I needed to include the --force option (i.e. git add -A --force) and then it correctly added all files to the repository. It turns out that I was missing the auctex-autoloads.el that was needed.

Also, I then added my own .gitignore with a few directories that I didn't want to add to the repository, and it seems like that has overridden whatever ignore rules were causing it to exclude autoload files and files with an extension of .elc. So, now I only need git add -A to add all files to the repository.

Thanks everyone for looking!

OTHER TIPS

Another strategy you might consider is to save your initi file(s) in git, and include a method that will automatically download your installed packages from elpa on a new machine when necessary. This prevents the need to keep all of the package contents within your repository, but it does require each machine to have access to the elpa site.

I keep the package configuration in a separate configuration, and load that from within my init file.

Here's the method I use to reload packages that are missing:

;; emacs package manager.
(require 'package)
(add-to-list 'package-archives
             '("melpa" . "http://melpa.org/packages/")
             '("org" . "http://orgmode.org/elpa/"))
(package-initialize)

;; Create a list of the packages currently installed. You can use the
;; contents of the directory in which they are stored (usually
;; ~/.emacs.d/elpa). Ensure you only use the package name, and not any
;; version information.

;; a good way to get a formatted list of the packages loaded is with the
;; following shell command:
;; ls ~/.emacs.d/elpa | sed -e s/-[0-9.].*//
(defvar cm/packages nil
  "A list of elpa packages that should be available on startup")
(setq cm/packages                                                  
      '(
        auto-complete
        bm
        browse-url-dwim
        bs-ext
        color-moccur
        color-theme-sanityinc-solarized
        csv-mode
        dash
        deferred
        diminish
        dired-hacks-utils
        elisp-slime-nav
        epl
        esh-help
        git-commit-mode
        git-gutter+
        git-rebase-mode
        git-timemachine
        hc-zenburn-theme
        highlight-symbol
        hl-sexp
        ht
        htmlize
        igrep
        js2-mode
        list-utils
        magit
        markdown-mode
        names
        org
        ox-pandoc
        pandoc-mode
        paredit
        popup
        projectile
        request
        request-deferred
        s
        smartparens
        sqlplus
        starter-kit-eshell
        string-utils
        w3m
        windata
        ))

;; cycle through the package list and prompt to install any missing from
;; the list

(defvar missing-pkgs '())

(defun cm-package-refresh ()
  (interactive)
  (setf missing-pkgs nil)
  (dolist (pkg cm/packages)
    (if (not (package-installed-p pkg))
        (progn
          (add-to-list 'missing-pkgs pkg)
          (setq cm-message "Done"))
      (setq cm-message "Nothing missing")))
  ;; for any missing packages, ask to load them all
  (if (and (> (length missing-pkgs) 0)
           (y-or-n-p-with-timeout
            (format "%s %s " "install missing packages:" missing-pkgs) 4 nil))
       (dolist (mpkg missing-pkgs)
        (package-install mpkg)))
  (message "%s" cm-message))

;; now check for missing packages
(if (y-or-n-p-with-timeout "Check packages? " 4 nil)
    (cm-package-refresh))


(provide 'emacs-package)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top