24

I am using the Macports flavor of Emacs on OSX Yosemite, and have looked through every thread here on Tramp being slow without any solution.

Tramp is usable, but there is about a 100ms delay between every action. It's not a problem on the server's end because this delay does not exist if I just use terminal/iTerm to just ssh to the same server.

I thought maybe the problem was limited to editing files, but it turns out it's ubiquitous. Whether I'm using just a remote shell, or just pressing M-x (with helm) it's all delayed.

I've tried ssh, scp, and rsync as methods for connecting without any solution. Also have tried the ControlMaster auto without any effect.

Has anyone else had this problem, and was able to solve it?

m0meni
  • 743
  • 1
  • 6
  • 17
  • Tried to find a something, [this](http://superuser.com/a/434166) answer, is the only thing close to an helpful answer :\ – Nsukami _ Oct 21 '15 at 02:00
  • 2
    Tramp has extended logging facilities. Apply `(setq tramp-verbose 6)` and rerun your tests. There will be an exhaustive Tramp debug buffer, every single entry starts with a timestamp. Go through this buffer following the `(6)` entries, they are the comands sent remotely, and the output from the remote shell. Check, whether there are obvious delays. Btw, which Tramp version are you using? Check it with `C-h v tramp-version`. – Michael Albinus Oct 21 '15 at 07:49
  • For helm-tramp, https://github.com/masasam/emacs-helm-tramp#if-you-want-to-speed-up-tramp – Peter Becich Apr 08 '19 at 16:26
  • For me, `tramp-cleanup-all-connections` and `tramp-cleanup-all-buffers` made a difference. – Peter Becich Apr 06 '23 at 03:10

2 Answers2

20

Turns out it was projectile that was causing the problems. As soon as I disabled projectile-mode TRAMP was buttery smooth and I began to understand the hype behind it.

Hopefully this helps out someone else who has exhausted all other options.

Another solution I found if you don't want to disable projectile constantly is to put this command in your init.el

(setq projectile-mode-line "Projectile")

Turns out all the lag was coming from projectile trying to calculate what to put as the project name in the mode line. This isn't an important feature at all to me so you can just set it to say "Projectile"

m0meni
  • 743
  • 1
  • 6
  • 17
  • How did you debug this? I don't think it's projectile slowing my TRAMP down, but I'm not 100% sure yet. – Adam Spiers Mar 16 '16 at 02:46
  • 1
    @AdamSpiers I just tried literally everything until I found out. If you want to do it the right way, you can try using `(setq tramp-verbose 6)` like another comment suggested. – m0meni Mar 16 '16 at 02:52
  • I already had that set to `7`, and also profiled via `elp-*`. Difficult to understand the results though. – Adam Spiers Mar 16 '16 at 13:09
  • This issue is reported many times on projectile issue list. It seems that [commit 323fb8](https://github.com/bbatsov/projectile/commit/323fb845f2da0fc95ac27efd11f4d696f5fe647d).solved it. I had this issue for years but since I upgraded to projectile 20171102.55, it works well. – marcz Nov 02 '17 at 16:58
12

I have also found the solutions on the tramp FAQ that address speeding tramp up to work pretty well.

From the page, here is what I added to my configuration:

(setq remote-file-name-inhibit-cache nil)
(setq vc-ignore-dir-regexp
      (format "%s\\|%s"
                    vc-ignore-dir-regexp
                    tramp-file-name-regexp))
(setq tramp-verbose 1)
Stefan
  • 26,154
  • 3
  • 46
  • 84
colelemonz
  • 276
  • 2
  • 4