Questions tagged [shell-mode]

is for the major mode for shell buffers. Use C-c prefix for accessing M-x commands.

Shell buffers run in , which is derived from comint-mode that runs subshells for , a command interpreter, in a .

and character mode are two input modes Emacs provides for running a .

Useful Links:

86 questions
17
votes
1 answer

How does emacs `shell-mode` know to prompt for sudo?

In shell-mode, a command like sudo CMD opens up a prompt in the echo area saying: [sudo] password for root: How does it know to do this? AFAIK, this behaviour cannot rise out of simply running sudo as usual, because the read builtin does not…
extremeaxe5
  • 659
  • 3
  • 11
7
votes
3 answers

Emacs: How to clear a subshell screen?

In Emacs interactive subshell, when I type clear, the screen is not cleared as it should do in a normal Ubuntu Terminal, for example. When I press Ctrl + l(twice if the screen is full), the screen gets cleared; but as soon as I type any command, let…
Billal Begueradj
  • 375
  • 1
  • 5
  • 19
7
votes
2 answers

Any way to have emacs shell pass the TAB into a readline command running inside it?

Eg. when you're running nice things like Perl or Ruby REPLs, you have code/command completion exposed via GNU Readline. What I want to do is set some elisp/env variable when entering/exiting such a program to indicate that I want shell-mode to pass…
Mark
  • 1,429
  • 1
  • 16
  • 21
6
votes
2 answers

Symbol's value as variable is void: shell-mode-map

Windows 10, Emacs 25.1 In my init.el (define-key shell-mode-map (kbd "C-c C-l") 'helm-comint-input-ring) But when I start emacs I get error: Symbol's value as variable is void: shell-mode-map
user8542613
  • 663
  • 6
  • 16
6
votes
1 answer

Equivalent of pausing (CTRL-Z bindkey) in shell-mode

Let's say that I run a process in the foreground, I then wish to pause it, and maybe assign it to the background. In normal C-shell, it is very easily done. I just press C-z, and then I input the command bg &. How can I achieve the same in emacs…
user1134991
  • 289
  • 1
  • 9
5
votes
2 answers

How can I make ANSI color codes inside the prompt show up in shell-mode?

I have shell-mode set up to work with ANSI colors. In older versions of Emacs, this extended to the prompt but now it doesn't and the prompt remains uncolored. PS1 is set with ANSI color codes which work when it's printed out but don't work in the…
Tikhon Jelvis
  • 6,252
  • 2
  • 28
  • 41
3
votes
0 answers

Using a sh-basic-offset value with a multiple of tab-width has side effects when building function using "C-c ("

When using a multiple of the tab-width value for sh-basic-offset, creating a function using the built-in command C-c ( removes characters from the expected result. That being said, I can create a shell function by manually typing it. It is just…
Phoenix
  • 351
  • 1
  • 9
3
votes
2 answers

how to watch and cat and grep with emacs

This doesn't seem to work in M-x shell $ watch 'grep "FIX" /tmp/output | tail -n 5' I see Every 2.0s: grep "FIX" /tmp/output | tail -n 5 and I see My-hostname.local: Tue Aug 28 19:09:22 2018 on screen. Whats the emacs way of doing it?
american-ninja-warrior
  • 3,903
  • 2
  • 24
  • 44
3
votes
0 answers

emacs shell: remove all non-printable characters

When I call gcalcli from the bash shell, I get the output described in the documentation. But when I run M-x shell on emacs (24.3) and call gcalcli from there, I get a lot of ^[ characters. Compare screenshots from the shell and from emacs. My…
Koldito
  • 199
  • 1
  • 4
2
votes
1 answer

How to globally disable `shell-dirtrack-mode` after `(require 'shell)`

(require 'shell) enables shell-dirtrack-mode globally in every buffer. Is there a way to disable that behavior? The only workaround that I have found is to call (shell-dirtrack-mode -1) for each major mode that loads (e.g., via a major-mode hook);…
lawlist
  • 19,106
  • 5
  • 38
  • 120
2
votes
1 answer

setenv in shell-mode

I want to set PAGER to cat in shell-mode. For eshell I just add a hook with setenv. Unfortunately it doesn't seem to work for shell-mode, setenv doesn't set env variable. Is there other way to redefine shell-defined variables (which may be set in…
Ineu
  • 123
  • 4
2
votes
1 answer

configure shell-mode to understand implicit cd

For the most part, I'm really liking shell-mode. I've configured it to read my .history file and if I spawn a dired or open a file it uses the current directory. I'm using tcsh with the set implicitcd flag set. This allows me to type a directory and…
Greg Nisbet
  • 877
  • 5
  • 19
1
vote
1 answer

Shell-mode conditional execution

After a command terminates in shell-mode, I want to execute an additional command conditional on stdout. How can this be automated?
Matthew Piziak
  • 6,038
  • 3
  • 31
  • 79
1
vote
1 answer

shell-mode: `C-a` moves point to beginning of line instead of after prompt

Usually C-a moves point to just after the prompt: andreas@my-computer:~/some/folder $ #here but occasionally something happens and C-a starts to the beginning of line: andreas@my-computer:~/some/folder #here I have no idea why this happens, and…
Andreas Jansson
  • 243
  • 1
  • 10
1
vote
2 answers

differences of shell-mode vs. shell-script-mode?

What are the differences between shell-mode and shell-script-mode, or how/where would I read up the differences myself?
sjas
  • 301
  • 3
  • 10
1
2