emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re:Re: "Asynchronous Requests from Emacs Dynamic Modules"


From: Zhu Zihao
Subject: Re:Re: "Asynchronous Requests from Emacs Dynamic Modules"
Date: Fri, 20 Nov 2020 23:54:48 +0800 (CST)

Ok, But how to do this in Emacs version 25-27?

Emacs doesn't support named pipe access, but may be we can use `make-network-process` to open a TCP socket. Like this?

```
(let ((proc (make-network-process :name "fake-proxy-process"
                     :server t
                     :host 'local
                     :filter <filter-to-execute-callback>
                     :noquery t
                     ;; Detect port automatically
                     :service t)))
     (setq <global-proc-var> proc)
     (module-function-initialize-notify (process-contact proc :service)))
```

But this maybe too strange for user to understand why a dynamic module require a TCP port access...



At 2020-10-31 20:49:21, "Stefan Monnier" <monnier@iro.umontreal.ca> wrote: >> With Emacs 28, you can get a file descriptor to a pipe process and >> send arbitrary data there (from arbitrary threads). > >Cool, so that takes care of it. > >> You'd still need some small protocol (e.g. JSON) to encode/decode >> requests, but with that you can send arbitrary requests >> back asynchronously. > >I don't think you need a complex protocol: just stash somewhere (inside >the module data structures) the data you need for the async request, >then send a dummy byte to the pipe. On the Lisp side, just install >a process-filter which calls back the module to "run any pending async >requests". > > > Stefan >


 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]