-
-
Notifications
You must be signed in to change notification settings - Fork 580
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 #'projectile-track-known-projects-find-file-hook to 'buffer-list-update-hook #1895
Add #'projectile-track-known-projects-find-file-hook to 'buffer-list-update-hook #1895
Conversation
1c42b25
to
93f3b14
Compare
c16d5c9
to
451e648
Compare
451e648
to
f0bedae
Compare
This solution is preferable to me, so let's go with it. I find it to be cleaner, and most Emacs users are likely using Emacs 28+ anyways. |
f0bedae
to
a2364ea
Compare
Thank you for the review
Agreed, this one seems more robust. I've closed out the other pull-request. I've pulled from upstream, added a code comment, and pushed the new commit. Hopefully it is in a better state now |
Thanks! |
@bbatsov thank you for the package, the conversation, and the reviews |
It slows down tabbing through org table cells to a crawl: 887 98% - command-execute 887 98% - call-interactively 887 98% - funcall-interactively 676 75% - org-cycle 675 75% - call-interactively 675 75% - funcall-interactively 675 75% - org-table-next-field 675 75% - org-table-align 348 38% - org-string-width 347 38% - set-window-buffer 347 38% - record-window-buffer 347 38% - run-hooks 347 38% - projectile-track-known-projects-find-file-hook The change was introduced in bbatsov/projectile#1895
Hi! FWIW, this might be suboptimal because the "temporary" buffers that Emacs 28+ treats specially are just the ones that had been created with non-nil second (new and optional) argument to Which probably means that the contents of this hook will still run in many cases of buffers created for "temporary" work. See company-mode/company-mode#1492 or the Org related commit above referencing this issue. |
Foreword
I originally created #1879 but have since deleted that GitHub account,
as such the associated repository and pull request were closed. The
new version of that PR can be found at #1894.
This PR implements Solution 2 as described in #1894.
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 2.
#1894 implements Solution 1.
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 Solutionk 2 is that it will not work on versions
of emacs earlier than 28.1 because
buffer-list-update-hook
worksdifferently.
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!