Improved "open with" suggestions for dired mode in Emacs
Emacs Lisp
Switch branches/tags
Nothing to show
Clone or download
Pull request Compare This branch is 20 commits behind thamer:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

This library links a set of shell commands to file or directory names. These commands can then be used in dired mode using dired-do-shell-command (by pressing “!”). Since this library modifies the behavior of dired-guess-shell-alist-user, the command syntax will follow that variable’s syntax (see the documentation of dired-guess-shell-alist-user for more).


  • Provides a widget.el interface to add, edit, and sort shell commands.
  • Gets rid of the “A command is running - kill it? Yes or No?” message.
  • If runner-run-in-background is set to t, send the stdout buffer to the background except when the command string includes “{run:out}”.
  • If the command string contains “{run:shell}”, run the command using the function specified in runner-shell-function.


Put this file in your Emacs-Lisp load path, and add the following into your $HOME/.emacs startup file.

(require 'runner)

The functions dired-guess-default (from dired-x.el) and dired-run-shell-command (from dired-aux.el) will be redefined.


While in dired mode, position point on any file or directory you wish to add a shell command to, then do:

M-x runner-add-file (for file or directory names)
M-x runner-add-extension (for file extension)

A new buffer will be created allowing you to specify what commands to run.

A file name or extension can be linked to multiple set of commands. You can view and edit which pattern is being applied to a file by positioning point on a file and running,

M-x runner-edit-file-at-point

You can also add, edit, or delete any specific pattern by doing:

M-x runner-add-empty
M-x runner-edit
M-x runner-delete

The command database will be saved to the variable runner-init-file (default is “~/.emacs.d/runner-conf.el”). You may choose a different location by doing:

M-x customize-variable runner-init-file


Oftentimes I have complicated commands that rely on the base name of a file (sans extension) being available. I wrote the following bash script and called it run-f.

# Return the base file name sans extension. If more than one file is
# passed, just return the first one.
for file in "$@"
    echo "$FILESANSEXT"

Now I can easily pass multiple commands from runner.el. For instance, the following command creates a text file from a scanned PDF using ocrodjvu:

{run:out} pdf2djvu -o "$(run-f ? ).djvu" ? && ocrodjvu -o "$(run-f ? )_ocr.djvu" "$(run-f ? ).djvu" && djvutxt "$(run-f ? )_ocr.djvu" "$(run-f ? ).txt" &