Levelize dependency tree to eliminate recursive requires#1
Merged
Conversation
Move the customization group, defcustom variables, vault cache, and utility functions out of grove.el into a new grove-core.el that has no dependencies on other grove modules. This is the foundation for eliminating recursive requires between grove files.
No sub-module needs the minor mode or command map from grove.el — they only use the shared variables and utilities now in grove-core. This breaks the circular require chains (e.g. grove -> grove-ui -> grove) that the byte-compiler flags as recursive requires.
Now that no sub-module requires grove.el (they all require grove-core), the requires can sit at the standard position at the top of the file with no risk of recursive loading. The declare-function forms and runtime require inside grove-mode are also removed since grove-link is now loaded at file level.
This function was defined in grove-capture.el but also called by grove-link.el without an explicit require — a hidden cross-file dependency. Since it is a general-purpose utility, it belongs in grove-core where both callers can reach it through their existing require.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
From this GitHub PR thread: melpa/melpa#9930 (comment)
The byte-compiler flagged recursive requires between grove files (e.g. grove.el → grove-ui.el → grove.el). The previous workaround of placing
requirestatements after provide at the bottom of grove.el masked the issue but isn't standard practice.This extracts shared definitions (custom group, defcustoms, cache, utilities) into a new
grove-core.elthat has no dependencies on other grove modules. All sub-modules now requiregrove-coreinstead ofgrove, andgrove.elsits at the top of the tree requiring everything with standard top-of-file placement.Also fixes a hidden cross-file dependency where
grove-link.elcalledgrove-capture--sanitize-filenamewithout requiring it — moved togrove-coreasgrove--sanitize-filename.