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

Cache root in non-file-backed buffers #1213

Conversation

aaronjensen
Copy link
Contributor

@aaronjensen aaronjensen commented Jan 27, 2018


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 (make 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!

`projectile-cached-buffer-file-name` would be set to nil in non-file-backed
buffers causing the root caching to not work. `'none` is used as a sentinel
value for `projectile-project-root-cache` so this reuses that for
`projectile-cached-buffer-file-name` as well.
@aaronjensen aaronjensen force-pushed the cache-project-root-in-non-file-backed-buffers branch from f24e49d to 26ca619 Compare January 27, 2018 17:30
@aaronjensen
Copy link
Contributor Author

I'm not sure how to add tests for this... let me know if that's a problem. Thanks!

@bbatsov bbatsov merged commit c3562c3 into bbatsov:master Jan 28, 2018
@bbatsov
Copy link
Owner

bbatsov commented Jan 28, 2018

Looks good to me! Normally the test for this would involve creating some buffer, let-binding a bit of config, running projectile-project-root and checking that the cached file name is nil.

@@ -905,10 +905,10 @@ will return the current directory, otherwise it'd raise an error."
;; instead
(or (cl-subst nil 'none
(or (and projectile-cached-buffer-file-name
(equal projectile-cached-buffer-file-name buffer-file-name)
(equal projectile-cached-buffer-file-name (or buffer-file-name 'none))
Copy link
Owner

Choose a reason for hiding this comment

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

Btw, we could have also wrapped this in a (when buffer-file-name which might have been more clear, but this came to my mind only after I merged this. Anyways, not a big deal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wrapped which? I tried wrapping the whole thing in that previously and it broke some functionality for me.

@aaronjensen aaronjensen deleted the cache-project-root-in-non-file-backed-buffers branch January 28, 2018 18:11
@aaronjensen
Copy link
Contributor Author

Also, thanks for the merge!

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.

2 participants