-
-
Notifications
You must be signed in to change notification settings - Fork 579
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
Do not error inside of projectile-cache-current-file
when opening a file inside a project.
#957
Do not error inside of projectile-cache-current-file
when opening a file inside a project.
#957
Conversation
I'm not quite certain what you mean. Some exact repro steps would be useful. |
It's a nil condition with the line patched. Simple fix. -Joe |
When I looked closer at the code I understood the problem, but the description of the commit and the changelog entry are misleading - in reality we simply don't want to attempt to cache a buffer which is not backed by a file. |
@@ -657,7 +657,7 @@ The cache is created both in memory and on the hard drive." | |||
"Add the currently visited file to the cache." | |||
(interactive) | |||
(let ((current-project (projectile-project-root))) | |||
(when (gethash (projectile-project-root) projectile-projects-cache) | |||
(when (and (gethash (projectile-project-root) projectile-projects-cache) (buffer-file-name (current-buffer))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd move the file check before the cache check. Also (buffer-file-name (current-buffer))
can be replaced with simply buffer-file-name
. No need for two function calls. I see the same was used a line below, which can be optimized.
ping |
* Check buffer-file-name before cache entries. * Add bug fix to CHANGELOG entries under bugs fixed.
* buffer-file-name returns the current buffer when no argument is specified.
There are two entries in the changelog now. Remove the old one, rebase on top of the current |
8b66289
to
f0d4a4d
Compare
Please review rebase.
|
I still see two entries in the changelog and the branch is still outdated compared to the current upstream |
When opening a file from the terminal, it is possible for the file to be a project and have the `switch-to-buffer` hook run, with a new buffer that has no associated file.
f0d4a4d
to
2100025
Compare
Sorry. Hopefully ok now. Sent from my iPad
|
…ssoc Do not error inside of `projectile-cache-current-file` when opening a file inside a project
When opening a file from the terminal, it is possible for the
file to be a project and have the
switch-to-buffer
hook run,with a new buffer that has no associated file.