Windows

Of course no self-respecting astro grad would use Windows. If, however, you're not one of them, here's some useful stuff...

Using putty and tramp for Windows Emacs

If you want to run Emacs on your local Windows machine, and still be able to access UNIX machines (read: do work...), tramp is essential. First you need an ssh client for Windows: [Putty], and then [tramp]. Once you have these, you need to configure stuff. In putty, define the hosts you want to login to and set up public key access and the agent (pageant), so you don't have to type passwords. Setting tramp up is easier than it used to, here's what I have in my .Emacs:

; tramp stuff
(add-to-list 'load-path "c:/software/tramp-2.0.36/lisp")
(add-to-list 'load-path "c:/software/tramp-2.0.36/contrib")
(require 'ange-ftp)

 (setq ange-ftp-ftp-program-name
   (concat (expand-file-name (getenv "WINDIR")) "/system32/ftp.exe")
 )

; ; customize the temporary directory that ange-ftp uses to cache files
 (setq ange-ftp-tmp-name-template 
   (concat (expand-file-name (getenv "TEMP")) "/ange-ftp")
 )

 (setq ange-ftp-gateway-tmp-name-template 
   (concat (expand-file-name (getenv "TEMP")) "/ange-ftp")
 )

;; shell-prompt-pattern stuff
; I want .mycshrc to have
; set prompt="%/> "
; so use
(require 'tramp)
;(setq tramp-default-method "pscp")
(setq shell-prompt-pattern "^.*\\(patrik@.*%\\|grifgrif@.*\\$\\)")
(setq tramp-remote-path (append '("/u/patrik/bin" "/data/patrik/bin"
                                  "/opt/bin" "/opt/share/bin"
                                  "/usr/gnu/bin" "/opt/X11/bin"
                                  "/usr/common/usg/gnu/bin"
                                  "/usr/common/usg/KCC/4.0f9/KCC_BASE/bin/"
                                  ) tramp-remote-path  ))

; for debugging
(setq tramp-verbose 10)
(setq tramp-debug-buffer t)

(setq tramp-auto-save-directory "c:/temp")

The tricky stuff is the shell-prompt-pattern, which must match the shell-prompt of ANY machine you might login to, and the remote-path which must include the path to all possible binaries tramp might want to find on any host. (If you want to use remote compilation, this must include your compiler...) Once this is set up, you find remote files like "/pscp:isis:remote/path/to/file.C", where pscp (or plink) is the transfer method and "Isis" is the name you've given the set up in putty.

Tramp is also capable of another cool trick: you can edit files on your local machine as root. If you're editing a bunch of system configuration files, you could open a shell, log in as root, start emacs, remember to put something in the title bar to remind yourself that this emacs is running as root, and then edit away. Or, you can use tramp, specify su or sudo as the "protocol," and tramp will do the rest.

This is a temporary and soon-to-be-obsolete hint: Evidently there's a bug in 2.0.41 of tramp, with a patch available here: http://www.mail-archive.com/tramp-devel@nongnu.org/msg00880.html

Answers/Windows (last edited 2007-09-12 23:38:20 by GregNovak)