Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a projectile-root-marked function for finding roots #1812

Merged
merged 2 commits into from
Nov 12, 2022

Conversation

sellout
Copy link
Contributor

@sellout sellout commented Nov 12, 2022

Prioritizes .projectile above other bottom-up root files.

Also makes the name of .projectile customizable.

Related to #1810.


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 readme (if adding/changing user-visible functionality)

Thanks!

Prioritizes .projectile above other bottom-up root files.

Related to bbatsov#1810.
Introduces a variable, `projectile-dirconfig-file` specifying the name of the
file used by Projectile to explicitly mark project roots. The default is
“.projectile”.

One use case for this is if you group project-local configs in an XDG-style
location. E.g., setting it to “.config/projectile”.
@sellout
Copy link
Contributor Author

sellout commented Nov 12, 2022

Here’s the fix, @Thisch.

@bbatsov bbatsov merged commit 1ca2303 into bbatsov:master Nov 12, 2022
@bbatsov
Copy link
Owner

bbatsov commented Nov 12, 2022

The proposed changes look good to me. Thanks!

P.S. This should probably be mentioned in the docs as well, but I'll do this myself.

Copy link

@twmr twmr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx a lot for the new function!

@@ -7,6 +7,7 @@
* [#1591](https://github.com/bbatsov/projectile/issues/1591): Add `project.el` integration that will make Projectile the default provider for project lookup.
* Add new command `projectile-find-references` (bound to `C-c C-p ?` and `C-c C-p s x`).
* [#1737](https://github.com/bbatsov/projectile/pull/1737): Add helpers for `dir-local-variables` for 3rd party use. Functions `projectile-add-dir-local-variable` and `projectile-delete-dir-local-variable` wrap their built-in counterparts. They always use `.dir-locals.el` from the root of the current Projectile project.
* Add a new defcustom (`projectile-dirconfig-file`) controlling the name of the file used as Projectile’s root marker and configuration file.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouln't the new projectile-root-marked function be mentioned in the changelog as well?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it should. Those things should also be covered somewhere in the docs, so it's easier to discover but I'll do this myself when I can.

@sellout sellout deleted the projectile-marker branch November 12, 2022 23:51
bbatsov added a commit that referenced this pull request Nov 14, 2022
@bbatsov
Copy link
Owner

bbatsov commented Nov 14, 2022

@Thisch See 7d414ea

This part of the docs definitely needs love, but at least it reminded me why we have projectile-root-top-down:

  • projectile-root-top-down is similar, but it will return the top-most (farthest from the current directory) match. It's configurable via projectile-project-root-files and all project manifest markers like pom.xml, Gemfile, project.clj, etc go there.

I guess it's for those situations where it's common to have nested projects, although as the markers are essentially the same as for the other function there's little point is having them together in the projectile-root-functions hook. We'll have to think about this a bit.

erikvader added a commit to erikvader/.emacs.d that referenced this pull request Jan 1, 2023
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.

3 participants