Embarassingly simple question. Using CPerl mode in Emacs 23.4.1 on Windows 7 64, when I use C-c c to run the script Emacs doesn’t wrap the path in quotes, so any directories with spaces cause Perl to be unable to find the file.
"C:/Perl64/bin\perl.exe -w g:/foo/bar/first second/myscript.pl"
generates this error message:
"Can't open perl script "g:/foo/bar/first": No such file or directory"
Question: how do I make Emacs use quotes when passing the file name to Perl itself?
Edit: for some reason I can’t comment (perhaps a browser issue) so I am editing the original post in response to the comment from @legoscia: “C-c c runs the command mode-compile”. In the Perl menu it is marked as “Run”.
I only have mode-compile.el v2.29 available, but in that version the issue is exactly as you describe, the arguments to the compile command are not escaped properly, and there’s no option to enable it.
It’s a bit of hack but you should be able to redefine the relevant function with correct escaping for the filename with this in your
.emacsfile:The line I changed was changing
to
A more complete fix would be to also escape the
dbgflags(wherever they’re set, just escaping the entire variable won’t be right) andmc--shell-argswhen they’re set too.