fix(biblio): avoid 'oc-csl dependency cycle

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.
This commit is contained in:
Liam Hupfer 2024-03-03 18:43:10 -06:00 committed by Yann Esposito (Yogsototh)
parent 4c017f9326
commit 0ad06e3274
Signed by untrusted user who does not match committer: yogsototh
GPG key ID: 7B19A4C650D59646

View file

@ -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)