[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tramp mosh method
From: |
Ted Zlatanov |
Subject: |
Re: Tramp mosh method |
Date: |
Sun, 23 Dec 2012 16:58:45 -0500 |
User-agent: |
Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3.50 (gnu/linux) |
tramp-mosh2 patch attached.
=== modified file 'lisp/net/tramp-sh.el'
--- lisp/net/tramp-sh.el 2012-12-19 13:01:16 +0000
+++ lisp/net/tramp-sh.el 2012-12-23 21:54:10 +0000
@@ -406,6 +406,22 @@
(tramp-copy-program "fcp")
(tramp-copy-args (("-p" "%k")))
(tramp-copy-keep-date t)))
+;;;###tramp-autoload
+(add-to-list 'tramp-methods
+ '("mosh"
+ (tramp-login-program "mosh")
+ (tramp-login-args (("-p" "%p") ("--") ("%h")
+ ("/bin/env" "PS1=% " "/bin/sh")))
+ (tramp-remote-shell "/bin/sh")
+ (tramp-remote-shell-args ("-c"))
+ (tramp-copy-keep-date t)
+ (tramp-copy-recursive t)
+ (tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null")
+ ("-o" "UserKnownHostsFile=/dev/null")
+ ("-o" "StrictHostKeyChecking=no")))
+ (tramp-process-precommands ("stty rows 25" "stty cols 80"))
+ (tramp-process-filter tramp-mosh-process-filter)
+ (tramp-default-port 22)))
;;;###tramp-autoload
(add-to-list 'tramp-default-method-alist
@@ -4392,7 +4408,8 @@
(when (and p (processp p))
(delete-process p))
(setenv "TERM" tramp-terminal-type)
- (setenv "LC_ALL" "C")
+ (setenv "LC_ALL" "C.UTF-8")
+ (setenv "LC_ALL" "en_US.UTF-8")
(setenv "PROMPT_COMMAND")
(setenv "PS1" tramp-initial-end-of-output)
(let* ((target-alist (tramp-compute-multi-hops vec))
@@ -4420,6 +4437,13 @@
(cons (butlast (append vec nil)) (current-time))
tramp-current-host (system-name))
+ ;; Set the process filter.
+ (let ((filter
+ (tramp-get-method-parameter
+ (tramp-file-name-method vec) 'tramp-process-filter)))
+ (when filter
+ (set-process-filter p filter)))
+
(tramp-message
vec 6 "%s" (mapconcat 'identity (process-command p) " "))
@@ -4428,6 +4452,11 @@
p 60
"Couldn't find local shell prompt %s" tramp-encoding-shell)
+ (dolist (command (tramp-get-method-parameter
+ (tramp-file-name-method vec)
+ 'tramp-process-precommands))
+ (tramp-send-command vec command t t))
+
;; Now do all the connections as specified.
(while target-alist
(let* ((hop (car target-alist))
@@ -5159,6 +5188,18 @@
(t
(format "%s <%%s" coding)))))))
+(defun tramp-mosh-process-filter (proc string)
+ (with-current-buffer (process-buffer proc)
+ (tramp-message proc 10 "\n>>>1>>> %s" string)
+ ;; Replace color escapes (m), show/hide cursor (h/l) with empty string.
+ (setq string (replace-regexp-in-string "\e\[[?0-9;]*[mhl]" "" string))
+ ;; Replace kill to EOL (K) and kill to end of screen (J) with \n.
+ (setq string (replace-regexp-in-string "\e\[[0-9]*[KJ]" "\n" string))
+ ;; Replace position changes (H) with \n.
+ (setq string (replace-regexp-in-string "\e\[[0-9;]*H" "\n" string))
+ (tramp-message proc 10 "\n>>>2>>> %s" string)
+ (insert string)))
+
;;; Integration of eshell.el:
(eval-when-compile
=== modified file 'lisp/net/tramp.el'
--- lisp/net/tramp.el 2012-12-18 13:37:06 +0000
+++ lisp/net/tramp.el 2012-12-21 13:48:42 +0000
@@ -3100,7 +3100,12 @@
(setq mode-line-process '(":%s"))
(shell-mode)
(set-process-sentinel p 'shell-command-sentinel)
- (set-process-filter p 'comint-output-filter))
+
+ ;; Maybe set the process filter to `comint-output-filter'
+ ;; (wrapped in a check to ensure we don't overwrite an
+ ;; existing output filter).
+ (unless (process-filter p)
+ (set-process-filter p 'comint-output-filter)))
(prog1
;; Run the process.
- Re: Tramp mosh method, Ted Zlatanov, 2012/12/18
- Re: Tramp mosh method, Michael Albinus, 2012/12/19
- Re: Tramp mosh method, Ted Zlatanov, 2012/12/21
- Re: Tramp mosh method, Michael Albinus, 2012/12/21
- Re: Tramp mosh method, Ted Zlatanov, 2012/12/21
- Re: Tramp mosh method, Michael Albinus, 2012/12/21
- Re: Tramp mosh method, Ted Zlatanov, 2012/12/23
- Re: Tramp mosh method,
Ted Zlatanov <=
- Re: Tramp mosh method, Michael Albinus, 2012/12/31