From 9f198978f8a37d430175025b1c48418fd83bf268 Mon Sep 17 00:00:00 2001 From: Liam Hupfer Date: Sun, 3 Mar 2024 18:43:10 -0600 Subject: [PATCH] fix(biblio): avoid 'oc-csl dependency cycle MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Relevant portion of the dependency graph: 'oc-csl → 'citeproc → 'citeproc-itemgetters → 'org → 'org-keys → 'oc The :after linked 'oc to 'oc-csl so 'org-keys could load 'org. `+org-init-keybinds-h' could then execute before the body of 'org-keys, so Org default bindings could clobber Doom bindings. If the top-level 'org started the load sequence, `org-load-hook' functions would execute last and key bindings would be correct, but Doom’s deferred incremental loading of Org could lead to this scenario: 1. deferred incremental loader: (require 'org-src) 2. org-src.el: (require 'org-keys) 3. org-keys.el: (require 'oc) 4. oc.el: (provide 'oc): (require 'oc-csl) [via the :after this patch removes] 5. oc-csl.el: (require 'citeproc) 6. citeproc.el: (require 'citeproc-itemgetters) 7. citeproc-itemgetters.el: (require 'org) 8. org.el: (require 'org-keys) 9. 'org-keys from step 8 finishes loading. Keys are bound. 10. 'org finishes loading. `org-load-hook' functions are run. Doom’s keys are bound. 11. 'oc-csl finishes loading 12. 'org-keys from step 3 finishes loading. Keys are bound again, overwriting any keys Doom bound in step 10. 13. 'org-src finishes loading At some point, the deferred incremental loader will (require 'org), but it is a feature as of step 10, so it does not load and its hooks do not run again. --- modules/tools/biblio/config.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/tools/biblio/config.el b/modules/tools/biblio/config.el index a37263e7e..b73e0666f 100644 --- a/modules/tools/biblio/config.el +++ b/modules/tools/biblio/config.el @@ -78,7 +78,9 @@ ;; `org-cite' processors (use-package! oc-biblatex :after oc) -(use-package! oc-csl :after oc) +;; oc-csl requires citeproc, which requires the top-level org, so loading oc-csl +;; after oc interferes with incremental loading of Org +(use-package! oc-csl :after org) (use-package! oc-natbib :after oc)