Questions tagged [shell]
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.
308
questions
1
vote
1answer
77 views
How to make emacs shell the same as system terminal experience?
On macOS, using iTerm2. It looks like
In Emacs For Mac OS X, it looks like
I copied system's ~/.zshrc file to ~/.profile and ~/.bash_profile, but doesn't they read configrations when start emacs?
0
votes
0answers
16 views
How to use doom emacs as a golang ide quickly?
I installed the newest doom emacs on macOS. Also configed language packages as
$ emacs ~/.doom.d/init.el
:lang
(go +lsp)
:tools
lsp
$ ~/.emacs.d/bin/doom sync
When I open a .go file, the code became ...
0
votes
1answer
12 views
Launch an external command prompt (cmd.exe) in a specific folder
I'm trying to build a cmd interactive function in Emacs, which would open a Windows command prompt - exactly like Win+R cmd does. Within Emacs, it would be accessible with M-x cmd, and it would open ...
0
votes
2answers
87 views
How to pass arguments to a shell script using `make-process` function?
Consider a script file: ~/project/script.sh
echo "arg 1 $1"
echo "arg 2 $2"
echo "arg 3 $3"
And elisp file that invokes it using make-process: ~/project/special-mode/special-mode.el
(let* ((...
0
votes
1answer
24 views
Repeating characters in `python-mode.el` shell interaction
I experience strange behaviour when using python-mode. When sending characters to the shell using C-c C-e, the first string works well. After that, the characters start repeating, in a manner that is ...
5
votes
2answers
995 views
Can emacs commands be called from a shell script?
I have a directory ~/foo that contains several org files. I'd like to use htmlize to convert each org file into an html file. Ideally this would be done with a shell script. Is there a way to make a ...
0
votes
0answers
28 views
Unexpected local shell in TRAMP mode
I have a clear installation of spacemacs with layer shell on.
I open remote dir SPC f f ssh:<host>:<path>
I open shell SPC '
Shell is local (I expect it to be opened on the remote host)
4
votes
4answers
2k views
Send region to shell in another buffer
Is this possible with stock emacs:
I'm editing a .txt file that has a snippet of bash code
When I do C-x b RET I can switch to a preopened M-x shell buffer named guesuser@...
0
votes
1answer
84 views
How to show colours and clear when running React development server in eshell?
Here is how the usual Ubuntu terminal looks when you run the React development serving using npm start and make changes to your source:
Say the server was already running and you tried to do npm ...
0
votes
0answers
52 views
How do I make compilation use vterm instead of the default shell it is using?
I am running M-x compile commands in my Projectile projects. I would like to use vterm for running them as the compilations are getting very slow because the project is very large.
How do I make ...
0
votes
1answer
44 views
How to send keyboard interrupt to running program in shell mode?
I wish to achieve what a C-c (send a keyboardinterrupt) would do in a terminal outside of Emacs. How do I do that in Emacs shell mode?
0
votes
1answer
27 views
Emacs unable to execute shell commands despite them being in the Emacs shell PATH
I am on Ubuntu. I'm trying to run the latex command to run in the Emacs shell. I have done some research, and have already done the following:
I noticed that running env in the Emacs shell gave a ...
0
votes
2answers
754 views
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?
0
votes
1answer
56 views
Starting a shell then cd to a specific directory
I want to go to a specific directory after I start a shell. So I put these lines in my .emacs file:
(shell)
(shell-command "cd C:/MyStartUp/ThisDirectory")
(setq default-directory "C:/...
4
votes
4answers
2k views
fix or workaround: “Terminal is not fully functional”
What can I do about this issue? I'm using
psql, inside a ssh tunnel to ubuntu, inside a M-x shell, inside a emacsclient -nw
1
vote
1answer
39 views
What is causing Emacs remote shell to be slow on completion?
So basically I am doing the following:
Opening a dired buffer with tramp on a remote.
Opening a shell on the remote (M-x shell)
Then if I try for example to type any command such as ls -la the ...
0
votes
2answers
28 views
How to not let a shell to capture the space key in Spacemacs?
In spacemacs, the space key is used to trigger the command shortcut, and an extra space can lead to a input/search of emacs command.
Now I run into this situation:
I use SPC b n to switch to next ...
0
votes
0answers
19 views
How to run shell command in function and intercept standard output
Tell me how to use the trans command of the trans-shell package for
translation. I need to write a function that will intercept the output
translated text.
1
vote
2answers
156 views
Break (C-c C-c) in ESS-remote R shell
I am running my R scripts on a remote shell using
M-x shell
ssh -X -C name@server.edu
srun -p nodeX --pty R (slurm command to start R)
M-x ess-remote and select 'R'
everythink works fine, until I ...
8
votes
2answers
991 views
Print process output line by line
Read process output line by line gives some partial ideas about how to deal with sub-process output in an intelligent manner, but no example and no working solution. I have a couple of examples, one ...
2
votes
1answer
640 views
Prevent bash-completion adding an extra space when the word is incomplete
When using Emacs shell with the auto-completion feature enabled, I notice that whenever I perform typing and auto-completing a command, Emacs shell always adds an extra space after the first word. I ...
1
vote
2answers
194 views
how can I run conda in emacs shell?
I've been using Python command 'conda' in the terminal on my Mac. But when I run a command like 'conda activate ...' in Emacs's shell (M-x shell), it gives me this objection:
CommandNotFoundError: ...
0
votes
0answers
34 views
emacs opens py file as sh file
Emacs has opened a py file as a shell script. What went wrong and how to change?
0
votes
1answer
29 views
always prompt for default directory when opening interactive subshell
When I invoke C-u M-x shell while visiting a local file or scratch buffer, emacs does not prompt me to enter the default directory for the shell.
But if I'm visiting a remote file or directory ...
1
vote
1answer
215 views
How to mount/unmount devices?
I'm interested in mount/umount usb and other devices directly from emacs.
In many file mangers (like nautilus) the devices are automatically discovered and indicated with an icon, it's possible to do ...
1
vote
1answer
198 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 ...
0
votes
1answer
24 views
How can I move the cursor from a shell window to another window in Evil mode?
Imagine I have following four windows in Emacs:
Window 1 is a shell window (M-x shell). Windows 2, 3, and 4 are normal windows with files open. Evil mode is enabled.
If I am the shell window, how can ...
0
votes
1answer
230 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 ...
6
votes
2answers
517 views
Discard stderr in start-process
I'm using start-process to run mplayer and when playing videos I get a ton of output to stderr from "vdp_...". On the command line I usually just 2>/dev/null but start-process runs it directly without ...
2
votes
1answer
131 views
Run an external shell command to mutate text
I would like to run par or fmt to format my .md file.
In vim this would be %!fmt (for the whole buffer) or 13,16!fmt (for line 13 - line 16).
What's the "emacs way" to achieve something like ...
0
votes
1answer
57 views
How to print colorful and bold string in the mini-buffer
When I do echo "\033[1;31mThis is bold red text\033[0m" it should print This is bold red text as red and bold. When I try it in the emacs's shell it prints it as it is instead showing the ...
0
votes
0answers
61 views
Emacs gives `stty: 'standard input': Inappropriate ioctl for device` in ZSH shell
I am running emacs inside ZSH shell. I have current lines in .zshrc file, which I believe affects the emacs behavior it is using shell within:
stty eof undef
stty sane && stty erase "^H&...
3
votes
0answers
501 views
Can't run Windows 10 Bash with ansi-term
I've got this error, when running M-x ansi-term C:/Windows/System32/bash.exe RET
Spawning child process: invalid argument
after running M-x debug-on-entry RET start-process RET when running M-x ansi-...
0
votes
1answer
31 views
Run latexmk inside z shell instead of shell
Problem
I am using latexkm to compile .tex documents, and recently I got this error while compiling:
Running `latexmk' on `AF2021_serie5' with ``latexmk -bibtex-cond -pdf -synctex=1 AF2021_serie5''
Rc ...
1
vote
0answers
29 views
Can desktop sessions be used to save and restore shell buffers?
Is it possible to use desktop-save-mode to save and partially restore my shell buffers? I realize shell buffers have quite a bit of state that isn't under the direct control of emacs, so specifically ...
1
vote
1answer
36 views
Elisp - Changing directory in shell buffer
I want to open an instance of a terminal emulator (in my case term) and go to a specific directory, all with a single Elisp function. My idea was to send a specific string programmatically to the ...
0
votes
0answers
27 views
/bin/top not found in eshell over ssh
How does eshell resolve its PATH?
If I run my top in eshell on my local machine, it opens a new buffer and shows the output of the command in it. However, if I do the same on an eshell run on a remote ...
41
votes
4answers
8k views
Weird shell output when using IPython 5
I just upgraded to the latest version of IPython and now something is wrong when using it in emacs.
When using it in a regular terminal it works fine (colors, tab-completion, etc.), however either ...
0
votes
0answers
25 views
Dealing with unwanted output
If you used shell-mode for a while, you probably ran into situation where there's a process spitting lots of output very fast, so that C-g and C-c C-c don't really help.
One way I found to be somewhat ...
1
vote
1answer
31 views
Can I format the arguments in a table and provide the rows to a shell block as arguments?
In org-mode, is possible to provide arguments formatted as a table to a shell block?
E.g.
argument
|a|b|
|c|d|
shell script
echo $a
expected results
a b
c d
Basically, I want org-mode to read the ...
1
vote
2answers
272 views
How to evaluate the selection through Python and replace the selection with it's result?
Being more familiar with Python then elisp, I'd like to evaluate the selection as as Python snipped - as a short-cut to opening a calculator or Python prompt and copy-pasting between them.
Is there a ...
1
vote
0answers
59 views
org-babel: zsh sessions use bash
#+BEGIN_SRC zsh :session z1
echo $HOME $0
#+END_SRC
#+RESULTS:
: /Users/evar /bin/bash
I am thinking of trying the workaround outlined here, but shouldn't this work out of the box?
Update: I couldn'...
4
votes
1answer
136 views
Org Src Block does not return any output
TL;DR: How do I get the stderr of my source block to be part of the #+RESULTS block, without changing the contents of the block? I can only get stdout to appear.
[Long and winding explanation]
While ...
0
votes
0answers
22 views
Emacs PNG as a text showing freezes
I am trying to see image as a text but when I compile this program in Emacs it freezes.
Is the problem in Emacs when showing images as text? My Python code is right below.
import requests as req
...
0
votes
0answers
45 views
How to get rvm to work with projectile-compile-project and shell-command (Emacs macOS GUI)
I'm using the exec-path-from-shell package to copy my environment variables, including PATH. But shell-command (M-! which ruby RET) only finds the system ruby, not my user-local rvm ruby.
Similarly, ...
0
votes
0answers
35 views
is there a way to make compile shell process happen in eshell / “real” shell?
i wanted to bind a key to a compile and run command, then i found this post, Compile and run single file c++ programs in Emacs[SOLVED]
( last answer)
It works perfectly fine and as intended.
The only ...
2
votes
1answer
26 views
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 ...
1
vote
1answer
85 views
Process shell exited abnormally with code 53 on windows 10
I'm using emacs 26.2 installed through msys2.
Recently starting subprocesses from emacs has stopped working for me. Specifically M-x shell and shell-command-to-string.
I get the feeling this is due to ...
1
vote
1answer
87 views
M-x compile hangs with WARNING: terminal is not fully functional
I have been using M-x compile for ages. Lately (our sysadmin has updated many things) it hangs after giving this message: WARNING: terminal is not fully functional - (press RETURN). Pressing return ...
0
votes
0answers
106 views
Python : name '__file__' is not defined
So as you can see, in my terminal, I was able to execute the file without error, but once I tried from the python shell, whether in the terminal or the one integrated in Emacs, there is an error, it ...