0

When I run M-! enter shell command enter in org mode, I expect the output to be inserted into the buffer I have active.

Instead, emacs opens a second buffer (splitting the window in two) and inserts the output there. How can I make it insert the result in the buffer I am working?

4

This is the normal behaviour for shell-command.

If you want the output inserted into the current buffer, you must supply an argument (like C-u M-!).

3

You can do that by typing C-u M-! command RET. Checking the help on M-! explains why it works.

M-! runs the command shell-command, which is an interactive compiled
Lisp function in `simple.el'.

It is bound to s-L, M-!, <menu-bar> <tools> <shell>.

(shell-command COMMAND &optional OUTPUT-BUFFER ERROR-BUFFER)

Execute string COMMAND in inferior shell; display output, if any.
With prefix argument, insert the COMMAND's output at point.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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