不是问题,就是单纯讨论讨论。
有的时候一个A包配置需要B和C同时存在才能正常工作,但是由于A,B和C之间没有直接的依赖关系,use-package
的 :after
选项不是很合适。这种依赖你们的配置是怎么解决的?
我目前是用
;; 例子
(use-package A
:config
(after-load| B
(after-load| C
(config))))
;; after-load| 的定义
(defmacro after-load| (feature &rest rest-list)
"A smart wrapper around `with-eval-after-load'.
FEATURE is a library declared with `provide'.
REST-LIST is a list of expressions to evaluate.
If FEATURE loaded, rest-list is evaluated.
If not, this macro will befave like `with-eval-after-load'.
Expressions inside will be called right after the library is loaded,
before `post-config|' but after `post-init'."
(declare (indent defun) (debug t))
`(if (featurep ',feature)
(progn ,@rest-list)
(with-eval-after-load ',feature ,@rest-list)))