You're looking for (call-process-shell-command "echo ${GOPATH}" nil t nil). In this case, ${PATH} is syntax defined by a shell, not a native call, so you'll need to invoke a shell to interpret it. However, you may be interested in (insert (getenv "GOPATH")) which is considerably more direct, as it simply reads the environment instead of spawning a shell to ...


setenv-internal and setenv change the list stored in process-environment (as local or special variable) by side-effects. It does not help if you assign the list (pointer) to a local variable process-environment. You still have only a single list for the process-environment which is just bound to two variables -- the global variable process-environment and ...


You've quoted the list: :command '("sh" "-c" body) So you have passed it a symbol body not the string value of the variable. Try: :command (list "sh" "-c" body) or: :command `("sh" "-c" ,body) Either of which cause body to be evaluated to its string value.


The c-function call-process is the basis for creating synchronous processes in Emacs. So you don't get more with any other functions. The info page (elisp) Synchronous Processes contains the following section: You can’t directly specify a buffer to put the error output in; that is too difficult to implement. But you can achieve ...


The "let binding" way is the following (notice that contrary to Tobias's answer, this does not involve any copying or "set"ting): (let ((process-environment (cons "HOME" (cons (concat "OLDHOME=" (getenv "HOME")) process-environment)))) (start-process "proc" (current-buffer) ...))


You can use something like the following with M-|: cat > tmp.txt && python -m doctest -v tmp.txt


I just found this: Proxy shell designed for use with Emacs on Windows 95 and NT. [...] The main function is simply to process the "-c string" option in the way /bin/sh does, since the standard Windows command shells use the convention that everything after "/c" (the Windows equivalent of "-c") is the input string. Personally, I don't see cases where ...

Only top voted, non community-wiki answers of a minimum length are eligible