私はmode-compile.elv2.29しか利用できませんが、そのバージョンでは、問題はあなたが説明したとおりであり、compileコマンドへの引数は適切にエスケープされず、それを有効にするオプションはありません。
これは少しハックですが、ファイル内でこれを使用してファイル名を正しくエスケープすることで、関連する関数を再定義できるはず.emacs
です。
(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)))))
私が変更した行は変更されていました
(run-cmd (concat shcmd " " dbgflags " " shfile " "
に
(run-cmd (concat shcmd " " dbgflags " " (shell-quote-argument shfile) " "
より完全な修正は、dbgflags
(設定されている場所では、変数全体をエスケープするだけでは正しくありません)、またmc--shell-args
設定されたときにもエスケープすることです。