-
-
Notifications
You must be signed in to change notification settings - Fork 581
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
Fix TRAMP issues #1129
Fix TRAMP issues #1129
Conversation
@timvisher, @2mc, @tonycpsu, @KGZM, @ackerleytng, @IvanMalison, @spaceotter, @stardiviner, @puffnfresh, @seagle0128, @bhrgunatha, @binarin: please test and report. |
Whoa! Nice! :) I'll try to test this out today! |
projectile.el
Outdated
projectile-project-root-files-functions) | ||
(let* ((dir default-directory) | ||
(is-local (not (file-remote-p dir))) | ||
(is-connected (file-remote-p default-directory nil t))) |
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.
What doest this mean?
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.
huh? is-local
is true if the file is local, is-connected
is true if the file is remote and we are already connected to the remote.
TRAMP's problems occur when we try to get file informations but we are just not quite connected yet.
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.
Ah, the second default-directory
should be dir
, I'll make a fixup commit
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.
@bbatsov: I don't really understand your original question, can you clarify?
I'm on emacs 25.1 now - tramp is working correctly for me now with projectile-mode (also looks OK with projectile-rails-mode too) |
@bhrgunatha: with or without my patch? Also, to be exact it's |
Cab's running fine… Purring like a kitten… (Supergreen) (Meaning it works great for me :) ) |
Looks good here on Emacs 24.5. |
@Silex |
Okay, I discovered that it's possible to update TRAMP itself. I'm building a test matrix based on:
I'll report when it's done. |
Works well on Emacs 25.1. |
Acked-by: Vincent Zhang <[email protected]>
Okay, here are my tests so far:
We see that my branch repairs 3 tests out of 4, and that by updating TRAMP to latest version we get the last failing test. The tests in their current form are a bit of a pain to run (they need manual intervention), and I doubt they can actually become part of projectile's test suite due to the heavy setup required. Maybe a second travis-ci just for them might work tho. For the brave who like to look at work in progress, look at https://github.com/Silex/projectile/tree/tramp-tests/bugs. One of the issues I have is that p.s: one surprising finding is that by running emacs with |
@bbatsov: I'd like to hear from you. I don't think I'll progress much more on this issue. Here is the current status:
For information, here is the latest update with the TRAMP guys: http://lists.gnu.org/archive/html/bug-gnu-emacs/2017-03/msg00979.html Basically they say it makes sense to test for what I test, but that there's not much they can do. Emacs 26 might fix the issue, but so far with my tests the bug is still present. |
@bbatsov: ping :-) |
I'm extremely busy, so I don't really have time to go through the linked issues. What exactly is this supposed to fix. Frankly, I'm getting a bit annoyed from having to complicate the code base more and more and more on behalf of TRAMP, which I don't even use. I still don't get while someone would be developing over TRAMP... So, briefly, what is this supposed to fix? P.S. Just looking at the patch I find it extremely odd there's a branch in the logic where we don't even attempt the find the project root. |
It fixes the behavior where Emacs hangs because of projectile when you open a file over TRAMP. When Emacs hangs, very often the only solution is to kill emacs from another terminal. The fix can be summarized as follow: "Stop trying to find information about files for which it's not possible to get informations from."
This is exactly what the fix does: don't try to find the project root for remote files, if we are not connected to the remote host yet. Here is what currently happens:
Here is what my fix changes:
|
projectile.el
Outdated
value)))) | ||
projectile-project-root-files-functions) | ||
(let* ((dir default-directory) | ||
(is-local (not (file-remote-p dir))) |
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 add what you answered to me in the issue here as a comment. Otherwise people are going to have a hard time figuring out what does this do.
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.
Good idea! Doing it now.
Apart from my small remark - this needs a changelog entry. |
Does the changelog entry and the fixup commit that adds comments work for you? I'm not sure how detailed the comments needs to be. |
CHANGELOG.md
Outdated
@@ -9,6 +9,7 @@ | |||
|
|||
### Changes | |||
|
|||
* [#1129](https://github.com/bbatsov/projectile/pull/1129) Fix TRAMP issues. |
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.
There's a missing :
here.
projectile.el
Outdated
value)))) | ||
projectile-project-root-files-functions) | ||
;; The `is-local' and `is-connected' variables are used to fix the behavior where Emacs hangs | ||
;; because of Projectile when you open a file over TRAMP. It basically prevents projectile from |
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.
projectile -> Projectile
projectile.el
Outdated
projectile-project-root-files-functions) | ||
;; The `is-local' and `is-connected' variables are used to fix the behavior where Emacs hangs | ||
;; because of Projectile when you open a file over TRAMP. It basically prevents projectile from | ||
;; trying to find information about files for which it's not possible to get informations from. |
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.
informations from -> information
Added a couple of tiny remark - squash and rebase after you apply them. |
Alright, reworded a little bit more, this should be good to go. |
👍 |
@bbatsov The biggest reason to develop over tramp is to develop on ephemeral resources like vagrant boxes or ec2 instances without loosing any of your context should you need to replace the ephemeral resource. |
This should fix #523 and #835.
Don't merge this yet (it lacks changelogs, etc). Right now the idea is for people having the same problem to test if my fix actually fixes all scenarios.
The idea is pretty simple: only resolve project-root for local files, or when the remote files are connected.
So far this seems to resolve all the issues for me, but I only tested emacs
25.1
.Things to test:
/scpx:user@host:somefile
/sudo:root@localhost:somefile
Note: by me, the issues only happened when
projectile-rails-global-mode
was turned on. Projectile alone worked pretty well. This is becauseprojectile-rails-mode
usesprojectile
to determine wether it'd turn on or not, and this was just too much for TRAMP.make test
)M-x checkdoc
warnings