Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

migrated from stackoverflow.com Aug 1 '11 at 5:01

This question came from our site for professional and enthusiast programmers.

    
Tramp mode, or mounting the file system in some other manner, are the best ways. –  Yann Ramin Jul 31 '11 at 22:25
    
rxvt(from mingw)+ssh have worked relatively well for me, if the connection itself reliable. –  pst Jul 31 '11 at 22:28
    
Ah crap, didn't realise it was that low, thought it was higher than 50% at least! I've been pretty busy lately but I'll have a look at all the unanswered questions I've posted and make sure there are ones that I can accept answers for –  Eddy Aug 1 '11 at 16:14

3 Answers 3

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 TERM to 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 $TERM is dumb.

share|improve this answer
    
I'm a bit confused with this, what's plink? Where do I start with this? Thanks –  Eddy Aug 3 '11 at 20:46
    
@Shog9: Yes I do realise that's a hyperlink so I clicked on it. It just brings me to the putty website and doesn't explain what plink is at all. I googled it and still can't figure it out but I thought it might be easier to ask on here than to spend hours trying to find documentation on plink –  Eddy Aug 3 '11 at 23:42
1  
@Eddy Follow the link. Click on the Docs link at the top. Scroll down to the chapter on plink. Read the explanation. Not that you actually need all this to make use of my answer; it's enough to install plink and make sure it's in Emacs's PATH. –  Gilles Aug 3 '11 at 23:50
    
Thanks, I'll have a look at this later tonight or tomorrow –  Eddy Aug 10 '11 at 10:01
    
I have done this reasonably successfully on my system. It's still not as smooth as using a pure cygwin solution (i.e. cygwin X, cygwin emacs, cygwin ssh), but it does work. –  jwernerny Aug 11 '11 at 12:15

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.

share|improve this answer
    
See also stackoverflow.com/questions/2690050/… –  phils Aug 1 '11 at 12:45
    
I'm in the process of trying out this method. However I tried to set up passwordless ssh'ing as suggested here: blogs.translucentcode.org/mick/archives/000230.html but it didn't work, and now I'm unable to ssh into the remote server. I just get this error: ssh_exchange_identification: Connection closed by remote host. I'll see if I can get the system admin to fix this problem for me, then I'll give it another go –  Eddy Aug 3 '11 at 20:43
    
@Eddy: For the first pass, perhaps don't even bother with giving passphrase or using keychain. Do these after you are able to do passwordless ssh. –  nauhygon Aug 4 '11 at 2:23

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:

  1. Launch your X Server on Windows
  2. 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.
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.