Dotfiles存储库:从每包Git子模块切换到ELPA,同时保持可移植性 [英] Dotfiles repository: Switching from per-package Git submodules to ELPA while maintaining portability
问题描述
我已经在我的 dotfiles存储库中使用Git子模块来跟踪我使用的每个Emacs软件包。不过,随着一个套件管理器内置Emacs 24,我想转而使用更加官方和更容易使用的方法。
我的问题切换:使用我当前的Git子模块方法,dotfiles存储库的任何克隆都保证包含所有引用的附件。 在此程序包管理器中有内置的功能,以允许程序包同步,以便任何Git repo的拉动都将包含必需的程序包(或使用单个命令可以安装)? / p>
如果没有内置的内容,是否有一个post-package-install挂钩,可用于维护基于文本的包列表(稍后可读使用自定义命令将列表安装在列表中)?本质上,我想保持我的软件包/软件包列表在版本控制下,使其在计算机之间可移植。
code> el-get 通过kindahero的建议,但这对我来说并没有太好的工作..它没有正确加载 - 或者通过代码中的一些错误或我的缺乏的技能在Emacs Lisp(更可能是后者)。
我偶然发现了 Emacs Prelude 项目,并在浏览源代码时发现了一个非常简单的代码片段:
(require'package)
/ pre>
(add-to-list'package-archives
'(marmalade。http://marmalade-repo.org/packages/)t)
(package-initialize)
(当(不是包存档内容)
(package-refresh-contents))
(defvar prelude-packages
'(auctex clojure-mode coffee-mode deft gist haml-mode
haskell-mode magit markdown-mode paredit shotile
sass-mode scss-mode yaml-mode yari yasnippet)
确保在启动时安装的软件包列表)
(dolist(p prelude-packages)
(when(not(package-installed-p p))
(package-install p)))
我无耻地偷走了我的自己的目的,它一直很好。我删除了几乎所有的子模块,切换到包管理器(使用Marmalade repo)。
I've been using Git submodules within my dotfiles repository to track each Emacs package that I use. With a package manager being built-in with Emacs 24, though, I'd like to switch to the more official and easier-to-use method.
My problem with switching: With my current Git submodule method, any clone of the dotfiles repository is guaranteed to contain all the referenced add-ons. Is there a built-in functionality within this package manager to allow synchronization of packages, so that any pull of the Git repo will contain the necessary packages (or have them all installable with a single command)?
If there's nothing like this built-in, is there a "post-package-install" hook that I can use to maintain a text-based list of packages (later readable with a custom command which installs the packages in the list)? Essentially I would like to keep my packages / package list under version control so that it is portable between computers.
解决方案I tried
el-get
by kindahero's suggestion, but this didn't work out too well for me.. it didn't load correctly — either by some bug in the code or by my lack of skill in Emacs Lisp (more likely the latter).I stumbled upon the Emacs Prelude project, and found a very simple snippet of code while browsing through the source:
(require 'package) (add-to-list 'package-archives '("marmalade" . "http://marmalade-repo.org/packages/") t) (package-initialize) (when (not package-archive-contents) (package-refresh-contents)) (defvar prelude-packages '(auctex clojure-mode coffee-mode deft gist haml-mode haskell-mode magit markdown-mode paredit projectile sass-mode scss-mode yaml-mode yari yasnippet) "A list of packages to ensure are installed at launch.") (dolist (p prelude-packages) (when (not (package-installed-p p)) (package-install p)))
I shamelessly stole this for my own purposes, and it has been working great. I deleted almost all of my submodules by switching to the package manager (with the Marmalade repo).
这篇关于Dotfiles存储库:从每包Git子模块切换到ELPA,同时保持可移植性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!