-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathem-cygwin.el
58 lines (52 loc) · 1.96 KB
/
em-cygwin.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
(when (user-try-load "fakecygpty.el")
(fakecygpty-activate))
(defun add-cygssh-to-tramp-methods ()
(add-to-list 'tramp-methods
(mapcar
(lambda (x)
(cond
((equal x "sshx") "cygssh")
((eq (car x) 'tramp-login-program) (list 'tramp-login-program "fakecygpty ssh"))
(t x)))
(assoc "sshx" tramp-methods))))
;; refer to https://stackoverflow.com/questions/1095172/emacs-tramp-plink
;;(setq env-for-tramp-login-args
;; (format "env 'TERM=%s' 'PROMPT_COMMAND=' 'PS1=%s'"
;; tramp-terminal-type "$"))
(defun env-for-tramp-login-args() "env 'TERM=dumb' 'PROMPT_COMMAND=' 'PS1=$'")
(defun add-sshw-to-tramp-methods ()
(add-to-list 'tramp-methods
'("sshw"
(tramp-login-program "fakecygpty ssh")
;; ("%h") must be single element, see 'tramp-compute-multi-hops'
(tramp-login-args (("-l" "%u" "-o \"StrictHostKeyChecking=no\"")
("-P" "%p") ("-t") ("%h") ("\"")
;;(,(format "env 'TERM=%s'" tramp-terminal-type))
("env 'TERM=dumb' 'PROMPT_COMMAND=' 'PS1=$'")
("/bin/sh") ("\"")))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-login "-l")
(tramp-remote-shell-args "-c")
(tramp-default-port 22))
))
(defun add-plinkw-to-tramp-methods ()
(add-to-list 'tramp-methods
'("plinkw"
(tramp-login-program "plink")
;; ("%h") must be single element, see 'tramp-compute-multi-hops'
(tramp-login-args (("-l" "%u")
("-P" "%p") ("-t") ("%h") ("\"")
;;(,(format "env 'TERM=%s'" tramp-terminal-type))
("env 'TERM=dumb' 'PROMPT_COMMAND=' 'PS1=$'")
("/bin/sh") ("\"")))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-login "-l")
(tramp-remote-shell-args "-c")
(tramp-default-port 22))
))
(when fakecygpty--activated
(eval-after-load "tramp"
'(progn
(add-sshw-to-tramp-methods)
(add-plinkw-to-tramp-methods)
(setq tramp-default-method "sshw"))))