Skip to content

Prototype an optional Embark/Marginalia integration#2096

Open
bbatsov wants to merge 1 commit into
masterfrom
feature/embark-integration-prototype
Open

Prototype an optional Embark/Marginalia integration#2096
bbatsov wants to merge 1 commit into
masterfrom
feature/embark-integration-prototype

Conversation

@bbatsov

@bbatsov bbatsov commented Jul 14, 2026

Copy link
Copy Markdown
Owner

A prototype of the two Embark improvements we discussed, built on the completion categories from #2093 and wired via with-eval-after-load so neither Embark nor Marginalia becomes a dependency.

1. Robust project-file resolution. projectile-find-file candidates are project-relative; Embark needs to expand them against the project root to act on them (default-directory is often a subdirectory). projectile--embark-project-file-target is a transformer that resolves against projectile-project-root directly, so it's correct regardless of Embark's built-in project.el handling or projectile-mode state.

2. A project action keymap. projectile-embark-project-map (s switch, v vc, d dired, D remove) is attached to a new projectile-project category, so acting on a project candidate offers project operations instead of only generic file actions. projectile-switch-project-by-name isn't a command, so switch/vc go through thin projectile-embark-* action wrappers; dired/projectile-remove-known-project inject cleanly.

The project-switch completions move from file to the projectile-project category; a Marginalia annotator reusing marginalia-annotate-file keeps their annotations identical (they're directory paths), so no marginalia regression.

Everything's gated - with neither package installed it's inert (just some defuns and a keymap). 918 specs green (4 new: transformer resolution in/out of a project, the keymap bindings, the switch action), clean --warnings-as-errors, relint clean.

Flagged experimental in the changelog. Open questions if we keep it: whether to keep this in core (gated) or split into a projectile-embark.el like projectile-consult.el, and whether overriding Embark's built-in project-file transformer (vs only adding when absent) is the behavior we want.

@bbatsov
bbatsov force-pushed the feature/embark-integration-prototype branch from b31f5da to 153a995 Compare July 14, 2026 08:47
Built on the completion categories already advertised, wired via
with-eval-after-load so Embark and Marginalia stay soft dependencies.

- projectile--embark-project-file-target + ...-transform: an Embark
  `project-file' transformer that AUGMENTS Embark's own rather than
  replacing it. It resolves a candidate against the Projectile root only
  when the file actually lives there (existence guard), and otherwise
  defers to whatever transformer Embark already had. So Embark's file
  actions hit the right file even when default-directory is a
  subdirectory, and non-Projectile `project-file' completions are
  provably unaffected.
- projectile-embark-project-map: an action keymap for the new
  `projectile-project' category (switch/vc/dired/remove). This category
  is Projectile-only, so it can't collide with anything. Project-switch
  completions move from `file' to `projectile-project', with a Marginalia
  annotator reusing the built-in file annotator so annotations are
  unchanged.

Marked experimental in the changelog.
@bbatsov
bbatsov force-pushed the feature/embark-integration-prototype branch from 153a995 to d560301 Compare July 15, 2026 10:43
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