4
3

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.

auto-async-byte-compile & init-loaderでuse-package

Last updated at Posted at 2016-12-15

はまったので。

auto-async-byte-compileは便利なのですが、init-loaderで分割したinitfile(10-xxx.el)上で、use-packageを併用しているとうまくcompileされません。(正確には実行時にエラー)

use-packageのREADME.mdには

use-package.el is no longer needed at runtime
This means you should put the following at the top of your Emacs, to further reduce load time:
(eval-when-compile
(require 'use-package))

となっているので、仕様どおりの動作。とはいえ、分割したファイル全てに記載するのもいやなので、
悩んでいたのですが、auto-async-byte-compileのソースにoptionの記載があり、
解決しました。

;; `auto-async-byte-compile-init-file'
;; *Load this file when batch-byte-compile is running.
;;default = "~/.emacs.d/initfuncs.el"

なので自分は、init.elに(eval-when-compile〜 を書いて

init.el
(eval-when-compile
  (require 'use-package)
(require 'diminish)              
(require 'bind-key))             
16-bc.el
(setq auto-async-byte-compile-init-file "~/.emacs.d/init.el")

としました。
init.elでなくてもいいような気もしますが、どっちにしろ先頭で読む必要があるので。

4
3
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
4
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?