9 lines
1.7 KiB
Plaintext
9 lines
1.7 KiB
Plaintext
<p>Nacho Barrientos has an interesting video in which he explains <a href="https://www.youtube.com/watch?v=wbG-a8DIIuY">how to run an eshell process in the background</a>. Barrientos illustrates this with the <code>sleep</code> command. Normally, if you enter</p>
|
||
<div class="org-src-container">
|
||
<pre class="src src-shell">sleep 4
|
||
</pre>
|
||
</div>
|
||
<p>in Eshell, Emacs will hang until <code>sleep</code> completes in 4 seconds. Barrientos’ idea is to use the Emacs <code>compile</code> mechanism to run the command in the background. The output is redirected to the <code>*compile*</code> buffer and the Eshell prompt returns immediately.</p>
|
||
<p>That’s a nice way of starting a long running process from Eshell and being able to continue working in Emacs. He also has a way of burying the <code>*compile*</code> buffer and getting a message when the process completes.</p>
|
||
<p>There’s not a lot of code needed to implement this. You can see the relevant function in <a href="https://github.com/nbarrientos/dotfiles/blob/c79ef0f9908844346a8506129dedbb94f3b6b678/.emacs.d/init.el#L767">Barrientos’ init.el</a>. If you use Eshell regularly and sometimes want to invoke long-running processes, it’s worth taking a look at this video. The run time is only 4 minutes, 21 seconds so it should be easy to fit it in</p>
|
||
<p><b>UPDATE</b> <span class="timestamp-wrapper"><span class="timestamp">[2021-12-31 Fri 13:03]</span></span>: In the comments, Niklas Eklund writes that he has a package that does the same sort of thing. You can read his post about it <a href="https://niklaseklund.gitlab.io/blog/posts/dtache_eshell/">here</a>. Elkund’s package works with any shell so it may be a worthwhile addition to your configuration.</p> |