As of May 31, 2023, we have updated our Code of Conduct.

Questions tagged [ansi-term]

is for the Emacs ansi terminal emulator. Emacs supports ANSI-standard VT100-style escape sequences recognized by such modern terminals as xterm. `M-x ansi-term` command starts a terminal, which by default runs in a sub-shell in a buffer named `*ansi-term*` with `term-mode`.

Filter by
Sorted by
Tagged with
1 vote
3 answers
20 views

emacs -nw: how can I turn off the reverse video for directories in dired?

How can I turn off the reverse video for directories in dired? As you see emacs -Q -nw --color=never . has still too much color: The only thing I want to have with white background is my cursor. ...
Dan Jacobson's user avatar
0 votes
2 answers
34 views

How to put ansi-term state in mode line?

Is there a way to put the ansi-term state (char-mode or term-mode) in the mode line?
Elsa Gonsiorowski's user avatar
2 votes
1 answer
53 views

How to execute a command in elisp (startup script) whenever a new term is created?

I tried adding hook to term-mode-hook to call comint-send-string: (add-hook 'term-mode-hook (lambda () (comint-send-string (get-buffer-process (current-buffer)) "alias t='echo test'&...
AhLeung's user avatar
  • 1,063
0 votes
0 answers
27 views

What does ("C-p" . previous-line) in term-bind-key-alist do?

I am using multi-term to manage multiple terminals. When I open a new term with M-x multi-term RET, the terminal is in char mode which is good. I execute a command in the terminal like this: echo ...
Sirius Scientist's user avatar
0 votes
1 answer
30 views

How to enable terminal beeping?

xterm conviniently beeps on a failed unit test (pytest): Beeping (start-process "" nil "/usr/bin/xterm" "-e" "python3" "-B" "-m" "...
jjk's user avatar
  • 673
1 vote
0 answers
41 views

How can I change buffer local key binding C-h, C-x, M-x in term raw mode?

I'm running a specific console application in a term window (char/raw mode). This application has no need for C-h, C-x, and M-x, so they should just do what they always do in Emacs. However, I don't ...
fred's user avatar
  • 21
0 votes
0 answers
36 views

Pass through commands into ansi-term

I'm running into this problem: I have a tmux session on a remote machine running in ansi-term. I want to be able to, for example, copy and paste stuff in this session, but C-SPC for example, is ...
wvxvw's user avatar
  • 11.2k
1 vote
0 answers
83 views

isend: Why additional C-RET required when sending code to ansi-term?

The following code (from here) allows to send lines of code to an open *ansi-term* buffer via C-RET. It works well but the very first time I hit C-RET, the current line is not sent (nothing happens). ...
Marius Hofert's user avatar
-1 votes
1 answer
103 views

Using after-change-functions for an ansi-term buffer

I'm writing some Elisp that compiles code in watch mode using make-term. When the code compiles/tests pass, the compilation output is only a couple of lines. When there's an error, it can be much ...
rlms's user avatar
  • 99
2 votes
1 answer
309 views

Prevent term from asking me which shell to use

I want to use /bin/bash as default shell for term avoiding it to ask me every time. Is this possible?
Francesco Cadei's user avatar
0 votes
0 answers
73 views

Send string to a fully functional REPL in Emacs on Windows?

Summary. Is there a way to get fully functional REPLs on Windows running in Emacs. I want to avoid the maintenance burden associated with comint. Long version. In many cases I dislike how the built-...
kdb's user avatar
  • 1,541
1 vote
0 answers
106 views

Use conda environment in ansi-term

I would like to be able to use conda activate to switch between environments in ansi-term. I am running bash in ansi-term from Emacs 27.1 on MacOS Catalina. Currently, executing conda activate <...
RyanM's user avatar
  • 11
1 vote
1 answer
61 views

How to override Q in term-mode with passthrough if the shell process is still live?

I wrote the following emacs lisp procedure to kill a dead ansi-term buffer. It works well if called with M-x. Also, it appears to run correctly when the called in a living term buffer. However, dead ...
wdkrnls's user avatar
  • 3,617
0 votes
0 answers
21 views

How to wrap visual program with term? [duplicate]

I have installed visidata and am trying to integrate into my Emacs workflow through term-mode. As a proof of concept, I'm trying to successfully explore the mtcars data set as it would work when ...
wdkrnls's user avatar
  • 3,617
2 votes
0 answers
34 views

How to restore a coding environment?

Every other day I continue work on a coding project which involves these steps: Open a file in the project Open a terminal buffer e.g.: m-x term Change to that term buffer Enter command in termin e.g....
jjk's user avatar
  • 673
1 vote
1 answer
387 views

Send a single raw keystroke to ansi-term

Occasionally, I want to send a keystroke to a program in my ansi-term buffer that is already mapped to something in emacs. I know that for one I use often I could change my configuration to always ...
singpolyma's user avatar
1 vote
0 answers
111 views

How to pass bash commands from a script to terminal?

Let's say I have a bash script. Is there a way I can pass specific lines or blocks in the script to terminal process in EMACS? Just like how we do for R script using command C-c R
Veera's user avatar
  • 305
1 vote
0 answers
83 views

How to make ansi-term wrap lines instead of adding newline so it can fit the window?

See the screenshot. I typed one long line in the buffer, didn't hit enter but cursor is already on line 3. This causes multiple problems, eg. when I copy the output of a command from ansi-term to ...
whysoserious's user avatar
1 vote
0 answers
148 views

Truncation of text in Emacs terminal emulators

When I log in to the cluster using shell or eshell, I get the following message: 2018-04-11: The MEM1024 node is now back in the queue. The hardware had to be completely replaced, which means there ...
honey_badger's user avatar
1 vote
0 answers
200 views

spacemacs opens file in terminal split

I'm using neotree and as you know it opens a file in the most recent window split you accessed before switching to neotree (window 0). Sometimes this last accessed split is the ansi-term window I ...
Asalle's user avatar
  • 113
0 votes
1 answer
175 views

Sending code to an ansi-term via isend-mode: How to modify default buffer chosen and how to automatically open ansi-terms?

I use isend-mode (see here) to send (bash) code to an ansi-term as follows: 1) `M-x ansi-term` # open ansi-term 2) Open buffer with code I want to send to *ansi-term* 3) `M-x isend RET *ansi-term* ...
Marius Hofert's user avatar
2 votes
2 answers
337 views

Why can't I use my custom keybinding in ansi-term's char mode?

I'm an emacs noob —why can't I use this key (global-set-key (kbd "M-o") 'other-window) defined in my emacs config, in ansi-term char mode? Are all meta keybindings simply passed raw to the ...
edmqkk's user avatar
  • 125
0 votes
1 answer
253 views

Why is M-x remapped in ansi-term char mode?

I understand that you can use M-x in ansi-term's char mode by doing C-x M-x, but why can't it just be used normally? Is there some historical reason? I can use other meta commands (like M-f or M-b), ...
edmqkk's user avatar
  • 125
0 votes
1 answer
231 views

ansi-term - wrong type argument: characterp, return

When using ansi-term on Emacs a get the following error whenever I press enter in char-mode: wrong type argument: characterp, return I used toggle-debug-on-error and get the following: Debugger ...
pgaluzio's user avatar
3 votes
2 answers
1k views

How to make M-x ansi-term behave like M-x shell (opening in new window)?

I use (global-set-key (kbd "C-c a") '(lambda () (interactive) (ansi-term "/bin/bash"))) to open a bash ansi-term. Unlike M-x shell, this "occupies" the whole buffer/frame. I am wondering if one ...
Marius Hofert's user avatar
5 votes
0 answers
1k 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 ansi-...
jcubic's user avatar
  • 681
2 votes
1 answer
183 views

How to have a buffer interpret C-m as an actual carriage return

I'm using the following elisp snippet in a dedicated buffer to track progress of a wget download. (with-current-buffer buf (setq proc (apply 'start-process "my-download" buf (list "wget" (...
user1404316's user avatar
1 vote
1 answer
138 views

Launch ncurses application and cleanup once it exits

I'd like to occasionally use hg split and hg commit --interactive from Emacs, but those commands bring up a GUI. At the moment I either use a separate terminal or ansi-term for those, but would like ...
Ivan Inozemtsev's user avatar
2 votes
1 answer
116 views

How to call lynx on URL inside a program

During my LaTeX typesetting I need to "visually" check if URLs point to reacheable pages. I'd like to do it with lynx in a separate emacs buffer so I wrote this function: (defun urls-check-if-working-...
Gabriele Nicolardi's user avatar
1 vote
2 answers
423 views

Term double prompting (duplicate prompts) in Emacs

My term in emacs appear: 0;me@debian: ~me@debian:~$ instead of me@debian:~$ ~$ echo $PS1 \[\e]0;\u@\h: \w\a\]\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;33m\]\w\[\033[00m\]\[\033[0;35m\]$\[\033[0m\] ...
A. John's user avatar
  • 13
2 votes
0 answers
113 views

Multiline prompt with ansi-term

Running plain Emacs with emacs -Q then running ansi-term, if I input some long text in the prompt such that the text breaks into the next line (without hitting Return), then I hit C-x 2 to create ...
Tohiko's user avatar
  • 1,569
1 vote
1 answer
701 views

Emacs opens gitbash in new system window

I've try to follow this question and sulution Git Bash in emacs on Windows I have this function: (prefer-coding-system 'utf-8) (defun git-bash () (interactive) (let ((explicit-shell-file-name "C:/...
jcubic's user avatar
  • 681
2 votes
1 answer
369 views

Nano not displaying correctly in term and ansi-term

Nano is displayed incorrectly in emacs when using term or ansi-term. This is what nano is supposed to look like (run in an ordinary terminal emulator): This is nano as run from ansi-term: In the ...
Zorgoth's user avatar
  • 810
3 votes
0 answers
269 views

Output reflow in ansi-term [duplicate]

In gnome-terminal, the output of some commands is automatically "reflowed", in the sense that if the file tmp has content 0000000000 and the terminal has width 9, the output will be displayed as $ ...
user355559's user avatar
3 votes
2 answers
2k views

How to paste into ansi-term (evil-mode)

I want to copy some text from my browser and paste it into ansi-term. I am a vim user and I want to give spacemacs a try once again. Naturally what I did was: Opening ansi-term by typing SPC SPC ...
goFrendiAsgard's user avatar
1 vote
1 answer
3k views

Emacs incompatible with oh-my-zsh?

I'm noticing something really odd in my ansi-term windows on my new Mac, see below: I am using: GNU Emacs 27.0.50 (build 1, x86_64-apple-darwin16.7.0, NS appkit-1504.83 Version 10.12.6 (Build ...
Amelio Vazquez-Reina's user avatar
1 vote
1 answer
191 views

How to properly display script shell command output

I wish to be able to open current shell output in emacs, for that I use script command that logs all the output into file typescript. The problem is that it consist also with terminal codes for colors ...
sandric's user avatar
  • 1,221
2 votes
0 answers
222 views

ANSI TERM via `M-x TERM`: How to change line highlighting color?

How do you change the line-highlighting color in an ANSI-TERM?: I am using PDB++'s sticky mode for Python debugging. This is how to appears on a regular terminal (lubuntu 17.04): Notice the word ...
WickedJargon's user avatar
0 votes
1 answer
574 views

How to change default color theme for ansi-term?

I have the package color-theme-buffer-local, which allows you to change the default color theme on a per-buffer basis. I added this to my config: (add-hook 'term-mode (lambda nil (color-...
George's user avatar
  • 869
0 votes
1 answer
333 views

Launch Emacsclient in ansi-terminal mode?

I connect to an emacs server via emacsclient. Frequently the first thing I want open is a new buffer with an ansi-terminal in it. Is there a way to launch emacsclient and to send the command "open a ...
George's user avatar
  • 869
0 votes
1 answer
378 views

Does slime-repl-ansi-color work at all these days?

I was unable to make it display ansi colorized output in Lisp REPL despite this project claims. https://github.com/deadtrickster/slime-repl-ansi-color The code seemingly doesn't do anything except ...
ruby_object's user avatar
0 votes
1 answer
1k views

Normal C-c in ansi-term

In ansi-term, it automatically rebinds C-c to have the same keybindings as C-x. I want to turn this behaviour off, so I can access the keybindings I have behind C-c. (I know about C-c C-j, but that's ...
Kahr Kunne's user avatar
2 votes
2 answers
2k views

Fish shell looks weird in spacemacs

Any other shell besides eshell and shell in Spacemacs with Emacs v25.1.1 (GUI version) looks like this: To compare, the terminal in iTerm looks like this: The font that I use in my terminal is ...
naiveai's user avatar
  • 121
0 votes
1 answer
1k 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 ...
Startec's user avatar
  • 1,334
0 votes
2 answers
2k views

How do I open an ansi-term on a remote server via Tramp?

I am editing a file on a remote server via Tramp, and I decide that I want to open up an ansi-term session on the remote server (as opposed to relying on shell-command). How do I do this? When I run ...
Andrew's user avatar
  • 541
3 votes
2 answers
501 views

Calling emacsclient from ansi-term makes emacsclient hang, how do I get around this?

Sometimes I use ansi-term in emacsclient instead of directly using my shell. When I do this, it is not an infrequent occurrence that I forget where I am and call emacsclient someFile, which freezes ...
Andrew's user avatar
  • 541
0 votes
2 answers
659 views

backspace and backarrow don't work properly in node.js repl in emacs term

I have opened a terminal using M-x ansi-term. Everything else seems to work as expected. However, when I use the node.js repl, or the mongdb repl, or any other interactive node program, backspace ...
Alex028502's user avatar
0 votes
1 answer
260 views

How to fix <delete> and arrow keys in ansi-term on macOS

I'm running emacs on macOS, and I've run into problems with ansi-term. Using bash itself works fine, but as soon as I run a simple application with a command line interface, my <delete> and ...
achalk's user avatar
  • 569
1 vote
1 answer
525 views

Startup script for term-mode

In the documentation for shell-mode: Emacs sends the new shell the contents of the file ~/.emacs_shellname as input, if it exists, where shellname is the name of the file that the shell was ...
nalzok's user avatar
  • 665
1 vote
0 answers
510 views

ansi-term changes in line-mode not registered after char-mode

Here's the situation. I start M-x ansi-term, which launches it in term-char-mode. I type the following: echo "hello world" and press RET, which outputs on the next line the expected output hello ...
space_voyager's user avatar