Questions relating to commands for passing single command lines to shell sub-processes, running a shell interactively with input and output to an Emacs buffer, and for running a shell in a terminal emulator window.
Questions tagged [shell]
369 questions
6
votes
1 answer
Unwanted escape sequences in shell mode
Post title: Unwanted escape sequences in shell mode that are NOT due to colorizing-attempts
(see update below)
Any idea what can cause (unwanted) escape sequences to continue showing up in the Emacs shell prompt (i.e., M-x shell) despite:
(i)…

iceman
- 1,088
- 1
- 9
- 20
6
votes
3 answers
The elisp function to run the shell command in specific file path
Personally I need run many shell command in emacs, I find it is not convenient to run a shell engine (eshell) or using it separately (bash), so is there a elisp function (local provide by emacs or any other third-part library) meet my need?

ccd
- 259
- 2
- 11
5
votes
1 answer
How to discard stderr when running a shell function?
If I run
(setq some-variable (shell-command-to-string some-command))
...and the execution of the command in some-command results in some output sent to stderr, this stderr output ends up in some-variable.
How can I discard the stderr output, so…

kjo
- 3,247
- 17
- 48
4
votes
3 answers
How to run interactive bash command from Emacs?
I have a command my_cmd that is aliased to another command in my ~/.bashrc. From Perl and Python, I can run this command as bash -ic "my_cmd" (this also works from the terminal window, but here it is not necessary, and I can simply type my_cmd since…

Håkon Hægland
- 3,648
- 1
- 22
- 51
4
votes
2 answers
Execute current line in shell
I often find myself copying commands line by line from an emacs buffer to my terminal.
How do i bind a shortcut which sends the current line/selection in emacs to my gnome-terminal?

Juliusz
- 141
- 3
3
votes
1 answer
Chronos cannot speak French
I changed chronos-text-to-speech-notify acording to https://github.com/dxknight/chronos/issues/2.
My Chronos config includes this:
(setq chronos-text-to-speech-program-parameters "-s 50 -k 1 -a 50 -v mb/mb-fr1" ).
The command…

gigiair
- 2,166
- 1
- 9
- 15
3
votes
1 answer
Need emacs lisp function to execute command in *shell* buffer
How to write a function (it would go into .emacs) that sends some command to shell buffer (and initializes shell if needed)?
Something like:
(defun ()
(interactive)
(shell)
(sh-send-text "ssh my.server.com"))
(I currently do this via tramp…

Paul
- 191
- 7
2
votes
1 answer
Fixed length buffer for shell
I launch a shell in my session with M-x shell and then I launch a python script that produces a lot of output to stdout---so many lines of output that my emacs session beomes quite slow.
Is there a command I can run to ask my buffer to be fixed…

Mittenchops
- 329
- 1
- 9
2
votes
1 answer
M-x shell's M-r doesn't search bash_history
All,
When I in the emacs shell (run by M-x shell) and press M-r, it only search a very limited command history and doesn't search the bash_history file. But it is said Emacs shell will read my bash's history file to initialize it's history…

zwy
- 141
- 11
2
votes
3 answers
How to execute a shell script inside of emacs?
I simply want to execute the whole file I am editing right now in a small shell buffer just like I can run my python script.
How can I do this?

tbrodbeck
- 189
- 1
- 10
2
votes
1 answer
How to open several shell buffers and rename them respectively?
I try to solve the problem like this in test.el:
(shell)
(rename-buffer "name1")
(shell)
(rename-buffer "name2")
(shell)
(rename-buffer "name3")
However, when I use (eval-buffer) to execute, it seems that the program stops at the 4th line and…

ChangXiaoduan
- 23
- 2
2
votes
1 answer
Emacs shell does not work
I have problem starting shell in Emacs.
When I do "M-x shell", this error message come up in shell buffer:
no sessions
open terminal failed: terminal does not support clear
Process shell finished
So please help.
My Emacs version is 25.2.2 on…

ذوالفقار عبد الحليم
- 51
- 3
2
votes
1 answer
How to check if emacs shell buffer busy or not?
If I start a long-running process in an emacs shell create by (shell), the shell will be busy for a while. How can I detect that programmatically (i.e., using elisp)?
I tried: get the process by (get-process "shell") and test (process-live-p proc),…

AhLeung
- 1,083
- 5
- 14
2
votes
1 answer
how to print $HISTFILE?
I'm trying to print the path of $HISTFILE in emacs, but it doesn't work with (getenv "HISTFILE") or (shell-command-to-string "echo $HISTFILE"). It is working with $PATH and every other variable I've tried.

bertfred
- 1,729
- 1
- 12
- 24
2
votes
2 answers
What is the proper way to pass variable strings to `shell-command-to-string`?
I have a shell script
$ cat ~/foo.sh
#!/bin/bash
echo $1 $2
I'm trying to call this from emacs. My elisp function is
(defun foo (word1 word2)
"Print these two words."
(interactive
(list
(read-string "Enter first word: ")
…

Brian Fitzpatrick
- 2,325
- 1
- 20
- 42