Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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

3
votes
3answers
157 views

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 ...
0
votes
1answer
66 views

emacs 25 shell-mode tab auto-completion issue with ksh

I have upgraded to Emacs 25.3 from 24. This issue only appears in the ksh. I've found that when I use bash then all is good. I find that in shell-mode when I hit tab to perform completion of the rest ...
0
votes
2answers
61 views

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

Shell mode: moving through the command history

In a shell in a terminal (Gnome Terminal + bash), the up and down keys allow me to browse through my command history. In shell-mode inside emacs, the up and down keys move around the buffer, which is ...
2
votes
1answer
23 views

Shell mode does not do autocompletion for loaded functions

When running in a terminal, the shell does auto-completion even for loaded functions: $ check-<tab><tab> check-bios-nx check-dirty check-language-support check-...
0
votes
0answers
15 views

No tty in shell buffers in Carbon Emacs on High Sierra

I've been using the Carbon Emacs port of Emacs, which is based on Emacs 22, for many years. I know it's way out of date and unmaintained, but I have a huge collection of home-grown extensions that I ...
0
votes
1answer
26 views

Shell buffer echoes partial long lines

I've written a command that ssh-es to a remote host and runs an interactive command there. Something like: (defun remote-command () (interactive) (pop-to-buffer (get-buffer-create "*remote-...
9
votes
2answers
120 views

How to run a previous unique command in an Emacs shell (without repeats)?

In Emacs shell, is there a command similar to M-p but which would skip repeated commands? That is, it would go to the next different command. Similar to regular Linux terminal. So if I were to run: ...
0
votes
1answer
108 views

from the spacemacs shell, how do I edit a file in a new buffer in the main window?

I open a new shell using space-'. From that shell window I can type ls to see files. Let's say I want to edit ~/.zshrc. From the shell prompt, what do I type to edit that file in a new buffer in the ...
0
votes
0answers
34 views

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/...
0
votes
0answers
15 views

comint-input-ring-size ignored in shell-mode

I am trying to change comint-input-ring-size in shell mode in Emacs. The comint-input-file-name is correctly set to ~/.bash_history file which is a big file (around 5000 commands). However, if I set ...
0
votes
1answer
92 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 ...
1
vote
1answer
65 views

How to write a helm function to select only from shell buffers

I recently switched from ido to helm. Now I'm using helm-buffers-list to select buffers. Additionally I want to create a customised helm-buffers-list function which allows me only to select from ...
0
votes
2answers
138 views

How to disable show-trailing-whitespace in emacs shell?

I have set show-trailing-whitespace as default in my .emacs file but I don't want it to work on shell and some specific buffer. I can disable it manually every time I open an emacs shell but I want ...
4
votes
1answer
79 views

EMACS shell mode that supports annotations

I often find myself doing things like installations or debugging where I would like to be able to work in shell mode but be able to insert annotations as I go. BBEdit has something like this but ...
3
votes
1answer
624 views

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

Why does `M-x shell-mode` now always/usually open in a different window?

Since a relatively recent laptop re-install, whenever I M-x shell-mode (usually with the default shell buffer already running somewhere), the shell doesn't appear in the currently active window, ...
2
votes
1answer
315 views

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 ...
0
votes
0answers
90 views

Sending command from bash in shell-mode, and knowing buffer name

My specific goal is setting 'vc-mode from the $PROMPT1 snippet so that the mode line will show useful VC info in shell-mode. I can use emacsclient -e '(setq vc-mode "foo")' but that's not quite ...
1
vote
2answers
307 views

Get the same/map bindkeys in shell mode, in particular CTRL-r

I am using emacs s 23.1.1. I have started to really use in real-earnest the shell, in order to minimize the amounts of time I am out of emacs. However, the bind-keys are emacs based. Which is good, ...
0
votes
1answer
58 views

How to run `gprolog` under an Emacs sub-process shell?

I'd like to run the gprolog interactive interpreter in an Emacs sub-process shell (started with M-x shell). The interactive interpret starts without a problem, but it does not respond to some ...
0
votes
1answer
96 views

company-mode in shell-mode doesn't complete ./executables

With company-mode on in shell-mode, if I'm in ~/bin I can get completions if I type ~/bin/someprog or even ../bin/someprog but not ./someprog – is there some setting to fix this?
0
votes
1answer
213 views

How to send *shell* stdout directly to kill-ring?

Suppose that I have a *shell* buffer (i.e. a subordinate shell, started with M-x shell). Suppose also that at this shell's prompt, I can execute some command foo that sends some output to stdout. I ...
1
vote
2answers
1k views

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?
5
votes
1answer
389 views

Directory tracking in remote shell buffer

