Skip to content

Fix compilation-find-file advice for dirs without direct files#1982

Open
bbatsov wants to merge 1 commit intomasterfrom
feature/1923-compilation-search-path
Open

Fix compilation-find-file advice for dirs without direct files#1982
bbatsov wants to merge 1 commit intomasterfrom
feature/1923-compilation-search-path

Conversation

@bbatsov
Copy link
Owner

@bbatsov bbatsov commented Feb 15, 2026

Summary

  • The compilation-find-file advice now also resolves filenames relative to the project root, adding the parent directory to the search path when found
  • This fixes the edge case where a directory contains only subdirectories (no files directly), so it wasn't included in the file-derived directory list from projectile-current-project-dirs
  • The fix is lightweight — a single file-exists-p check — avoiding the performance cost of a full recursive directory scan

Fixes #1923

Test plan

  • Create a project with a nested directory structure where an intermediate directory contains only subdirectories
  • Run a compilation that outputs file paths relative to that intermediate directory
  • Click on the file path in the compilation buffer — it should navigate correctly instead of prompting

Fixes #1923

When compilation output references a file via a relative path, the
advice now also checks if the file exists relative to the project root
and adds its parent directory to the search path. This handles the
edge case where a directory only contains subdirectories (no files
directly) and therefore was not included in the file-derived directory
list from projectile-current-project-dirs.
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.

Compilation buffer edge case not covered by "compilation-find-file-projectile-find-compilation-buffer" advice

1 participant

Comments