What's the fastest and most reliable way of working on files via a Linux machine with Emacs through a Windows host machine? I need to be able to easily copy and paste text between Emacs frames and use all the keyboard shortcuts. So, Putty and Cygwin are out of the question. I've tried TRAMP mode but it just hangs when I try to connect.
Tramp is definitely the right answer. If you have a problem with Tramp, fix it. The simplest way to get Tramp going under Windows is with
plink, PuTTY's ssh tunnelling and scripting component. Cygwin's
ssh is another possibility.
One problem I ran against is that
plink forces the
TERM environment variable to
xterm. This can cause your
.profile or other login script to emit data, thinking it's speaking to a terminal, but this data will confuse your scripts. Usually you would call
plink with the
-T option, to tell it not to emulate a terminal. In Emacs, use the
plinkx Tramp method, which forces
dumb on the remote side:
(if (eq system-type 'windows-nt) (setq tramp-default-method "plinkx"))
On the remote side, make sure your login files don't emit any output such as a prompt when
I guess when you said "putty and cygwin are out of the question", you meant not to use emacs directly from the Cygwin console or the PuTTY shell, but to use ntemacs (Emacs for Windows) with tramp accessing your Linux boxes.
Good news is this is feasible! :) I have been using a combination of ntemacs and Cygwin (for ssh access) with good results.
Here is what you need to do.
Install Cygwin with openssh installed (if you are unsure, then just install everything) and set up your ssh so that you can access your linux boxes passwordlessly, for which please refer to this short and sweet article.
Copy cygwin-mount by Michael Cook and Klaus Berndl from emacswiki and place it under say ~/.emacs.d/plugins/cygwin-mount (or anywhere your third-party emacs packages live).
In your .emacs, have something like the following to activate cygwin-mount.
(add-to-list 'load-path "~/.emacs.d/plugins/cygwin-mount") (defvar cygwin-bin-dir "c:/cygwin/bin/" "*Directory of Cygwin bin.") (when (eq (window-system) 'w32) (progn (setenv "PATH" (concat cygwin-bin-dir ";" (getenv "PATH"))) (setq exec-path (cons cygwin-bin-dir exec-path)) (require 'cygwin-mount) (cygwin-mount-activate)))
- Now restart emacs and C-x C-f and type "/sshx:your_host:" in the minibuffer (notice the trailing colon). If everything goes well, tramp/ssh should kick in and you should be able to see the remote directories.
Hope this helps.
Instead of running Emacs locally, why not run it remotely on the Linux box and have it display on a local X window.
What you will need:
- X Server for Windows: Some possible free solutions include Xming, Cygwin/X (I know, you said no Cygwin.)
- Emacs on the Linux host
- A way to launch the remote command (something like ssh)
The basic steps:
- Launch your X Server on Windows
- Start Emacs remotely and have it display on your local X Server. I usually do this using ssh by issuing the command "ssh -X @ emacs". Alternatively, you could log into the Linux box, set the DISPLAY variable ("export DISPLAY=:0") and then start emacs.