Add 'front option to projectile-current-project-on-switch #1894
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.
Foreword
I originally created #1879 but have since deleted that GitHub account,
as such the associated repository and pull request were closed.
This PR reopens that previous PR. #1895 on the other hand implements
Solution 2 of this pull request which I prefer.
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 two possible solutions that come immediately to mind. I
want to mention both of them for consideration though naturally
this PR only implements one of them:
'front
option forprojectile-current-project-on-switch
such that the first item isthe project associated with the current buffer.
buffer-list-update-hook
such that the current buffer is alwaysadded to the list of known-projects.
This PR implements solution one as was done in #1879.
#1895 implements Solution 2
Comparision
The main drawback with Solution 1 is that the newly selected project
will not be added to the projects list.
The main drawback of Solution 2 is that it will not work on versions
of emacs earlier than 28.1 because of how
buffer-list-update-hook
behaves on those older versions.
Before submitting a PR make sure the following things have been done (and denote this
by checking the relevant checkboxes):
eldev test
)M-x checkdoc
warningsThanks!