I use the shell command via C-u M-x shell to open a shell on a remote server by giving as default directory the path to the remote server (e.g /user@myserver.com:/home/user) (which should have the ...
5
votes
2answers
270 views

sh-script alignment issues

I'm sure emacs used to do it my way, but things appear to have changed (probably years ago, I've just been living with the pain). I want this (to conform to corp. standards): MULTIFORM=$( curl -...
2
votes
1answer
110 views

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 ...
4
votes
1answer
494 views

How to turn off alignment-indent after line continuation in Shell-script mode?

In Shell-script[sh] mode, Emacs defaults to this style of indentation: /this/is/an/example/command/broken/over_multiple_lines which \ causes \ ...
1
vote
1answer
66 views

How to get shell mode to properly handle my PS1, which involves user-defined function calls?

My bash_profile includes a couple functions to build the prompt. This is a super-simplified version, which I'm using to try to debug the problem with: custom_git_function () { echo "git" } ...
8
votes
2answers
3k views

Set indentation for shell script function

I am trying to set the number of spaces per indent for starting a new function in sh-mode (bash sub-mode). I have tried setting: '(sh-basic-offset 2) '(sh-indentation 2) '(smie-indent-basic 2) (as ...
2
votes
0answers
189 views

Custom Bash prompt doesn't display correctly in shell mode [closed]

In my .bashrc file I've set the PS1 variable to this to customize my prompt: export PS1='[\D{%Y-%d-%m} \t \u@\h \W]\n$ ' The format strings are explained in the Bash manual. This one gives me a ...
14
votes
1answer
345 views

How to prevent backspace from deleting my shell prompt?

It is a usual shell display: ME@mycomputer: ~$ echo When I do backspace several times It becomes: ME@mycompu How to prevent the system word from deleting
3
votes
1answer
95 views

zsh expansion modifiers are treated as comments

zsh has a ton of syntax. In particular, the # character serves a bunch of different roles. Here are two that are problematic: Prefix globbing flags (#b)(*).c This finds all files that end in .c and ...
3
votes
0answers
157 views

1024 char limit on command line in emacs shell mode on OSX

I am running into a 1024 character limit for a bash command line in emacs shell mode. For example the command: echo xxxxxxxxxxxxx...x with 1018 x's (for a total line length of 1023 chars) works ...
2
votes
1answer
114 views

How can i use a different shell in Emacs Shell?

I am currently using Zsh in my regular terminal app on my Mac OS X. However, it's heavily customized and colors don't appear properly inside Emacs. So I am thinking, I should probably use shell-mode ...
2
votes
1answer
854 views

How to run tmux in Aquamacs

I quite like tmux and Aquamacs. I've recently been interested in how to integrate the two together. As far as I know, one cannot run Aquamacs within a terminal even with the Aquamacs CLI tool, so the ...
6
votes
2answers
159 views

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 ...
1
vote
2answers
2k views

weird characters in shell mode with zsh

I recently switched to zsh (with oh-my-zsh) as my primary shell, but running the shell from emacs results in some strange (for lack of a better word) "residural" characters; however changing to bash ...
3
votes
1answer
716 views

How can I change which shell script mode I'm in?

Occasionally, emacs opens a file in shell-script[fish] when I want it to open in shell-script[bash]. How can I manually change the subtype of shell-script mode that I'm in?
4
votes
1answer
621 views

/bin/ls --color=always fails to produce colorized output in shell-mode

I have run M-x ansi-color-for-comint-mode-on. Also, when I use /bin/ls --color=always (or /bin/ls --color=auto) in a regular terminal, I do see colors in the output. It's only within Emacs' shell-...
3
votes
0answers
199 views

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 ...
5
votes
2answers
198 views

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

inserting passwords into pass from shell-mode

I'm trying to manage my passwords using the pass script from shell-mode inside Emacs. The script prompts me to enter the password twice as is customary when adding or changing passwords. The first ...
1
vote
2answers
200 views

What's a good workflow for having a few dedicated shell sessions?

At present I use a screen session in the terminal (outside of emacs), with window 0 devoted to running my web server, window 1 to running tests, and window 2 for general hacking. I like this flow and ...
1
vote
1answer
71 views

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

zsh EXTENDED_HISTORY corrupts shell-mode history

I use zsh with the EXTENDED_HISTORY option, which makes it so that in the shell history timestamps are stored which is useful for going back and diagnosing how you screwed up production. I'm trying to ...
1
vote
1answer
147 views

shell-mode prompt?

I have set in my ~/.emacs.d/init_bash.sh: export PS1='\h:\w$ ' without it, my prompt is bash-3.2$ but now it is bash-3.2$ computername:~/path/to/directory$ How do I make it just be ...
1
vote
1answer
455 views

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 ...
3
votes
3answers
1k views

Fixing forced indentation in shell-script-mode for tcsh

How do you configure the indentation to work correctly for tcsh shell scripts? I am unable to make the indentation work correctly when I use the shell-script-mode as it is. Problem: An indentation ...
3
votes
2answers
740 views

Shell bash completion window

I am in shell-mode with bash-completion enabled. When I attempt tab completion, Emacs creates a new window to display completions. For example, if I am in a directory with subdirectories foo and ...