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.

Filter by
Sorted by
Tagged with
2
votes
1answer
135 views

Using replace-regexp with a shell command

I'm trying to format some text that matches a regexp using an external shell command. I've been able to use C-u M-| successfully on a region, but I can't figure out how to do that within replace-...
1
vote
1answer
350 views

Repeat last shell command shortcut

How can you repeat last shell command with a single shortcut (and no y/n prompts)? How to replace this sequence: C-u C-x s (or equivalent) to save all buffers M-! for (shell-command COMMAND &...
2
votes
2answers
313 views

Make shell-command / async-shell-command respect carriage return?

Say I have a simple perl program: for my $i (0..10) { print "$i\r" } print "\n" Now if I run the program through shell-command, instead of getting a single line with 10, I will see the ...
5
votes
1answer
1k views

Executing commands through shell-command (what is the PATH used)?

If I do: (getenv "PATH") I get a list of colon-separated directories, including: /Users/michaeln/Library/Haskell/bin If I look at the exec-path variable, I see a list including the same ...
8
votes
2answers
963 views

Applying a timeout on call-process/shell-command?

In some cases, when delegating work to an external process, it's useful to set a timeout on the command to prevent Emacs from hanging indefinitely. Unfortunately, the following does not work. (with-...
1
vote
1answer
85 views

Why does shell command output sometimes get inserted into an existing buffer?

If I do a M-! to run a shell command, usually any output will appear in a new, temporary buffer. But sometimes, seemingly at random, the output will instead be inserted directly into the active buffer....
14
votes
3answers
3k views

Persistent shell-command history

When I run shell-command in a new session I do not have access to the history of commands from the last session. How can I have that?
1
vote
2answers
933 views

Run (async-)shell-command in view-mode

How do I run (async-)shell-command (but no other shell-mode buffers) in view-mode?
1
vote
1answer
139 views

How to use Emacs to open an eshell from Terminal at a specific path

By default, if I invoke emacs from terminal by typing $ emacs C:\users a directory-like environment opens. Then if I do M-x eshell, an eshell environment opens at this path. My question is how to ...
2
votes
1answer
360 views

call-process and Hunspell (in Emacs 24.4)

I am having problems running ezwinports Hunspell 1.3.2-3 in Emacs 24.4.1 for Windows. When calling ispell-buffer with debug, I see the following functions are called. ispell-buffer -> ispell-...
4
votes
1answer
1k views

Can't run Python shell in Emacs 24.4 due to a space in the path

When I try to start a Python shell in Emacs 24.4.1 running on Windows, I get an error "invalid argument" when Emacs tries to spawn the process. This is occurring because Python is installed under c:\...
13
votes
1answer
4k views

Execute external script upon save when in a certain mode?

When I'm in org-mode, I want Emacs to execute a bash script I wrote whenever I hit C-x s to save. The script automatically syncs the file I am saving to my Raspberry Pi. It expects the file name as ...
0
votes
1answer
226 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 " ...
7
votes
1answer
623 views

How can I add default shell commands for various file types?

When I use ! on a *.tar.bz2 file in Dired, I'm presented with the following prompt: ! on WANem_3.0_Beta2.tar.bz2: {3 guesses} [bunzip2 -c * | tar xvf -] -!- How can I add similar functionality for ...
15
votes
2answers
31k views

“cannot set terminal process group” error when running bash script

I have the following two lines of code in my init.el file: (setq shell-file-name "bash") (setq shell-command-switch "-ic") I tried executing the following script to get a list of executables using ...
10
votes
2answers
1k views

Run ssh-add from Emacs and enter a passphrase

I want to call the ssh-add shell command. So I invoke M-x shell-command RET, and in the minibuffer, I type: ssh-add .ssh/id_rsa The only thing I get is: ssh_askpass: exec(/usr/bin/ssh-askpass): No ...

1 2
3