Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8126463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:09:25+00:00 2026-06-06T07:09:25+00:00

Embarassingly simple question. Using CPerl mode in Emacs 23.4.1 on Windows 7 64, when

  • 0

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”.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T07:09:26+00:00Added an answer on June 6, 2026 at 7:09 am

    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 .emacs file:

    (eval-after-load 'mode-compile
      '(progn
        (defun mc--shell-compile (shell dbgflags &optional errors-regexp-alist)
          ;; Run SHELL with debug flags DBGFLAGS on current-buffer
          (let* ((shcmd   (or (mc--which shell)
                              (error "Compilation abort: command %s not found" shell)))
                 (shfile  (or mc--remote-pathname (buffer-file-name)
                              (error "Compilation abort: Buffer %s has no filename"
                                     (buffer-name))))
                 (run-cmd (concat shcmd " " dbgflags " " (shell-quote-argument shfile) " "
                                  (setq mc--shell-args
                                        (read-string (if mode-compile-expert-p
                                                         "Argv: "
                                                       (format "Arguments to %s %s script: "
                                                               shfile shell))
                                                     mc--shell-args)))))
            ;; Modify compilation-error-regexp-alist if needed
            (if errors-regexp-alist
                (progn
                  ;; Set compilation-error-regexp-alist from compile
                  (or (listp errors-regexp-alist)
                      (error "Compilation abort: In mc--shell-compile errors-regexp-alist not a list."))
                  ;; Add new regexp alist to compilation-error-regexp-alist
                  (mapcar '(lambda(x)
                             (if (mc--member x compilation-error-regexp-alist) nil
                               (setq compilation-error-regexp-alist
                                     (append (list x)
                                             compilation-error-regexp-alist))))
                          errors-regexp-alist)))
            ;; Run compile with run-cmd
            (mc--compile run-cmd)))))
    

    The line I changed was changing

    (run-cmd (concat shcmd " " dbgflags " " shfile " "
    

    to

    (run-cmd (concat shcmd " " dbgflags " " (shell-quote-argument shfile) " "
    

    A more complete fix would be to also escape the dbgflags (wherever they’re set, just escaping the entire variable won’t be right) and mc--shell-args when they’re set too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

OK, this is an embarrassingly simple question. Why doesn't the following jQuery example work?
This seems to be an embarrassingly simple question, but, after a day of reading
Ok, this is an embarassingly simple-looking problem, but is driving me crazy. I'm learning
How does one use multiprocessing to tackle embarrassingly parallel problems ? Embarassingly parallel problems
Got a simple question regarding twisted. I can create a trivial basic test with
I'm just starting with jQuery, and having trouble doing something embarrassingly simple: using .load()
An embarrisingly simple question, which makes it all the more frustrating: how do I
This is a very simple question, but embarrassingly enough I am not sure how
Ok this is embarrassingly simple of a question, but I just can't get this
I know that this is an embarassingly easy question, but I can't figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.