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.

0
votes
2answers
42 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 ...
1
vote
1answer
361 views

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 ...
5
votes
3answers
375 views

How to autoscroll a window to always show the end of a growing buffer?

Context: I have a window that shows the output of a shell command. As new lines are added, I'd like the window to always show the most recent lines. Example: (let ((temp-window (or (get-buffer-...
1
vote
1answer
117 views

How to scroll back through the command line history in the Emacs interactive subshell?

Let us say in the interactive subshell I run these commands: command_a command-b command_c ... command_z I type M-p to go back to command_z. But how can I scroll back the history of commands until ...
1
vote
0answers
308 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 ...
2
votes
0answers
54 views

How to run process in administrative mode from Emacs?

I've been using powershell.el in MS Windows Emacs, but I sometimes want to be administrative mode so that I can do software installation via chocolatey, etc. Is there any way to call shell command, ...
1
vote
0answers
33 views

Terminfo database in Emacs shell not updated after (text-scale-adjust)

The following sequence of commands shows that the number of columns in terminfo's database inside an Emacs shell buffer is not updated when the user decreases the size of the font with "C-x C--" (text-...
1
vote
1answer
117 views

Set custom bashrc or PS1 variable

I'm using, at the terminal on my android device, an simple approach to show the path to my location (export PS1="(\w)$ "). However, the \w seems to not be working in emacs shell emulator running ...
0
votes
0answers
26 views

How narrow shell output?

Emacs 25.1. I start M-x shell. And run some process that generate text to output. How can I filter this output?
0
votes
1answer
85 views

How to send few chars to shell buffer automatically/periodically

I would like Emacs to send a few chars (command, ideally) to a specific buffer (ssh shell) so that the session does not terminate. How can I achieve this?
3
votes
0answers
153 views

Shell coding system

If, before M-x shell, I run C-x RET c (universal-coding-system-argument) I can change the coding system used by the shell. Therefore, given echo Straße > foo foo will be encoded in the related ...
4
votes
1answer
70 views

autosave on shell buffers

How can I set things up so the buffer being used to run an inferior shell will be autosaved periodically to a file? The file to save in could be named "shell-2018-01-22". I thought this would be ...
0
votes
1answer
276 views

Shell IO Behavior For Emacs' Shells

The GNU page for Eshell says that Eshell is not a replacement for system shells such as bash or zsh. Use Eshell when you want to move text between Emacs and external processes; if you only want to ...
0
votes
0answers
71 views

shell-mode C-c C-c kill keybinding

With some regularity, I am using bash with M-x shell, and out of muscle memory I hit C-c C-c, with dramatic results: the comint prompt streams a long error message with a large number of escaped ...
2
votes
1answer
652 views

fix “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
2
votes
3answers
720 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@...
1
vote
0answers
39 views

how can I see the result of 'ping -c 5 127.0.0.1' live using org babel session

https://github.com/whacked/ob-shstream/blob/master/ob-shstream.el There's an add-on for org babel that let's you see streaming output of bash shell blocks. It's documentation reads like this: ;; the ...
0
votes
1answer
52 views

shell script: emacs does not align case if pattern involves $

Let us start with an unaligned piece of code case $word in pattern1) command1 ;; *) command_defaultcase ;; esac I can align this code by selecting the lines and pressing TAB. The result is: case $...
0
votes
1answer
364 views

Open file in existing GUI Emacs from shell

I would like to set the shell EDITOR to use the existing running instance of GUI Emacs. On macOS I can type open -a Emacs file to edit file that way. But how would EDITOR look to work that way? What ...
0
votes
1answer
123 views

Running python script from shell in Emacs results in delayed output

I'm trying to run a python script from a Windows shell (invoked via M-x shell or M-x powershell) inside Emacs. However, no output is shown via print statements until I after I hit a raw_input ...
3
votes
1answer
687 views

Remote shell path - env: No such file or directory

In Emacs, when I open the file /ssh:USER@HOST:/PATH, Tramp mode kicks in and everything is great. While editing the file, I want to open a remote shell as well using M-x shell, but its behaviour is ...
0
votes
1answer
273 views

Git bash opens in window outside of emacs

