index rss mastodon twitter github linkedin email
Álvaro Ramírez
sponsor

Álvaro Ramírez

24 July 2022 dwim-shell-command on Melpa

clone.webp

Figure 1: <<cb>> gets replaced by a clipboard (kill ring) URL

My pull request to add dwim-shell-command to melpa has been merged. Soon, you'll be able to install directly from Milkypostman’s Emacs Lisp Package Archive.

dwim-shell-command is another way to invoke shell commands from our beloved editor. Why a different way? It does lots of little things for you, removing friction you didn't realise you had. You can check out the README, but you'll appreciate it much more once you try it out.

In addition, it's enabled me to bring lots of command-line tools into my Emacs config and make them highly accessible. You can see my usages over at dwim-shell-command-commands.el.

What kind of command-line tools? ffmpeg, convert, gifsycle, atool, qdpf, plutil, qrencode, du, sips, iconutil, and git (so far anyway). Below is a simple example, but would love to hear how you get to use it.

(defun dwim-shell-command-audio-to-mp3 ()
  "Convert all marked audio to mp3(s)."
  (interactive)
  (dwim-shell-command-on-marked-files
   "Convert to mp3"
   "ffmpeg -stats -n -i '<<f>>' -acodec libmp3lame '<<fne>>.mp3'"
   :utils "ffmpeg"))

I've written about dwim-shell-command before:

Irreal's also covered it: