jwiegley / emacs-async

Simple library for asynchronous processing in Emacs
GNU General Public License v3.0
838 stars 68 forks source link

Add to $PATH #14

Closed rejeep closed 10 years ago

rejeep commented 11 years ago

Hi,

I'm trying to create an async job that runs the mocha command, which is a node-js file with this shebang #!/usr/bin/env node. The problem is that node lives in /usr/local/bin and that is not in Emacs default path.

I'm trying to add that to the path using this:

(let ((default-directory "/Users/user/")
      (exec-path (cons "/usr/local/bin/" exec-path)))
  (async-start-process
   "path"
   "/Users/user/echo_path.sh"
   (lambda (process)
     (with-current-buffer (process-buffer process)
       (print (buffer-string))))))

But the path is not added. I can use setenv, but that will set it for good, which I don't want. Sure I could use setenv again and restore the value, but that seems rather lame. Any way to only set the path while running the async job?

jwiegley commented 11 years ago

Is this perhaps related to #13?

rejeep commented 11 years ago

Related, yes. But not the same issue. In order to do what I want, I need to:

thierryvolpiatto commented 10 years ago

Setting exec-path is not the good approach because it will not affect you PATH in the view of your script, try instead modifying your PATH inside your script.