[英]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. 我在GNU Emacs elpa
使用package.el
( elpa
)安装了auctex
。 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). 我正在尝试使用Github进行版本控制,并将所有自定义项和首选项保留在.emacs.d/init.el
(根本不使用.emacs
)。 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. 我试图通过能够随时拉到新机器上的.emacs.d
来保持所有软件包在多台机器之间的同步,并使一切正常运行。
I commited my entire .emacs.d using git add -A
and then committing and pushing (from OS X). 我使用git add -A
提交了整个.emacs.d,然后提交并推送(从OS X)。 I then pull the repository to another machine (a Windows 7 machine). 然后,我将存储库拉到另一台计算机(Windows 7计算机)上。 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
我尝试在init.el
包含以下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. 编辑:我刚刚意识到,当我提交到GitHub时,它并未添加我期望的所有文件,包括未添加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. 我不确定为什么会这样,但是我认为这与我添加要提交到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. 编辑2:我尝试将选项--force
git add -a --force
到git add -a --force
,一切都按预期工作。 I'm still learning git, so I think that was a simple mistake. 我仍在学习git,所以我认为这是一个简单的错误。 I'm still not entirely sure why it automatically excluded certain files and not others, but I'll try to figure that out. 我仍然不确定为什么它会自动排除某些文件而不排除其他文件,但我会尽力弄清楚。
Thanks! 谢谢!
Git automatically excludes certain files from the commit when you use git add -A
, though I'm not sure why. 当您使用git add -A
,Git自动从提交中排除某些文件,尽管我不确定为什么。 I needed to include the --force
option (ie git add -A --force
) and then it correctly added all files to the repository. 我需要包括--force
选项(即git add -A --force
),然后将所有文件正确添加到存储库中。 It turns out that I was missing the auctex-autoloads.el
that was needed. 原来,我缺少了所需的auctex-autoloads.el
。
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. 另外,然后我添加了自己的.gitignore以及一些我不想添加到存储库中的目录,这似乎已经覆盖了所有忽略规则,从而导致它排除了自动加载文件以及扩展名为.elc的文件。 So, now I only need git add -A
to add all files to the repository. 因此,现在我只需要git add -A
即可将所有文件添加到存储库中。
Thanks everyone for looking! 谢谢大家的光临!
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. 您可能考虑的另一种策略是将initi文件保存在git中,并包括一种方法,该方法将在必要时从elpa自动将已安装的软件包下载到新计算机上。 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. 这样可以避免将所有软件包内容都保留在存储库中的需要,但是它确实要求每台机器都可以访问elpa站点。
I keep the package configuration in a separate configuration, and load that from within my init file. 我将软件包配置保留在单独的配置中,然后从我的init文件中加载它。
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)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.