修改mode-compile.el以使用嵌入空格处理MS-Windows路径?

时间:2009-06-04 05:55:55

标签: windows ruby emacs compilation elisp

有人可以建议修改mode-compile.el,使其在Windows上运行得更好吗?我的具体问题是处理包含空格的路径名。我正在研究Ruby中的代码,使用2008-03-26版本的“GNU Emacs 22.2.1(i386-mingw-nt5.1.2600)”与mode-compile.el版本:2.29(最后修改时间:2006/12) / 01 13:52:47)

mode-compile.el生成的命令行编译(运行)我的缓冲区a.rb是这样的:

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

会产生此错误:

c:/ ruby​​ / bin \ ruby​​.exe:没有这样的文件或目录 - c:/ Documents(LoadError)

这很好用:

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

作为解决方法,我可以移动目录树,以便路径没有嵌入的空白。看看mode-compile.el中的代码,它表示已经存在一个函数来添加引号,但是,因为我不熟悉emacs-lisp,也许这实际上做了一些完全不同的事情(比如只是附加一个几乎为空的双引号标记):

(如果是to-compile-fname    (如果是mc - build-op-args     (mc - build-output-args to-compile-fname)       (concat“”to-compile-fname)       )    “”)))))

mode-compile.el来自这里: http://perso.tls.cena.fr/boubaker/distrib/mode-compile.el

提前致谢!

威廉

1 个答案:

答案 0 :(得分:0)

我没有时间对此进行测试,但在我看来,函数mc--shell-compile需要更新。缓冲区的文件名由以下行提取:

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

修复应引用buffer-file-name

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

请试试并报告吗?

干杯, 丹尼尔

相关问题