4 ms·
The good thing is that the source is always right there and you can read it or set breakpoints and step through it to see how things work. > how to handle asyn
by alex_smart 5y ago
The good thing is that the source is always right there and you can read it or set breakpoints and step through it to see how things work.
> how to handle async code (e.g. how magit runs a command, and then refreshes the buffer after it completes)
Emacs's primary mechanism for async code is: spawning an asynchronous process and interacting with them using a process filter/sentinel. This allows you to do things like detect when that process has emitted a certain output or signal and run some code based on that.
For example, magit user the process-sentinel for a pull/fetch command to call (magit-refresh) to refresh the buffer. (How to fish: I guessed that magit-refresh was probably the function refreshing the buffers, set a breakpoint in it, and voila now I have the entire stackframe.)
Relevant pages from info: "(elisp) Filter Functions", "(elisp) Sentinels".