views:

94

answers:

1

Can anyone suggest a modification of mode-compile.el that will make it work better on Windows? My specific issue is handling of path names that contain blanks. I'm working on code in Ruby, using "GNU Emacs 22.2.1 (i386-mingw-nt5.1.2600) of 2008-03-26 on RELEASE" with mode-compile.el version: 2.29 (Last modified: 2006/12/01 13:52:47)

The command line generated by mode-compile.el to compile (run) my buffer a.rb is this:

c:/ruby/bin\ruby.exe -w c:/Documents and Settings/William/My Documents/src/a.rb

Which generates this error:

c:/ruby/bin\ruby.exe: No such file or directory -- c:/Documents (LoadError)

This works just fine:

c:/ruby/bin\ruby.exe -w "c:/Documents and Settings/William/My Documents/src/a.rb"

As a work-around, I can just move my directory tree so that the path has no embedded blanks. Looking at the code in mode-compile.el, it APPEARS that a function exists already to add the quotes, however, as I am NOT proficient in emacs-lisp, perhaps this actually does something entirely different (like just appending a nearly-empty par of double quote marks):

(if to-compile-fname (if mc--build-op-args (mc--build-output-args to-compile-fname) (concat " " to-compile-fname) ) " "))))

mode-compile.el comes from here: http://perso.tls.cena.fr/boubaker/distrib/mode-compile.el

Thanks in advance!

William

A: 

Hi William,

I don't have time to test this really, but it appears to me that the function mc--shell-compile needs to be updated. The filename of the buffer is extracted by the following lines:

     (shfile  (or mc--remote-pathname (buffer-file-name)
                  (error "Compilation abort: Buffer %s has no filename"
                         (buffer-name))))

the fix should be to quote the buffer-file-name:

     (shfile  (or mc--remote-pathname (shell-quote-argument buffer-file-name)
                  (error "Compilation abort: Buffer %s has no filename"
                         (buffer-name))))

Can you have a try and report, please?

Cheers, Daniel

danielpoe