Search code examples
gitemacselpa

Cannot open load file error when pulling .emacs.d from version control using ELPA


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!


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!