Subject: bug#16005: inferior-lisp and filenames with spaces

From: Lars Ingebrigtsen <[email-masked]>
Date: Thu, 15 Jul 2021 07:33:33 +0200

Steven Litvintchouk <[email-masked]> writes:

> Trying to run an inferior lisp program on Windows 7,
> with the value of inferior-lisp-program set to 
> "D:/More Program Files (x86)/clisp-2.49/clisp.exe",
>
> caused an error with error message:
> "Spawning child process: invalid argument"
>
> The reason is that the function inferior-lisp (defined in inf-lisp.el)
> calls the function split-string, whose arg SEPARATORS defaults to "[ \f\t\n\r\v]+".

This problem is still present in Emacs 28:

  (interactive (list (if current-prefix-arg
			 (read-string "Run lisp: " inferior-lisp-program)
		       inferior-lisp-program)))
  (if (not (comint-check-proc "*inferior-lisp*"))
      (let ((cmdlist (split-string cmd)))
	(set-buffer (apply (function make-comint)
			   "inferior-lisp" (car cmdlist) nil (cdr cmdlist)))
	(inferior-lisp-mode)))

The only way this could work is that if we either split the prompt into
two parts (one for the command and one for the options), or that we
require that the user quotes the spaces, and then use a splitting
function that's aware of that.  So the user would have to type

"D:/More Program Files (x86)/clisp-2.49/clisp.exe" -some -option

or the like.

I thought Emacs had a shell-syntax-aware splitting function (that would
tokenise that into a list of three items), but I can't find it now...
anybody remember what it's called (if we do have it)?  I.e.,

(that-func "\"foo bar\" zot") => ("foo bar" "zot")

and

(that-func "foo\\ bar zot") => ("foo bar" "zot")

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no