Questions tagged [shell-command]

is for executing shell commands from Emacs (the default key binding is `M-!`). Shell output is shown in the echo area if it fits, in buffer `*Shell Command Output*` otherwise. Emacs comes with many supporting facilities for executing shell commands, including interactive execution, selective execution on a region, history cycling, directory tracking, connecting to serial ports, emulator options, and specifying remote hosts.

20 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4
votes
2answers
943 views

Using `emacsclient` as `git config core.editor` and invoking `git commit` as `shell-command` in Emacs?

I am trying to use Emacs 25.1.1 (graphical version, Windows 10) as both the primary editor and the editor for git operations. In my workflow, I invoke git through M-x shell-command. I tried the ...
3
votes
0answers
281 views

Shutting down computer from emacs killing gracefully emacs itself

I am using EXWM on Arch as my windows manager. Substantially my startx launches exec dbus-launch --exit-with-session emacs so I am running only emacs and living inside it. I would like to define a ...
3
votes
1answer
219 views

Define the window location of the output of shell command

I use M-! to run the command shell-command. The output will open the buffer in a new window at the bottom. Can I configure it to appear on the right?
3
votes
0answers
520 views

Emacs on Windows: `shell-command` hangs when process wants input

I am using Emacs on Windows 8. Some processes when run through shell-command will request interactive input, notably commands like git push (which will ask for user name and password). Sometimes I ...
2
votes
0answers
15 views

Exec a external shell command that have external read input - ex:cookiecutter

As the examble like cookicutter, it have a read input in itself that we must type if we use it in normal terminal. $> #comment: this is normal terminal emulator $> cookiecutter $HOME/...
1
vote
1answer
61 views

Print shell-command output to STDOUT?

Is there an equivalent of C's system(char*) or Python's os.system(string) for emacs --script? I want to use Emacs for shell-scripting purposes. However, I cannot find a function that allows running an ...
1
vote
0answers
34 views

Allow user to interact with subprocess

I would like to call a subprocess, and that subprocess has some interactive behavior. Thus, I would emacs to parse the output of the subprocess, ask the user for input, and then hand that input back ...
1
vote
0answers
46 views

In emacs term-mode (not shell-mode), how can we edit a command just like we type C-x C-e in real terminal

In real terminal, if we type C-x C-e, we can edit a typed command using an editor. Could have similar function in emacs term-mode? After typing a shortcut, I would like to edit the current command ...
1
vote
1answer
185 views

Run custom bash functions with M-!

I have a few custom bash functions that are defined is some file and are made available to me in regular terminals via the line . "/path/Custom Bash Functions.sh" in my ~/.bashrc. However, Emacs ...
1
vote
0answers
101 views

Problem execution scope org-babel in shell on windows 8

I just discovered that in order to run a sequence of shell commands under the same scope (same shell session) I have to add a hash at the end of the line. Example When I try to run the following ...
1
vote
0answers
72 views

Display dropbox status

I would like my emacs to call dropbox status every 30 seconds and display whether Dropbox is up-to-date at the bottom of the buffer (where info such as the line-number and file name is). How could ...
1
vote
0answers
45 views

How can I pass an argument (via highlighting) to a shell command while also passing the filename as an argument?

Im attempting to run a perl script on a buffer which will rearrange/edit the contents. I want to highlight a string and let that be my input as well as the buffer or file. Currently I can come close. ...
0
votes
1answer
38 views

Prompt for stdin via `shell-command`

Sometimes when I copy+paste into my spacemacs over SSH, I get some random garbage that seems to be due to spacemacs interpreting some of the pasted content as commands. In vim, my workaround is to run ...
0
votes
1answer
40 views

Display Δ in the *Shell Command Output* Buffer

I have a shell command I'm running from Emacs that has a Δ character in its output. How can I configure the *Shell Command Output* buffer to display UTF-8 by default? edit: There could also be ...
0
votes
0answers
52 views

Execute a command from a buffer

Say, you create a new buffer (Fundamental), type a shell command and want it executed. Like you can do in a *scratch* buffer with lisp code (C-x C-e). Or you have a text file, that has text ...
0
votes
0answers
17 views

reference mutltiple selections or registers for shell-command-on-region

C-u M-| is wonderful for things like running sort a region. But I've wandered into an interesting place. I wan to run join or comm on two regions in a buffer. # region 1 a 1 b 2 z 26 # region 2 a ...
0
votes
2answers
56 views

How can I do a regex search recursively from a directory?

Basically I want a command that can do the following: find /path/dir -type f -print0 | xargs -0 grep -l "foo" Is there an emacs command to do this? If not, then is there a convenient keybinding that ...
0
votes
1answer
181 views

Emacs / Projectile complains about no job control with Bash/terminal

I use Emacs 27.0.50 on Ubuntu 18.04. Fish is my default shell. When a file from a directory with .git is being loaded into the buffer, I'm trying to start projectile-find-file , I see the following ...
0
votes
1answer
98 views

Best way to test output sent to a buffer

I'm writing an emacs package for Pipenv and the spike solution uses sync shell calls, which is not desirable for general usage. I'm now changing calls to be async (make-process) and for output to go ...
0
votes
1answer
213 views

Pulseaudio and `shell-command` calls in Emacs

I'm trying to execute shell-commands in emacs which play sounds or otherwise involve audio output, but I'm not having much luck. When I execute: (shell-command (concat "espeak -v mb-en1 -k5 -s150 " ...