Closed Dima-369 closed 2 years ago
I have push new commit https://github.com/emacs-eaf/emacs-application-framework/commit/c3aa71be04a7844f789102d9f3106edee679200e
After update to newest version of EAF.
You can try:
(eaf-call-async "eval_js_code" eaf--buffer-id "alert('hello')")
or
(eaf-call-sync "execute_js_code" eaf--buffer-id "1 + 1;")
for your purpose.
Perfect, works well. Thank you!
One thing I noticed here is that the function doc is incorrect because a result is returned.
And a follow-up question to the code above. It seems that the code would allow to pass the evaluated result back into Emacs Lisp but the code below (regardless of the string) always returns nil
for me.
Does it work for you?
(eaf-call-sync "execute_js_code" eaf--buffer-id "1 + 1;")
One thing I noticed here is that the function doc is incorrect because a result is returned.
And a follow-up question to the code above. It seems that the code would allow to pass the evaluated result back into Emacs Lisp but the code below (regardless of the string) always returns
nil
for me.Does it work for you?
(eaf-call-sync "execute_js_code" eaf--buffer-id "1 + 1;")
Sorry, typo, this issue fixed by patch https://github.com/emacs-eaf/emacs-application-framework/commit/62c54778138c67bb5ef599f1bf7c094f5c0ad812
Please upgrade again.
Works now!
What I have in mind is to run certain JavaScript in the browser on a key press.
I see that there is
(eaf-py-proxy-eval_js)
but it always prompts in the minibuffer, which is no option for me on a long script.(eaf-py-proxy-eval_js_file)
would work but I don't want the overhead associated with reading from a file.So what I have in mind is something like:
(eaf-py-proxy-eval-js-string "alert('foo')")
.In
buffer.py
I seeself.buffer_widget.eval_js(...)
but I don't see a way to directly access in Emacs.Is this possible?