Giter Club home page Giter Club logo

async-shell's Introduction

async-shell.el - Manage Shell Commands with Buffers

This package allows running a shell command in a buffer and provides conveniences for creating and managing these buffers. This is essentially an alternative to the built in compile command.

(Sorry about the dithering in the screenshots. It’s something that Github is doing and I’m not totally sure why.)

Screenshots

async-launch-shell starts a new buffer with a command read from the minibuffer.

pictures/launch-command.gif

Once you have an async-shell buffer, you can rerun the command by calling revert-buffer.

Pinning a line number (<async-shell-menu> p): When working on code, I often find it useful to pin the output to a certain line, so that I don’t have to scroll and find a particular location every time I rerun a command.

pictures/pin-lineno.gif

Re-run on save (<async-shell-menu> r): Enabling Reload on save will re-run the command in that buffer every time a file is saved. I find this incredibly useful for debugging code.

pictures/reload-on-save.gif

Org Babel

You can also create async-shell buffers from org-babel.

#+begin_src async-shell :name gif :results silent
name="babel"
ffmpeg -y -i ~/Desktop/$name.mov \
       -pix_fmt rgb24 -r 10 \
       pictures/$name.gif

gifsicle -O3 pictures/$name.gif -o pictures/$name.gif
#+end_src

pictures/babel.gif

This is useful for keeping track of and executing complex commands that you need to execute for different projects. Many of my projects contain an org-file where I can write down different commands I execute on a regular basis and add documentation explaining what they do. This means that I never have to search back through my command history to find a particular command, and makes editing commands trivial.

Additionally, async-shell babel blocks support specifying tramp directories. If I wanted to run the above command on some server, I could write:

#+begin_src async-shell :name gif :results silent :dir /ssh:[email protected]:some/path
name="reload-on-save"
ffmpeg -y -i ~/Desktop/$name.mov \
       -pix_fmt rgb8 -r 10 \
       pictures/$name.gif

gifsicle -O3 pictures/$name.gif -o pictures/$name.gif
#+end_src

org-babel configuration

To support async-shell blocks, all you need to do is add (async-shell . t) to your =’org-babel-load-languages=.

(org-babel-do-load-languages
 'org-babel-load-languages
 '((async-shell . t)
   ...))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.