Skip to content

Levelize dependency tree to eliminate recursive requires#1

Merged
jonathanchu merged 4 commits into
mainfrom
levelize-dependency-tree
Apr 29, 2026
Merged

Levelize dependency tree to eliminate recursive requires#1
jonathanchu merged 4 commits into
mainfrom
levelize-dependency-tree

Conversation

@jonathanchu

Copy link
Copy Markdown
Owner

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 require statements 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.el that has no dependencies on other grove modules. All sub-modules now require grove-core instead of grove, and grove.el sits at the top of the tree requiring everything with standard top-of-file placement.

Also fixes a hidden cross-file dependency where grove-link.el called grove-capture--sanitize-filename without requiring it — moved to grove-core as grove--sanitize-filename.

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.
@jonathanchu jonathanchu merged commit 9660626 into main Apr 29, 2026
4 checks passed
@jonathanchu jonathanchu deleted the levelize-dependency-tree branch April 29, 2026 04:02
@jonathanchu jonathanchu mentioned this pull request Apr 29, 2026
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant