How to force an Emacs tramp time out?

ε祈祈猫儿з 提交于 2019-12-05 14:56:52

In thoses (frequent) cases when tramp stalls, I just halt the process with C-g, kill the tramp buffer and I can then save the file.

M-x kill-buffer RET *tramp.*

I don't face such timeout situation though I frequently use TRAMP. Try something like

(defun tramp-find-file-timeout ()
  (when tramp
    (with-timeout (4)
      (keyboard-quit))))
(add-hook 'find-file-hook 'tramp-find-file-timeout)

I used this and this to make this suggestion. something better than keyboard-quit could work for you.

I found one hint that can limit the painful wait to 5 seconds. Add this line to .ssh/config:

Host *
     ServerAliveInterval 5

However, after five seconds, you still can't choose a file. So, when it fails just do a C-x b to a buffer that's not opened on the downed server and C-x-f from there will not take forever.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!