skeeto / emacs-aio

async/await for Emacs Lisp
The Unlicense
215 stars 12 forks source link

aio-defun can't be autoloaded #3

Open kaiwk opened 5 years ago

kaiwk commented 5 years ago

It seems aio-defun can't be autoloded like defun, ;;;###autoload doesn't work.

skeeto commented 5 years ago

That's a good point. I can't figure out how to address this, though. It looks like autoload needs to know about the s-exp following the autoload cookie so that it can process it properly. It of course doesn't know about aio-defun, but, unfortunately, it looks like there's no way to teach autoload about it. The list of "function-like operators" is hardcoded in autoloads.el and so is not extensible.

If I'm reading it correctly, it actually macro-expands aio-defun and sees the defalias. Then it looks at the second argument to defalias and sees aio-lambda. However, I think it does not macro-expand this further, and since it doesn't recognize aio-lambda, it doesn't generate the correct autoload.

kiennq commented 4 years ago

In this case, I think you can just teach the autoload about what to autoload For example

;;;###autoload(autoload 'foo "bar" "" t nil)
(aio-defun foo ()
  (interactive))
gravitational-dark-light commented 4 years ago

In this case, I think you can just teach the autoload about what to autoload For example

;;;###autoload(autoload 'foo "bar" "" t nil)
(aio-defun foo ()
  (interactive))

Thank you, it worked perfectly