jwiegley / emacs-async

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

async-start evals (symbol-file 'async-batch-invoke 'defun) at compile time #33

Closed michael-heerdegen closed 10 years ago

michael-heerdegen commented 10 years ago

Hi,

sorry if this is nonsense, I'm new to async.

I compiled a file calling async-start (it was "tv-utils.el") and had a look at the compiled code.

There was a hardcoded path in that compiled code, namely

"/home/micha/.emacs.d/elpa/async-20140311.747/async.elc"

If I would update async via list-packages, the according compiled code would presumably stop to work.

The culprit is async-start: it looks up (symbol-file 'async-batch-invoke 'defun) at expand time. Is this expected? I would expect to call symbol-file at run-time. With other words, I would suggest to remove the comma before the expression in the macro code, without having understood too much of the code.

thierryvolpiatto commented 10 years ago

@jwiegley Could you look into this, I am taking the plane in few hours...

thierryvolpiatto commented 10 years ago

Hi Michael,

Michael Heerdegen notifications@github.com writes:

Hi,

sorry if this is nonsense, I'm new to async.

I compiled a file calling async-start (it was "tv-utils.el") and had a look at the compiled code.

There was a hardcoded path in that compiled code, namely

"/home/micha/.emacs.d/elpa/async-20140311.747/async.elc"

If I would update async via list-packages, the according compiled code would presumably stop to work.

The culprit is async-start: it looks up (symbol-file 'async-batch-invoke 'defun) at expand time. Is this expected? I would expect to call symbol-file at run-time. With other words, I would suggest to remove the comma before the expression in the macro code, without having understood too much of the code.

That make sense, unfortunately I am travelling now and I don't know if I will have the opportunity to lokk into this, but maybe John will have the tiem.

Thanks.

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

michael-heerdegen commented 10 years ago

Thanks @thierryvolpiatto, have a good flight.

jwiegley commented 10 years ago

I'm traveling too, but the fix looks good to me. @michael-heerdegen How have you tested this change?

michael-heerdegen commented 10 years ago

I'm not travelling.

I did some quick tests (byte-recompile-directory, and the examples in async.el), my fix seems to work ok. Since async-start calls async-start-process (a function), which recives what I changed as an argument, the symbol-file is now just evaluated at run-time when the process is started. I think that's what we want.