@alvaro
sign in ยท lmno.lol

Emacs: ffmpeg and macOS aliasing commands

On a recent mastodon post, Chris Spackman mentioned he uses Emacs to save ffmpeg commands he's figured out for later usage. Emacs is great for this kind of thing. I've tried different approaches over time and eventually landed on dwim-shell-command, a small package I wrote. Like Chris, I also wanted a way to invoke magical incantations of known shell commands without having to remember all the details.

Chris's post reminded me of a few use-cases I'd been meaning to add DWIM shell commands for.

ffmpeg

  1. Trimming seconds from videos
  2. Extracting audio from videos

With these new dwim shell commands added, I can easily apply them one after the other. No need to remember command details.

macOS aliases

After rebuilding Emacs via the wonderful emacs-plus, I recently broke my existing /Applications/Emacs.app alias. No biggie, one can easily add a new one alias from macOS Finder, but I've been wanting to do it from Emacs. Turns out there's a bit of AppleScript we can turn into a more memorale command like dwim-shell-commands-macos-make-finder-alias:

osascript -e 'tell application \"Finder\" to make alias file to POSIX file \"<<f>>\" at POSIX file \"%s\"'

It's highly unlikely I'll remember the AppleScript snippet (are there better ways?), but I'll easily find and invoke my new command with fuzzy searching:

Included in dwim-shell-command

All of these are now included in dwim-shell-commands.el, which you can optionally load after installing dwim-shell-command from MELPA.