init.el で cask のエラーがでるので旧バージョンに戻す

Emacs の設定ファイルである init.el の読み込みに失敗するようになってしまいました。

Warning (initialization): An error occurred while loading ‘(略)/.emacs.d/init.el’:

error: Given parent class package-recipe is not a class

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the ‘--debug-init’ option to view a complete error backtrace.

原因は cask のアップデートらしい

init.el の中で原因を探したところ、cask という Emacs のパッケージマネージャーのアップデートによるものだったようです。

Cask — Cask 0.8.4 (cask の公式ドキュメント)

cask の設定ファイルは /usr/local/share/emacs/site-lisp/cask/cask.el にあり、その中の defclass の使い方に関連するところでエラーが出ているようです。 …というところまではわかったので(そして Emacs Lisp に詳しくないので…)、とりあえず急場しのぎ的ですが homebrew で cask のバージョンを1つ前に戻します。

homebrew で cask のバージョンを戻す

ローカルにある旧バージョンを消してしまったので()、homebrew の Formula で Git を1つ巻き戻してインストールし直します。 再びここを参照していろいろやってみます。

確かに、つい最近アップデートがあったようです。cask の ログを辿りたいので Formula の中の cask.rb を見てみます。

$ pwd
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula
$ git log cask.rb
commit 9e8d64eb8fa735973ba58469072d72ad52bead1e
Author: Sam Brightman <sambrightman@users.noreply.github.com>
Date:   Fri May 11 03:10:45 2018 +0100

    cask 0.8.4 (#27715)

commit 1a9b379d15865c23176862e25d1d9b954656b76d
Author: ilovezfs <ilovezfs@icloud.com>
Date:   Wed Feb 21 00:02:46 2018 -0800

    cask 0.8.3 (#24378)

巻き戻します。

$ git checkout 1a9b379d15865c23176862e25d1d9b954656b76d cask.rb
$ brew unlink cask
Unlinking /usr/local/Cellar/cask/0.8.4... 2 symlinks removed
$ HOMEBREW_NO_AUTO_UPDATE=1 brew install cask
==> Downloading https://github.com/cask/cask/archive/v0.8.3.tar.gz
==> Downloading from https://codeload.github.com/cask/cask/tar.gz/v0.8.3
######################################################################## 100.0%
==> Caveats
Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/cask
==> Summary
🍺  /usr/local/Cellar/cask/0.8.3: 14 files, 167.0KB, built in 4 seconds
$ cask --version
0.8.3
$ git reset --hard
HEAD is now at bddf42a93 wrk-trello: update url

とりあえずはこれでバージョンも1つ前に戻り、うまく動くようになりました。