Skip to content

[Fix #2158] Discover the recipes of just modules - #2202

Open
ybai08 wants to merge 1 commit into
bbatsov:masterfrom
ybai08:just-modules
Open

ybai08 wants to merge 1 commit into
bbatsov:masterfrom
ybai08:just-modules

Conversation

@ybai08

@ybai08 ybai08 commented Oct 18, 2026

Copy link
Copy Markdown

Fixes #2158.

projectile-tasks-from-just only read the project's justfile, so recipes defined in just modules never showed up in projectile-run-task.

The provider now follows mod NAME and mod? NAME statements to the module source and offers its recipes qualified the way just names them: just:foo::build, running just foo::build.

  • The module file is looked up where just looks for it: NAME.just, then mod.just, justfile, .justfile or Justfile in the NAME directory. An explicit path (mod foo 'tools/foo.just', single or double quoted) is used as given, and searched the same way when it names a directory.
  • Paths resolve relative to the file declaring the module, so nested modules are followed (just:baz::qux::run).
  • A module whose source is missing (the mod? case) is skipped, and so is a module that points back at a file already being read, so a loop can't recurse forever.
  • The mod statement must end its line (an optional comment aside), so a recipe called mod that takes a parameter (mod target:) is still read as a recipe.
  • As before, nothing shells out: the provider reads files only, so it stays cheap over TRAMP.

Specs added to test/projectile-tasks-test.el under projectile-tasks-from-just: modules (plain, mod? with a quoted path, an attribute line and a trailing comment, nested mod.just -> justfile), a missing module plus a self-referencing one, and a recipe called mod. The CHANGELOG.md entry and the discovered-tasks table in doc/modules/ROOT/pages/tasks.adoc are updated.

Checks (Emacs 31.1, emacs -Q --batch, buttercup/compat/consult from GNU ELPA/MELPA; Eldev itself was not used):

  • test/projectile-tasks-test.el: on master the module spec fails (only just:default is returned); with the change 59 specs, 0 failed.
  • All test/projectile-*-test.el: 1533 of 1553 specs ran, 0 failed (master: 1530 of 1550, 0 failed).
  • projectile.el byte-compiles with byte-compile-error-on-warn; relint reports nothing; checkdoc reports nothing for the new functions.
  • Not run: eldev test / eldev compile / eldev lint, and the module lookup was not checked against a real just binary (it follows the just manual's module section).

Before submitting a PR make sure the following things have been done (and denote this
by checking the relevant checkboxes):

  • The commits are consistent with our contribution guidelines
  • You've added tests (if possible) to cover your change(s)
  • All tests are passing (eldev test)
  • The new code is not generating bytecode or M-x checkdoc warnings
  • You've updated the changelog (if adding/changing user-visible functionality)
  • You've updated the docs (when adding new project types, configuration options, commands, etc)

Thanks!

projectile-tasks-from-just only read the project's justfile, so the
recipes of the modules it declares with `mod' never showed up in
projectile-run-task.  Follow `mod' and `mod?' statements to the module
source, looking where just does (NAME.just, NAME/mod.just, a justfile in
NAME/, or the explicit path), and offer its recipes qualified the way
just names them (just:foo::build runs `just foo::build').  Nested
modules are followed too, skipping a module that loops back.

This branch has not been deployed

No deployments
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.

Support for just modules (mod import/declarations) in Projectile task detection

1 participant