When running Emacs on Windows 10, I am able to launch git bash from within Emacs using the information given here, here, or here. For example, I can just add these two lines to my .emacs: (setq ...
1
vote
2answers
129 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
1answer
178 views

tramp + async-shell-command ignores shell-file-name

If I locally call async-shell-command it takes the shell from shell-file-name (/bin/bash). However if I use su or ssh via tramp to invoke a shell command remotely it always runs as /bin/sh. The ...
1
vote
1answer
42 views

How to configure mouse button to execute a program in emacs

I have a lot of video files I want to filter through and delete if they are uninteresting. I opened the directory of video files in emacs and I want a left-click on the file to play that file in vlc. ...
2
votes
1answer
47 views

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

How to prevent the completion feature of Emacs shell from adding an extra space after the first word of a command?

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
1answer
319 views

Windows 10, Emacs 25.1, shell: Grep not work immediately

Windows 10 (64 bit), Emacs 25.1. I has Android application. And in console I start Android command "adb logcat" to show logs from Android device. But it's show many text. And I want to filter to show ...
1
vote
2answers
262 views

emacs opens shells in a random window, how to change this?

Try splitting the frame repeating some times the command C-x 3. Then try open the shell with M-x shell. It will open in a random window and not the one which you have typed the command from. Why?
3
votes
1answer
82 views

Saving raw ANSI escape codes in M-x shell, M-x eshell, or M-x term

Each of M-x shell, M-x eshell, and M-x term in Emacs lets me save the buffer to a text file. But the terminal colors are not saved. How do I save the raw ANSI escape sequences too?
0
votes
1answer
95 views

redirect stderr to a file in call-process-region

I have been reading the documentation for call-process-region here and I am trying to redirect stderr to a file. from the the documentation, this looks correct (call-process-region beg end perltidy-...
2
votes
0answers
85 views

Emacs shell and telnet buffer auto jumps to end of buffer while browsing buffer contents

Was recently required to update to RHEL 7.x and with that came a newer release of Emacs (24.3.1). With emacs I am a big user of shells and telnet sessions within emacs so that I can easily browse the ...
0
votes
1answer
384 views

C++ “std::cin >> ” is not pausing to read input from Emacs shell

The following program is from https://www.cs.bu.edu/teaching/tool/emacs/programming/ #include <iostream> int main() { int howmany; std::cout << "Enter a number: "; std::cin >&...
0
votes
2answers
107 views

How to troubleshoot and diagnose escaped-character display errors in Emacs shell?

I make much use of sub-shells within Emacs (initiated via M-x shell), and, because of this, I run into problems like the one illustrated1 below way too often: $ python -m pdb /tmp/hello_world.py [2] ...
2
votes
1answer
323 views

How to open system's command line at the directory of the current buffer?

Is there any easy way to open the system command line interface (e.g., cmd in Windows) at the directory containing the current buffer (if any)? Note that M-x shell open a command line interface within ...
1
vote
2answers
295 views

tramp and fish shell (local)

How to setup emacs tramp to open remote files while local shell is fish? More precisely is how to ask tramp to use bash shell instead of one named in SHELL environment variable?
0
votes
0answers
58 views

Retaining focus while displaying graphics windows

NB: The Emacs world uses the word frame to refer to what in most other contexts is called window, and uses the word window to describe something else. In this post, however, the word window always ...
1
vote
1answer
132 views

Cannot use find-dired: setq: Searching for program: is a directory,

The error is raised by shell-command--shell-command-with-editor-mode. But further stack trace is obfuscated by bytecompiled output. Recently I had to set (setq explicit-shell-file-name "bash") to be ...
0
votes
1answer
129 views

What is the keybinding for toggling between editing the shell contents as a buffer and running commands in it?

What is the keybinding for toggling between editing the shell contents as buffer on one hand and running commands in it on the other? I have configured multi-term to run bash and the shell is ...
1
vote
2answers
227 views

content was split in the functions of comint-preoutput-filter-functions

Consider the following snippet (defun python-shell-filter-long-lines (string) (print string) string) (push 'python-shell-filter-long-lines comint-preoutput-filter-functions) and M-x run-python ...
4
votes
1answer
999 views

how to name buffers (*shell*)

I'm interested in naming Emacs buffers. In particular I'd like to give names to shell buffers that I've started. That way I can easily tell them apart when switching buffers.
0
votes
1answer
614 views

Ansi-Term not reading .profile

my question is very similar to this one. I use my .profile file to set environment variables, such as EDITOR. However, when I run ansi-term and type printenv I can see that that variable is not ...
2
votes
1answer
2k views

Error running Emacs from a Terminal window: “Symbol's function definition is void: package-initialize”

After starting Emacs from a Terminal window, the following message is displayed: An error has occurred while loading '/Users/EvanAad/.emacs': Symbol's function definition is void: package-initialize ...
5
votes
2answers
480 views

How to determine the initial current directory when emacs is run from command line?

How can I determine (from within Emacs) the current directory as it was when the Shell launched emacs from the command line?
3
votes
1answer
630 views

MS Windows Tramp Remote Shell

I'm trying to open a remote shell after connecting to a machine using Tramp with the plink method on MS Windows. However every time I call shell it prompts me for 'Remote shell path' and suggests a ...
2
votes
1answer
250 views

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

Remote shell (tramp) and login script

When I open a file via tramp on a remote machine and then start a shell with M-x shell I get an infinite loop because of my .cshrc file. I want to use a newer gcc version in CentOS so I have: set X="...
1
vote
0answers
381 views

Including pip-installed libraries on emacs python shell

I recently found out you can run python from emacs (Python Mode -> py-shell) and I've been running my scripts through the py-shell due to only needing to C-c C-c, but I've been running into a problem: ...
6
votes
4answers
2k views

How to start python shell in appropriate working directory?

If I am editing a python file, and start a python shell using elpy-shell-switch-to-shell the process appears to set the working directory as the containing directory of the file. However, the file ...
1
vote
0answers
108 views

`pushd` command for shell buffer

In an interactive shell, I have a script I run that changes my directory (via pushd) and then launches an interactive program. At this point I issue M-x cd and provide Emacs with the new directory ...