Elisp: start the startup process from a path that includes a space

I am writing a mode that invokes a lower process. Line starting the process:

(setq grass-process (start-process "grass" "*grass*" "grass" "-text"
                           (concat  (file-name-as-directory 
                                    (cdr grass-location)) 
                           grass-mapset)))

      

grass-location

and grass-mapset

are both strings containing the path to the top-level directory and to one of the subdirectories, respectively, to be concatenated as an argument for set-process

.

This works great when grass-location

u grass-mapset

contain normal directories without spaces. However, when there is a space in the directory name, it becomes discarded when passed to start-process

, causing the following error:

grass-location
=> ("geobase Canada" . "/home/tws/grassdata/geobase Canada")
grass-mapset
=> "PERMANENT"

;; Calling start-process as above, the following error is produced
;; in the *grass* buffer:


Cleaning up temporary files ...
Starting GRASS ...
/home/tws/grassdata/geobaseCanada/PERMANENT: Not a valid GRASS location

Process grass exited abnormally with code 1

      

Note what geobase Canada

boils down to geobaseCanada

. I tried adding quotes to the expression concat

to protect this string, but it throws even weirder errors with the home directory appended to the argument.

How can I pass the pathname with spaces in it to start the process?

+3


source to share


1 answer


[As suggested by @event_jr, I am reprimanding my comment here as an answer as it looks like this was causing the problem]



Your challenge start-process

seems right; are you sure the problem is not with the program itself grass

? (for example the second argument seems to be related to the first, perhaps whitespace is lost during this process ...)

+2


source







All Articles