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 'front option to projectile-current-project-on-switch #1894

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jtamagnan
Copy link

@jtamagnan jtamagnan commented Jun 21, 2024

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 by
default. This includes, shell, eshell, and magit. If one
navigates directly to one of these buffers and calls
projectile-relevant-known-projects while
projectile-current-project-on-switch is set to 'keep they will
notice 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:

  1. Add a new 'front option for
    projectile-current-project-on-switch such that the first item is
    the project associated with the current buffer.
  2. Modify projectile-mode to add the hook to
    buffer-list-update-hook such that the current buffer is always
    added 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):

  • 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!

@jtamagnan jtamagnan force-pushed the keep-moves-to-front branch 2 times, most recently from baf05fa to 59f81b2 Compare June 21, 2024 21:16
@jtamagnan jtamagnan changed the title projectile-current-project-on-switch 'keep moves current project to front Add 'front option to projectile-current-project-on-switch Jun 21, 2024
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.

None yet

1 participant