Skip to main content

Questions tagged [shell-mode]

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

Filter by
Sorted by
Tagged with
1 vote
1 answer
32 views

I'm running cygwin bash in shell mode in emacs, but I don't get any completions, is there a way to set it up?
Sergey Kitov's user avatar
0 votes
1 answer
48 views

Why are bash sequence expressions expanded in a normal org-babel source block but not in one attached to a session? #+begin_src bash ...
Rovanion's user avatar
  • 1,077
2 votes
1 answer
80 views

When running zsh under Emacs shell (M-x shell) with the stock zsh config (zsh -f), partial lines are hidden from the output. Example: Start emacs without config file: $ emacs -q Set (setq explicit-...
arvidj's user avatar
  • 87
1 vote
1 answer
75 views

I have a git repo and I'm trying to add some new files. If I do ls I can see the files. If I do git status, git tells me they're untracked but if I do git add and press tab, the autocomplete doesn't ...
Richard Wheeldon's user avatar
1 vote
1 answer
301 views

Startup a fresh GTK emacs with no config with emacs -Q. Then run M-x shell. Then at the prompt: $ ps -ef Long commands will be truncated to the frame width, like this: root 526315 2 0 15:...
Joseph Garvin's user avatar
0 votes
1 answer
103 views

I am using, per the Mastering Emacs blog, the following OSC7 command for directory tracking (in bash): printf "\e]7;file://%s%s\e\\" "$HOSTNAME" "$PWD" This mostly works,...
Brian Marick's user avatar
1 vote
1 answer
402 views

(xpost from Unix Stack Exchange) I'm using a local shell via an Emacs shell buffer. Seemingly at random, my shell will start echoing back every command I type before the rest of the output. h ~ $ pwd ...
Eric Auld's user avatar
  • 205
0 votes
2 answers
140 views

I have a test program that produces a lengthy output, so I ran it in "Shell". However, at some point the test program prompts for a password, and when entering it, the characters are ...
U. Windl's user avatar
  • 227
1 vote
1 answer
121 views

I have a python program that uses graphviz to generate an svg image that it prints out. When I run that in a shell buffer I see a textual representation of the svg image. I'd like to see instead the ...
Christopher Clark's user avatar
0 votes
1 answer
54 views

I use tramp-shell for ssh to another machine. Setup as follows: (defun spawn-shell (name) "Invoke shell test" (interactive "MName of shell buffer to create: ") (pop-to-buffer ...
Noah's user avatar
  • 121
0 votes
1 answer
386 views

I use shells running under Emacs (via M-x shell) under a variety of settings1. In all these settings, I use the same .emacs file. Nevertheless I observe an inconsistency, as described below. In some ...
kjo's user avatar
  • 3,407
2 votes
1 answer
413 views

For convenience (at least so far) I am running my program that produces a lot of debug output in Emacs shell. However I have a problem: Sometimes (not all the time) moving the cursor (up, down, left, ...
U. Windl's user avatar
  • 227
0 votes
0 answers
92 views

If typed in sh-mode the closing brace is not auto-indented: function() { } If typed in c-mode the closing brace is auto-indented when inserted: function() { } The exact keystrokes are: f u n c t ...
mcp's user avatar
  • 626
0 votes
0 answers
38 views

I know how to view a shell buffer's1 shell history, but is there a way to remove entries from this history, so that these entries will no longer be accessible by commands like comint-previous-input? ...
kjo's user avatar
  • 3,407
0 votes
0 answers
124 views

I'm getting unexpected completion suggestions in shell mode using company. For instance: I have no idea why it's suggesting random DLL filenames here. This is in Linux Emacs built from master of 2022-...
GaryO's user avatar
  • 516
0 votes
1 answer
127 views

I have following definitions in my .emacs file for keyword coloring in shell-mode: (add-hook 'shell-mode-hook 'ansi-color-for-comint-mode-on) (font-lock-add-keywords 'shell-mode '(("alias " ...
alper's user avatar
  • 1,570
3 votes
1 answer
167 views

I want to create a "toggle shell" shortcut with F1 such that it will run shell when I'm in any other buffer, but will call mode-line-other-buffer when I'm in the shell buffer. What is an ...
Berken Tekin's user avatar
4 votes
1 answer
203 views

When I run shell-resync-dirs 1, the function hangs, until I press C-g, at which this point, what looks suspiciously like the output of my shell's dirs -l command 2 gets inserted into my buffer at ...
kjo's user avatar
  • 3,407
1 vote
1 answer
64 views

In Shell-script[bash] mode, coloring differs for sh-quoted-exec in #!/bin/sh and #!/bin/bash. If #!/bin/sh is the first line: // I prefert this If #!/bin/bash is the first line: Would it be possible ...
alper's user avatar
  • 1,570
0 votes
1 answer
513 views

When I open a shell script (e.g. emacs myscript.sh) and do C-c : (M-x sh-set-shell), and select sh as the shell, Emacs will insert a #!/usr/bin/sh shebang instead of #!/bin/sh. I want Emacs to insert #...
Flux's user avatar
  • 663
2 votes
1 answer
71 views

Various command-line tools, such as gdb, ftp, sftp, etc, use ! to prefix a command to be run in a shell. So (for instance) !mkdir foo will make a directory called foo. When using these tools inside ...
Nick Barnes's user avatar
1 vote
1 answer
702 views

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?
topkek's user avatar
  • 89
2 votes
1 answer
454 views

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 ...
Russ Phelan's user avatar
0 votes
1 answer
58 views

In shell-mode; alias keyword is not recognized as font-lock-builtin-face type and remain as white color (with the current theme I am using it should be in different color) => Is it possible to add ...
alper's user avatar
  • 1,570
1 vote
1 answer
99 views

Question: is there a way to convince ffap to perform variable substitution on environment variables before attempting to resolve the file path? I often have lines in shell scripts that read: variable=&...
kvantour's user avatar
  • 113
5 votes
1 answer
292 views

I have a directory with the file a file name with spaces and in Emacs I have a bash in a shell buffer. Rhen I type ls a<TAB> and shell mode completes to a\ file\ name\ with\ space However I ...
halloleo's user avatar
  • 1,445
0 votes
0 answers
32 views

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 ...
wvxvw's user avatar
  • 11.6k
1 vote
0 answers
272 views

#+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'...
HappyFace's user avatar
  • 930
2 votes
2 answers
861 views

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:/...
tony's user avatar
  • 113
0 votes
0 answers
23 views

I use inferior shells (initiated with M-x shell) extensively. If the current buffer is one such inferior shell, and within this shell I invoke the pushd command (with or without an argument), a space-...
kjo's user avatar
  • 3,407
1 vote
0 answers
151 views

Sometimes in shell I end up executing a command which results in too much output. For example, consider a wrong grep on a huge text file which results in 10,000 matches. The grep command completes ...
Miserable Variable's user avatar
1 vote
0 answers
527 views

I'm something of an Emacs newbie. I would like to run a shell script I've written and insert the output into the buffer I'm working in. But the script requires some interaction, so ideally I'd like ...
ShankarG's user avatar
  • 111
3 votes
0 answers
77 views

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 ...
Phoenix's user avatar
  • 381
17 votes
1 answer
2k views

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 ...
extremeaxe5's user avatar
6 votes
1 answer
966 views

In shell-mode when you exit the shell process (e.g. by typing exit) the buffer still hangs around (with the message "Process shell<1> finished"). How can I automatically kill the shell buffer when ...
halloleo's user avatar
  • 1,445
1 vote
1 answer
61 views

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 ...
tomcat's user avatar
  • 355
0 votes
2 answers
229 views

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 ...
Teererai Marange's user avatar
7 votes
3 answers
2k views

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 ...
Billal BEGUERADJ's user avatar
0 votes
1 answer
443 views

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 ...
ali hodgkiss's user avatar
4 votes
2 answers
1k views

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 ...
american-ninja-warrior's user avatar
1 vote
2 answers
1k views

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 ...
blueFast's user avatar
  • 315
3 votes
1 answer
198 views

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-...
blueFast's user avatar
  • 315
0 votes
0 answers
107 views

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 ...
Barmar's user avatar
  • 101
0 votes
1 answer
117 views

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-...
Sean's user avatar
  • 961
9 votes
2 answers
339 views

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: ...
Anton's user avatar
  • 163
0 votes
1 answer
534 views

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 ...
hnzix's user avatar
  • 1
1 vote
1 answer
253 views

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/...
Andreas Jansson's user avatar
1 vote
0 answers
126 views

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 ...
Sundar Venkataraman's user avatar
0 votes
1 answer
620 views

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 ...
Steven Tammen's user avatar
1 vote
1 answer
271 views

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 ...
halloleo's user avatar
  • 1,445