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.

Filter by
Sorted by
Tagged with
0
votes
0answers
26 views

How can I tell when non-interactive bash process is done executing a command?

I'm trying to write a different shell command line interface where the input line stays at the top. Output of previous commands should stack below: > INPUT LINE LAST OUTPUT (of command 1) ...
0
votes
2answers
86 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 ...
0
votes
0answers
22 views

Emacs shell slow compile

So I've been searching around for this particular problem and apparently I found no solutions. There are posts on reddit about this: https://www.reddit.com/r/emacs/comments/3scsak/...
0
votes
0answers
10 views

(comint-magic-space) in Eshell

I like to interact with the history of my bash commands. For instance, !?python would run the last command that contains python. Since the outcome is quite unpredictable, I often expand it before ...
2
votes
1answer
256 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 ...
0
votes
0answers
18 views

Is there a way to speed up emac's “shell” mode?

I am new to emacs. I know we can open a shell, eshell, or term with M-x shell, M-x eshell and M-x term. I have a program that needs to run make then run. On an external terminal app, I am on XFCE so ...
0
votes
2answers
36 views

1 single custom command to compile and run executable

In my emacs init file, I have this: (add-hook 'c++-mode-hook (lambda () (set (make-local-variable 'compile-command) (concat "g++ " buffer-file-name)))) Then, ...
0
votes
1answer
34 views

send custom commands to shell

I have just joined the Emacs church. I would like to know if the following can be done. Say I have a project folder, I would like to run some custom commands that tie to some keyboard shorcuts for ...
3
votes
3answers
84 views

How to determine which program is running inside an emacs shell buffer?

I have an emacs shell buffer which may or may not be running a certain interactive program such as ftp or python. I wish to write a lisp function which will interact with this program, but I would ...
0
votes
1answer
18 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 ...
0
votes
1answer
21 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 ...
1
vote
1answer
52 views

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 ...
1
vote
1answer
69 views

Elisp: How to accumulate function return into a list

