Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Improved "open with" suggestions for dired mode in Emacs
Emacs Lisp
Latest commit f598393 @thamer quotes
Failed to load latest commit information. quotes
runner.el save key changed to C-c C-v to avoid custom.el


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-do-shell-command 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 command string contains “{run:out}”, then keep output in a specially named buffer.
  • If command string contains “{run:shell}”, then run command using the function specified in runner-shell-function.
  • When runner-run-in-background is set to t, send the stdout buffer to the background except when the command string includes “{run:out}”.
  • If runner-show-label is set to t, display a label next to each command.
  • For other options, see M-x customize-group runner.


Using Melpa:

M-x package-install RET runner RET

For manual installation, put runner.el in your Emacs-Lisp load path, and add this into your init 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 file 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

See also

  • Unify-opening.el: make packages in Emacs use the same mechanism to open files.


For shell commands that rely on the base name of a file (sans extension) being available, the following bash script (saved as run-f) can be useful:

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

For example, this 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" &
Something went wrong with that request. Please try again.