Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I know there is xdg-open, but it does not run in the background. It is not as easy as appending & at the end when calling this command from emacs.

I often use ! then open in emacs dired, or C-! and then open filename for emacs shell-command. Is there another command which will allow me to continue using emacs while this file (often a pdf) is open?

share|improve this question
I'm surprised that you say that xdg-open doesn't run in the background, because for me it does. I don't know anything about emacs, but I've tested this in both bash and in vi. Can you give an example of what kind of file you're trying to open? – Timo Kluck Aug 10 '12 at 12:06
An example is just a pdf file, and I type ! then xdg-open from dired-mode in Emacs (dired-mode isn't a command-line tool). Emacs will not allow me to proceed unless I close the document viewer... – crippledlambda Aug 10 '12 at 13:41

I don't know anything about xdg-open, but I do know something about Emacs. Does async-shell-command not work for you? If not, one of the low-level Emacs async commands should definitely do the trick. See for info on that.

If you can't get those to work, lemme know; if start-process can't do it for you, there is a bug in Emacs (or xdg-open is a seriously weird command!)

share|improve this answer
Is there a way to specify dired-mode to run programs asynchronously? I do program in emacs lisp but for this it is not a programming application - only want to invoke a few programs from dired-mode or mini-buffer. – crippledlambda Aug 10 '12 at 13:42
There isn't a setting for this, unfortunately. C-x h f dired-run-shell-command, and find the location in dired-aux.el. It should be a ~5 line function; copy and paste this command into your .emacs and replace (shell-command command) with (async-shell-command command). – Christopher Monsanto Aug 12 '12 at 2:22
(or use advice and flet shell-command async-shell-command) – Christopher Monsanto Aug 12 '12 at 2:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.