用MELPA自动安装emacs软件包 [英] Auto install emacs packages with MELPA

查看:158
本文介绍了用MELPA自动安装emacs软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在em ems中声明一个我想在emacs中使用的所有软件包。我想知道它是否可能加载丢失的包装,例如MELPA当我启动emacs而不通过列表并标记我想安装的那些?

解决方案

新的回答:



虽然我的原始答案仍然有效,我现在使用方法 Jordon建议 use-package 是一个梦幻般的工具为了整洁的Emacs配置。事实上,当我写了我的原始答案时,我已经在使用它来进行干净的包装加载。



当时我忽略了一直读到其README的底部,因此没有意识到它可以处理软件包安装另外:


对于 package.el 用户



您可以使用 use-package 将包从ELPA加载到package.el。如果您在几台机器之间共享您的.emacs,这一点尤其有用。相关包将自动下载到您的.emacs中。 :确保键将自动安装包,如果它不存在:

 (use-package tex-site 
:确保auctex)


加载 package.el 并初始化我的软件包仓库后,我的配置包含

 (if(not(package-installed-p'use-package))
(progn
(package-refresh-contents)
(package-install'use-包)))

(require'use-package)

许多这样的片段:

  ;;;展开区域
(使用包扩展区域
:确保展开区域
:bind(C- =。呃/展开区域))

如果您发现此信息有用,请给予Jordon一个upvote。



原来的答案:



看看 Cask 托盘,它们共同解决这个问题。



从Cask网站:


用于Emacs的Cask是Bundler对Ruby的。它旨在使Emacs中的ELPA依赖管理无痛(尽可能无痛)。这包括您当地的Emacs安装和Emacs软件包开发。


之后安装Cask ,您需要在Emacs配置中添加如下内容:

 $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ 




code $为elisp依赖定义了一个特定于doman的语言。要安装软件包,您需要如下所示的内容

 (源melpa)

(取决于自动完成)
(依赖于 )
(依赖于f)
(取决于flycheck)
(依赖于helm)
(依赖于magit)
(取决于弹出)
(依赖于抛物线)
(依赖于s)
(依赖于smartparens)
(取决于yasnippet)

请注意,这不会进入您的Emacs配置文件,而是进入〜/ .emacs.d / Cask



托盘使用交互式安装的软件包更新Cask文件,例如通过 M-x package-list-packages ,因此您不必手动维护上述文件。


I want to declare all packages that I want to use in emacs in a init.el file. I wonder if its possible to load the missing packages with e.g. MELPA when I startup emacs without going through the list and mark the ones I want to install?

解决方案

New answer:

While my original answer is still valid, I now use the method suggested by Jordon. use-package is a fantastic tool for tidy Emacs configurations. In fact, I was already using it for clean package loading when I wrote my original answer.

At that time, I neglected to read all the way to the bottom of its README, and therefore didn't realize that it could handle package installation as well:

For package.el users

You can use use-package to load packages from ELPA with package.el. This is particularly useful if you share your .emacs between several machines; the relevant packages will download automatically once placed in your .emacs. The :ensure key will install the package automatically if it is not already present:

(use-package tex-site
  :ensure auctex)

After loading package.el and initializing my package repositories, my configuration contains

(if (not (package-installed-p 'use-package))
    (progn
      (package-refresh-contents)
      (package-install 'use-package)))

(require 'use-package)

and subsequently many snippets like this:

;;; Expand-region
(use-package expand-region
  :ensure expand-region
  :bind ("C-=" . er/expand-region))

If you find this information useful, please give Jordon an upvote.

Original answer:

Have a look at Cask and Pallet, which work together to solve this problem.

From the Cask website:

Cask for Emacs is what Bundler is to Ruby. It aims to make ELPA dependency management in Emacs painless (as painless as it can be). This includes both your local Emacs installation and Emacs package development.

After installing Cask, you'll need to add something like this to your Emacs configuration:

(require 'cask)
(cask-initialize)

Cask defines a doman-specific language for elisp dependencies. For installing packages, you'll need something like what is outlined here:

(source melpa)

(depends-on "auto-complete")
(depends-on "dash")
(depends-on "f")
(depends-on "flycheck")
(depends-on "helm")
(depends-on "magit")
(depends-on "popup")
(depends-on "projectile")
(depends-on "s")
(depends-on "smartparens")
(depends-on "yasnippet")

Note that this does not go into your Emacs config file, but rather into ~/.emacs.d/Cask.

Pallet updates the Cask file with packages installed interactively, e.g. via M-x package-list-packages, so you don't have to manually maintain the above file.

这篇关于用MELPA自动安装emacs软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