10
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Emacs の package をコマンドラインから全部アップデートする

Last updated at Posted at 2015-11-16

いちいち M-x package-list-packages して U x するのが面倒だからバッチでやりたいという話です。

やりかた

こういう Emacs Lisp を書いて

upgrade-packages.el
(package-list-packages)
(package-menu-mark-upgrades)
(package-menu-execute t)

普通にバッチで実行します。

$ emacs --script path/to/upgrade-packages.el

stdout には、こんな感じで普段 minibuf とかに出てくる文字列がズラズラと出てきます。

Importing package-keyring.gpg...
Importing package-keyring.gpg...done
Contacting host: elpa.gnu.org:80
Contacting host: elpa.gnu.org:80
3 packages can be upgraded; type `U' to mark them for upgrading.
3 packages marked for upgrading.
Making version-control local to let-alist-autoloads.el while let-bound!
Generating autoloads for let-alist.el...
Generating autoloads for let-alist.el...done
# ... (略) ...

注意点

MELPA のようなサードパーティのレポジトリを追加している場合は、その初期化 (package-archives に append するやつ) を一番最初に実行する必要があります。init.el などとの共通部分を適当に抜き出して再利用できるようにするのがスマートな感じがします。

10
11
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
11

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?