projectile-current-project-on-switch 'keep moves current project to front #1879
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
There are certain modes for which the
projectile-find-file-hook-function
function does not run bydefault. This includes,
shell
,eshell
, andmagit
. If onenavigates directly to one of these buffers and calls
projectile-relevant-known-projects
whileprojectile-current-project-on-switch
is set to'keep
they willnotice that the first repository in the list is not the one that they
expect
Solution
There are three possible solutions that come immediately to mind. I
want to mention all three of them for consideration though naturally
this PR only implements one of them:
projectile-find-file-hook-function
projectile-mode
to add the hook to all possible modesI've opted with Solution
2
because it feels more robust in the longterm, as new modes appear more changes will not be required. It also
provides less of burden on package users.
The principle drawback is that it will not be added to the projects
list in this case so navigating to a different buffer will not save
the position of this project. This issue can be solved by a further
modification where any call to
projectile-relevant-known-projects
(or any other function in this call chain) will lead to an update to
the list of projects. I'd be willing to take that on as well.
Solution
3
also feel promising, not sure if we could do somethingwith
eval-after-load
Before submitting a PR make sure the following things have been done (and denote this
by checking the relevant checkboxes):
I've added a new test that was failing before my change and passes now
eldev test
)All existing tests continue to pass without modification implying that
no defined behavior was chagned
M-x checkdoc
warningsThanks!