Bizzarre Emacs Tramp Fix
Asked Answered
B

2

9

I was In the middle of editing a file on a remote host and hit C-x C-s, when suddenly Emacs froze. It had been working earlier that day; I'd saved from another buffer in the same session only ten minutes prior. Hitting C-g pulled it out of the hung status, but it wouldn't save anymore. Local machine is OS X Leopard, remote is FreeBSD 7.4, Emacs is a precompiled download 24.1 (9.0) for OS X.

I did M-x tramp-cleanup-all-connections and tried again. No luck. I tried many things, including shutting my workstation down and restarting emacs.

Skipping to the end, I changed the following line in my .emacs:

(setq tramp-verbose 10); had been 3

I figured I'd get some good debugging information that way. So I restarted, and attempted to edit a remote file, figuring I'd see something in the *debug tramp/ssh ...* buffer.

Lo and behold, I was able to edit the remote file again.

I reset tramp-verbose to 3, restarted, and tramp hung again. I switched it back to 10, everything works. It works even if I set tramp-debug-buffer to nil.

Anyone have any ideas why this would be? The thing that really gives me pause is that Emacs suddenly stopped working after months of glitch-free editing.

Bed answered 21/12, 2012 at 22:24 Comment(2)
This sounds like an emacs bug report. I suggest searching the emacs debug mailing list, and then submitting this bug there: debbugs.gnu.org/Emacs.htmlJosi
I get these sort of tramp hangs when I put my Macbook to sleep and then wake it again. Using TCPKeepAlive yes and ControlPersist yes in my ~/.ssh/config file has helped alleviate the problem a little bit; ymmv.Bulgarian
C
2

Well tramp-mode is great however it can sometimes introduce latency when emacs does other things. Two of the biggest culprits are auto-saving and vc-mode. If these start running and you connection is slow this can lock out for a while. You best bet is to (setq tramp-verbose 5) and see what tramp is up to during the "freeze".

Colous answered 22/5, 2013 at 12:33 Comment(0)
C
2

Following stsquad's warning about auto-save, I thought I'd share my setups (from ~/.emacs) that disable auto-save:

;; Tramp (http://www.emacswiki.org/emacs/TrampMode) for remote files
(require 'tramp)
(add-to-list 'tramp-remote-path 'tramp-own-remote-path)
(setq tramp-default-method "ssh")
;; Backup (file~) disabled and auto-save (#file#) locally to prevent delays in editing remote files
(add-to-list 'backup-directory-alist
             (cons tramp-file-name-regexp nil))
(setq tramp-auto-save-directory temporary-file-directory)
(setq tramp-verbose 10)
Cost answered 27/2, 2014 at 18:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.