Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bizzarre Emacs Tramp Fix

Tags:

emacs

tramp

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.

like image 366
amp108 Avatar asked Dec 21 '12 22:12

amp108


2 Answers

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".

like image 163
stsquad Avatar answered Oct 20 '22 20:10

stsquad


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)
like image 44
Paul Price Avatar answered Oct 20 '22 19:10

Paul Price