jwiegley / emacs-async

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

Default directory #13

Closed rejeep closed 11 years ago

rejeep commented 11 years ago

Is there any way to specify the directory to execute the command in? I realize it would be tricky, but most valuable.

jwiegley commented 11 years ago

Can you wrap the async call with a let binding of default-directory?

rejeep commented 11 years ago

Nope, for example:

(let ((default-directory "/Users/user/foo"))
  (async-start-process
   "process"
   "pwd"
   (lambda (process)
     (with-current-buffer (process-buffer process)
       (print (buffer-string))))))

But how could the default-directory matter since a new Emacs process is started? The default-directory would have to be passed along to the new process.

thierryvolpiatto commented 11 years ago

Hi Johan,

Johan Andersson notifications@github.com writes:

Nope, for example:

(let ((default-directory "/Users/user/foo"))
  (async-start-process
   "process"
   "pwd"
   (lambda (process)
     (with-current-buffer (process-buffer process)
       (print (buffer-string))))))

But how could the default-directory matter since a new Emacs process is started? The default-directory would have to be passed along to the new process.

Don't forget to add "/" at end of default-directory.

Thierry Get my Gnupg key: gpg --keyserver pgp.mit.edu --recv-keys 59F29997

rejeep commented 11 years ago

Ahh... that might be the problem, let me get back to you with the results.

rejeep commented 11 years ago

That worked fine, thanks!