在Emacs中更新软件包 [英] Updating packages in Emacs

查看:480
本文介绍了在Emacs中更新软件包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下包装设置(不确定是否有更好的推荐):

I have the following setup for packages (not sure if there is a better recommended one):

(require 'package)
(setq package-archives '(("ELPA" . "http://tromey.com/elpa/") 
                          ("gnu" . "http://elpa.gnu.org/packages/")
                          ("marmalade" . "http://marmalade-repo.org/packages/")))

; Apparently needed for the package auto-complete (why?)
(add-to-list 'package-archives
             '("melpa" . "http://melpa.milkbox.net/packages/") t)

(package-initialize)
(setq url-http-attempt-keepalives nil)

我有三个与安装和更新软件有关的问题。

I have three questions related to the installation and updating of packages.

Q1。是否有更新可用软件包列表(和最新版本)并更新特定软件包的方式?

Q1. Is there a way to update the list of available packages (and most recent versions) and update a specific package?

Q.2 有什么区别以下包来源?:

Q.2 What is the difference between the following package sources?:


  • ELPA,

  • GNU

  • marmalade

  • melpa

  • ELPA,
  • GNU
  • marmalade
  • melpa

Q.3

Q.3 Does it matter the order in which they are added to package-archives?

推荐答案

我使用以下内容:

(when (not package-archive-contents)
    (package-refresh-contents))

执行 package-list-packages 也会更新软件包列表。

Doing package-list-packages will also update the list of packages.

您可以使用 U x * Packages * 缓冲区。


  1. ELPA 是原来的。我不认为这真的是维护了,但我不确定。我不使用它。

  1. ELPA is the original. I don't think it's really maintained anymore, but I'm not sure. I don't use it.

GNU 是官方。它与Emacs一起保持,这意味着事情应该始终有效,但更新和新包不会经常出现。

GNU is "official". It's maintained along with Emacs, which means things should always work but updates and new packages don't come very often.

果酱基本上是网站,您可以上传完整的软件包,并将其添加到果酱回收站。您不只是提交一个链接到软件包的上游,并不完全自动完成该软件包的创建。我认为这是正确的事,因为你不一定要跟踪上游。不幸的是,它一直没有保持一段时间,但有人最近把它取消了,所以在某些时候应该回来更好。

Marmalade is basically a website where you can upload a complete package, and it will be added to the marmalade repo. You don't just submit a link to the package's upstream, and it doesn't quite automate the creation of the package completely. I think this is the Right Thing, because you don't necessarily want to track upstream. Unfortunately, it has been unmaintained for a while, but someone recently took it over so it should be back and better at some point.

Melpa 将一个URL提供给eg EmacsWiki lisp区域或github repo,并自动从中构建一个包。因此,它通常是追踪的最多一天。虽然它跟踪上游,我从来没有在实践中遇到问题,这是我的大多数包是从哪里来的。 Melpa Stable 也是这样,就像Melpa一样,但是抓住上游回购的标签修订,而不是最新的修订。 Melpa stable的包装比Melpa少。

Melpa takes a URL to e.g. the EmacsWiki lisp area or a github repo, and builds a package automatically from it. Thus it is usually at most a day behind whatever it is tracking. Although it tracks upstream, I've never had a problem in practice, and this is where most of my packages are from. There is also Melpa Stable, which is like Melpa but grabs tagged revisions of the upstream repo instead of the latest revision. Melpa stable has fewer packages than Melpa.

组织模式有自己的 package.el repo( http://orgmode.org/elpa/ )。

Org mode has its own package.el repo (http://orgmode.org/elpa/).

所有的包repos工作一样,你只需将它们添加到您的包档案

All of the package repos work the same, you just add them to your package-archives.

这是一个更深入的博客文章关于这个主题,我主要同意。

Here's a more in-depth blog post about this subject, which I mostly agree with.

我不确定,但我认为如果一个包在不同的repos,repos在 package-archives 中出现的顺序确定优先级。我不知道更高的优先级是在列表的开头或结尾。

I'm not sure, but I think if a package is duplicated in different repos, the order the repos appear in in package-archives determines precedence. I don't know if higher precedence is at the beginning or end of the list.

更新:在Emacs 25中,有一个变量 -archive-priority ,您可以使用它来优先考虑您的包裹回报(例如,喜欢ELPA超过MELPA)。

Update: In Emacs 25, there is a variable package-archive-priorities that you can use to prioritize your package repos (e.g. prefer ELPA over MELPA).






如果您有兴趣,以下是我的 init.el 的相关部分:

(setq jpk-packages
      '(
        ac-dabbrev
        ...
        yasnippet
        ))

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

;; install any packages in jpk-packages, if they are not installed already
(let ((refreshed nil))
  (when (not package-archive-contents)
    (package-refresh-contents)
    (setq refreshed t))
  (dolist (pkg jpk-packages)
    (when (and (not (package-installed-p pkg))
             (assoc pkg package-archive-contents))
      (unless refreshed
        (package-refresh-contents)
        (setq refreshed t))
      (package-install pkg))))

(defun package-list-unaccounted-packages ()
  "Like `package-list-packages', but shows only the packages that
  are installed and are not in `jpk-packages'.  Useful for
  cleaning out unwanted packages."
  (interactive)
  (package-show-package-list
   (remove-if-not (lambda (x) (and (not (memq x jpk-packages))
                            (not (package-built-in-p x))
                            (package-installed-p x)))
                  (mapcar 'car package-archive-contents))))

这篇关于在Emacs中更新软件包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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