termux-packages icon indicating copy to clipboard operation
termux-packages copied to clipboard

Need help about emacs-async

Open fornwall opened this issue 8 years ago • 9 comments

From @tumashu on November 22, 2017 8:12

Hello

I have faced a problem that "emacs-async package can not work well in termux's emacs.", https://github.com/jwiegley/emacs-async/issues/90#issuecomment-346260368 , and I can not verify this is a emacs-async's bug or termux-emacs's bug, so I wish the friends who have installed the emacs in termux to test the below code, and feed back its work status, thanks:

(require 'async)
(async-start
   ;; What to do in the child process
   (lambda ()
     (message "This is a test")
     (sleep-for 3)
     222)

   ;; What to do when it finishes
   (lambda (result)
     (message "Async process done, result should be 222: %s" result)))

Copied from original issue: termux/termux-app#488

fornwall avatar Dec 03 '17 12:12 fornwall

@tumashu Is this something you still need help with or is it solved?

fornwall avatar Dec 03 '17 14:12 fornwall

It is not solve at the moment, I have debug two days, but can not find the reason.

tumashu avatar Dec 03 '17 23:12 tumashu

Is it possible to remove some of the startup scripts emacs uses when starting default startup in Termux? Emacs is a tremendous tool, and it appears that emacs takes excessively long to startup. This inhibits its' use. Compare with vim on device, which is tremendous too.

SDRausty avatar Dec 04 '17 04:12 SDRausty

@tumashu could you provide some more info on how to reproduce the error (what is the actual error?).

I guess the emacs-async needs to be downloaded/cloned from github.com/jwiegley/emacs-async? Are you running the code with eval-buffer or in some other way?

Grimler91 avatar Dec 04 '17 06:12 Grimler91

@sdrausty that's a bit off-topic here. Might be better to ask in irc, or G+.

Grimler91 avatar Dec 04 '17 06:12 Grimler91

@Grimler91 Please see: https://github.com/jwiegley/emacs-async/issues/90

  1. Run emacs
  2. install emacs-async with: "package-install emacs-async"
  3. Run emacs with: "emacs -q"
  4. (package-initialize)
  5. (require 'emacs-async)
  6. do test

tumashu avatar Dec 04 '17 09:12 tumashu

This issue/PR has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Nov 18 '21 22:11 stale[bot]

Same issue here, maybe not the same problem. Strange error for me, I have this message :

error in process sentinel: async-handle-result: End of file during parsing

The error is always after a certain time : for me the subprocess isn't even started (I think).

Cletip avatar Dec 04 '23 09:12 Cletip

Until termux properly handles emacs-async, I just disabled asyncronous API. In my case, I'm using spacemacs and it checks the git hash asynchronously, which I don't think it's that critical. (git is fast for me.) So I put the following code under dotspacemacs/user-init function.

  (defun my/termux-p ()
    (not (null (getenv "TERMUX_VERSION"))))

  (defvar my/termux-p (my/termux-p))

  ;; Bug patch for Termux. `async-start' does not work properly in Termux. Let's
  ;; make the function synchronous.
  (if my/termux-p
      (with-eval-after-load 'async
        (defun async-start (start-func &optional finish-func)
          "Different from the original function, this function is synchronous."
          (let ((result (funcall start-func)))
            (when finish-func
              (funcall finish-func result))
            result))))

Seems like it's working for me. I can see a proper value in spacemacs-revision--last.

jaeyeom avatar Jun 28 '24 03:06 jaeyeom