I have this small snippet of Elisp code that decodes kernel traces: (defvar projbase "/my/proj/base") (setq my_shell_output (substring (shell-command-to-string (concat "/home/demetra/scripts/...
0
votes
0answers
15 views

In a terminal (not in Emacs), how can I use emacs helm/swipe to choose old shell command from bash_history?

In a terminal, we can use C-r to search a command from bash_history, but it is far less powerful than the Emacs package like helm-swoop or ivy-swipe. How can I use a shortcut in terminal (e.g., C-r) ...
4
votes
3answers
652 views

dirtrack mode with fish-shell

I recently started using the fish shell. I tried using it in term-mode in Emacs. One characteristic of this shell is that it shortens the current working directory before printing it as the prompt. ...
0
votes
0answers
36 views

How do I generate a swiper like list from a custom input?

I need help with creating a tool. So I have some lines selected by a region, that I need to feed line by line to a shell/python script. The output of shell/python script will be of the form: 0xabcd ...
1
vote
1answer
45 views

How do I make file paths clickable/navigable in Shell as described in the documentation?

For the life of me, I cannot get this functionality to work: https://wikemacs.org/wiki/Shell#Make_file_paths_clickable I've run (add-hook 'shell-mode-hook 'compilation-shell-minor-mode) in my .emacs ...
0
votes
0answers
60 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?
1
vote
1answer
35 views

Select *Input History* buffer

The Emacs *shell* has a nice command history accessible via C-c C-l (comint-dynamic-list-input-ring). However, in classic Emacs fashion, the *Input History* buffer which displays the history is not ...
0
votes
1answer
54 views

How can I set the default shell in spacemacs (Evil mode) when executing commands in a buffer?

I've downloaded spacemacs (configured with Evil mode) on a Windows PC and would like to use bash or wsl as the default. Example: Open the evil-tutor and execute command :!ls Desired Behaviour: I ...
4
votes
2answers
61 views

How to pipe large files through fold before opening?

On a regular basis I need to open files that have really long lines, which unfortunately causes emacs to grind to a halt. My understanding is that this is a long-term issue with the renderer. I've ...
2
votes
2answers
53 views

How to append an argument to an external command in init.el?

I 1must append a config file to 2package command, required as -p puppeteer-config.json. In my init.el, I tried changing the native command as shown below: From: (setq ob-mermaid-cli-path "~/...
1
vote
2answers
46 views

Multi-processing via TRAMP with asynchronous shell commands

I found the following code in TRAMP: (defun tramp-adb-handle-shell-command (command &optional output-buffer error-buffer) "Like `shell-command' for Tramp files." (let* ((asynchronous (...
3
votes
1answer
53 views

Spawn a bash outside emacs?

I am trying to spawn a shell outside emacs, not in a buffer. I have tried (start-process "firefox" nil "firefox"), wich does start a firefox process outside emacs, but when i tried (start-process "...
1
vote
1answer
899 views

Windows 10 + Emacs shell--can't run processes from eshell; unwanted cmd windows open

I've been upgraded at work to a Windows 10 machine, from Windows 7. Apparently, this has caused problems. First, eshell doesn't seem to be able to launch windows processes anymore. I get "Spawning ...
0
votes
1answer
41 views

How color specific text in shell?

Windows 10 (64 bit), Emacs 26.1 Here Windows console. Result of build my project: gradlew assemble here result: as you can see text BUILD SUCCESSFUL is on green color. Nice. Now same on Emacs's ...
1
vote
1answer
38 views

How to make *Shell Command Output* buffer scroll to the end?

I often execute shell commands via M-! and their output is then shown in the buffer *Shell Command Output*. How can I make this buffer display the end (rather than the beginning) so that I can see ...
0
votes
2answers
191 views

Tramp hangs in “Waiting for prompts from remote shell”

new emacs user here. I'm trying to get tramp to work but can't figure out what's wrong. I do: M-x councel-tramp select /ssh:myserver But I just get "Waiting for prompts from remote shell" and it ...
3
votes
1answer
217 views

How to force new `shell` to appear in current window?

Whenever I run M-x shell, a buffer appears almost randomly somewhere - splitting current windows as it sees fit. I cannot work out the logic behind it. The docstring says: (shell &optional ...
1
vote
0answers
330 views

From Org code block on *nix run (Power-)Shell (scripts) on MS Windows via SSH

To better integrate my Windows DevOps into Emacs Org-mode, I'd like to use my local emacs as an IDE for a remote Powershell. SSH was easily setup, from Linux shell ssh I can successfully login to a ...
0
votes
3answers
83 views

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 ...
1
vote
1answer
26 views

Is there a way to restrict history in shell-mode?

I run lots of test in shell-mode because I love being able to search through the history. However, some of these tests print lots of info to stdout and will cause my memory usage to go through the ...
1
vote
1answer
33 views

How to create shortcut that will kill process for buffer with fixed name

I have code like this to run R command from Emacs: (defun call-r-command (command-list) "run R command in shell buffer window if there is displayed buffer that have shell it will use that window"...
0
votes
2answers
38 views

Shell-mode execute script every time a shell is invoked

I have changed the emacs-shell mode shell to WSL ubuntu but however, the prompt is not very user-readable. For this reason I would like to execute a script that changes it so that its more readable ...
1
vote
0answers
43 views

Associate a buffer with a process

I am using Python with elpy. I am trying to use a Python shell opened on the remote computer using a shell buffer. I can cheat elpy by renaming the shell buffer with Python running in it to *Python*. ...
1
vote
0answers
111 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 ...
37
votes
2answers
7k 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 ...
1
vote
1answer
47 views

How do I use tramp to launch a remote PowerShell?

I'm trying to launch a PowerShell on a remote Windows system using tramp. So far all I've been able to do is start a PowerShell inside Emacs on the local (Windows) machine. What is the connection ...
0
votes
0answers
60 views

after connecting ssh in multi-term, prompt is messed up

After connecting ssh in emacs multi-term, prompt is repeated. How can I remove repeated prompt? I'm using OS X, OS X Terminal works well. It's only problem in emacs multi-term.
0
votes
1answer
88 views

Direct emacs that open file from the pwd from shell buffer

I use shell mode, often. I use the c-xc-f. Most of the time, the start directory for looking for file, correspond to the PWD of the emacs shell buffer. Can i set that it is always the case/or reset it?...
1
vote
1answer
116 views

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 ...
2
votes
1answer
45 views

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 ...
4
votes
2answers
785 views

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?
0
votes
1answer
43 views

Emacs subshell: how to select options by moving up and down arrow keys?

I open a subshell session using M + x shell and I create a Nuxt.js application using: yarn create nuxt-app myproject. During the installation process, I am suggested which packages/frameworks/...
1
vote
1answer
83 views

Have shell inherit buffer local process-environment

I have made buffer local changes to `process-environment' using the technique described in How can I get buffer-local environment variables via .dir-locals. I then call shell from that buffer. If I ...
0
votes
2answers
47 views

Split window with new buffer and spawn a new shell in same (possibly remote) directory as old buffer

In tmux, I can press some key combination and split the current window into two windows in the same directory. I've tried the split-window-* function, but found it just duplicates the same buffer in ...
2
votes
1answer
82 views

Setting :stdin with #+call in org-mode shell code block

I've got the following code: #+NAME: example-block1 #+BEGIN_EXAMPLE Lorem ipsum dolor sit amet, consectetur adipisicing elit. #+END_EXAMPLE #+NAME: example-block2 #+BEGIN_EXAMPLE Sed do eiusmod ...
0
votes
1answer
51 views

Wrong default-directory when inside a tmux session

I'm trying to use tmux inside emacs for a long time. I want to use it to attach to remote (long living) session. Attaching to sessions works fine but I have some problems in my daily workflow because ...
1
vote
0answers
76 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 ...
0
votes
0answers
42 views

Enter not sent to bash in shell buffer on Windows

I've asked this question: Emacs opens gitbash in new system window the solution make git bash run on windows but prompt was not read only. I've applied this solution Any way to make prompts and ...