Skip to main content
15 votes
Accepted

How can I quit Emacs from within a term within Emacs?

There are a few answers here. Quitting Emacs without C-x C-c First, you can quit emacs by running the command that C-x C-c is bound to: M-x save-buffers-kill-terminal. Alternatives to recursive ...
zck's user avatar
  • 9,092
13 votes
Accepted

How to remap backward-delete and help command while using Emacs from a terminal emulator?

From the Emacs manual, node DEL Does Not Delete: On a text terminal, if you find that <BACKSPACE> prompts for a Help command, like Control-h, instead of deleting a character, it means ...
Drew's user avatar
  • 77.7k
9 votes
Accepted

Why does emacs (getenv "TERM") return incorrect data?

Quoting startup.el: ;; Subprocesses of Emacs do not have direct access to the terminal, so ;; unless told otherwise they should only assume a dumb terminal. ;; We are careful to do it late (after ...
phils's user avatar
  • 51.3k
8 votes

Is it possible to use Bash for Windows as the term in Emacs for Windows

In my .emacs I first define a function like so (defun my-bash-on-windows-shell () (let ((explicit-shell-file-name "C:/Windows/System32/bash.exe")) (shell))) and I call at the bottom using: (...
Bas Bossink's user avatar
6 votes
Accepted

mutt (and others) in ansi-term - terrible refresh rate

The bi-directional text support introduced in Emacs 24 interacts badly with term.el when large numbers of spaces or tabs are inserted, and many applications clear the screen (often drawing a new ...
phils's user avatar
  • 51.3k
6 votes

Exit emacs client that runs inside emacs terminal buffer

If you're in term buffer in char mode, you have to escape C-c. So, if you're running a terminal Emacs instance inside the term buffer, running save-buffers-kill-terminal requires an extra C-c: C-x C-c ...
Tyler's user avatar
  • 22.3k
6 votes

TERM, terminfo, termcap. What are they how does Emacs use it?

TERM is an environment variable, you set it in your environment. This could be the environment of a particular shell that you've opened, by running export TERM=foo, or all of your shells by adding the ...
db48x's user avatar
  • 18.1k
6 votes
Accepted

Conditional True color (24 bit color) support for iTerm2 and Terminal.app in OSX with Fish shell

I believe that the @ symbols in your terminfo example are part of the Texinfo markup, rather than part of the terminfo code. Your terminfo entry should look like: # Use colon separators. xterm-24bit|...
Alan Third's user avatar
5 votes

Unable to change cursor type in terminal

On a terminal, you can't change the shape of cursor. From the Emacs manual: On a text terminal, the cursor’s appearance is controlled by the terminal, largely out of the control of Emacs. Some ...
goedson's user avatar
  • 173
5 votes
Accepted

TERM, terminfo, termcap. What are they how does Emacs use it?

Termcap and terminfo are both methods for an application running in a terminal to obtain information about the terminal — what it can do and how (e.g. its size, how to move the cursor around, etc.). ...
Gilles 'SO- stop being evil''s user avatar
5 votes
Accepted

Nano not displaying correctly in term and ansi-term

It's an off by one error in term-handle-ansi-escape, I've posted a patch in Bug#31690. --- c/lisp/term.el +++ w/lisp/term.el @@ -3386,11 +3386,10 @@ term-handle-ansi-escape ;; \E[B - cursor down (...
npostavs's user avatar
  • 9,203
5 votes
Accepted

how to map <C-M-left>, <C-M-right> etc to the correct hex codes in iterm2

You can add: For C-M-left: Send escape sequence: [1;7D For C-M-right: Send escape sequence: [1;7C For C-M-up: Send escape sequence: [1;7A For C-M-down: Send escape sequence: [1;7B And this will work ...
Didier A.'s user avatar
  • 268
5 votes
Accepted

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

This is a simplified version of a function in my .emacs file: (defun ml/bash () "Start a terminal emulator in a new window." (interactive) (split-window-sensibly) (other-window 1) (ansi-...
matteol's user avatar
  • 2,018
5 votes
Accepted

Howto display unicode character \u2026 in terminal mode in emacs

I found that I missed this in my .emacs.d configuration: ;; UTF-8 support (prefer-coding-system 'utf-8) (set-default-coding-systems 'utf-8) (set-terminal-coding-system 'utf-8) (set-keyboard-...
Konrad Eisele's user avatar
4 votes
Accepted

How to launch terminal.app from elisp

(defun my-applescript-fn () "Open the Terminal.app, wait a second, and CD to the Emacs default-directory of current buffer." (interactive) (do-applescript (format "tell application \"Terminal\" ...
lawlist's user avatar
  • 19.1k
4 votes

Emacs colors being set differently when TERM is 'screen-256color' and 'xterm-256color'

The problem is that I have no idea how the colors are set to begin with, and more importantly, why they are set differently. Perhaps this discussion on StackOverflow is relevant - some detailed ...
Noel Maersk's user avatar
4 votes
Accepted

Can I completely replace xterm with emacs' term mode?

I use ansi-term almost exclusively, so I would say "almost". Speed is your main concern -- anything which rapidly generates large amounts of output is going to cause some pain, as Emacs won't keep up ...
phils's user avatar
  • 51.3k
4 votes

How do you set colors for term?

Since in zenburn theme terminal colors look good I added the following lines in my .emacs: (custom-set-faces '(term-color-black ((t (:foreground "#3F3F3F" :background "#2B2B2B")))) '(term-color-...
Jānis Erdmanis's user avatar
4 votes
Accepted

Spacemacs - start popup terminal window in evil-normal-state

Perhaps (evil-set-initial-state 'term-mode 'normal) will do what you want.
mclear's user avatar
  • 1,555
4 votes
Accepted

C-x in terminal

It is possible to re assign C-x as an escape character: (add-hook 'term-mode-hook (lambda () ;; C-x is the prefix command, rather than C-c (term-set-escape-char ?\C-x) (define-key ...
manandearth's user avatar
  • 2,118
4 votes

How can I compile and run my C code from within Emacs like I would with the terminal?

I use the compile command, and also add a run target to my makefile like this program: program.cpp gcc program.cpp -o program run: program program So you can just use make run to compile ...
Ian4264 's user avatar
4 votes

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

I am wondering if one could adjust the above so that the ansi-term behaves like M-x shell in the sense of opening in a new window (in the current frame -- at the bottom, just like M-x shell does). ...
Basil's user avatar
  • 12.4k
4 votes
Accepted

Why does `eshell` not create an active process In Emacs while `shell` and `term` do?

As mentioned in the manual page on Processes, the term process refers to an OS process. Emacs runs in a process, but can invoke other external processes and manage them as subprocesses. When you run M-...
Trevor's user avatar
  • 56
3 votes

What linux terminal app is compatible with emacs keybindings?

If you're willing to install an Emacs package and configure your terminal, I wrote an Emacs package which can teach Emacs and terminals how to properly recognize all PC keyboard keys and modifier key ...
Vladimir Panteleev's user avatar
3 votes

ansi-term scroll problem on fast output

Solved it by myself. Just needed to add the following lines to ~/.emacs.d/init.el: (eval-after-load "term" '(progn ;; ensure that scrolling doesn't break on output (setq term-scroll-to-...
space_voyager's user avatar
3 votes

Can I completely replace xterm with emacs' term mode?

This is a helpful overview of ways to use the various shells and terminals in emacs. I use eshell for most things (here's my config for eshell) if you care to take a look. But as the other answer ...
mclear's user avatar
  • 1,555
3 votes

Copy from terminal (tmux) to emacs with color?

I found answer by my own - part of rendering ansi color codes in emacs originally answered here, I will double it here: (require 'ansi-color) (defun display-ansi-colors () (interactive) (ansi-...
sandric's user avatar
  • 1,271
3 votes

Check if terminal supports Unicode

It's probably not just about whether Unicode is available but also whether a given font supports a particular Unicode character. I'm not sure that it helps for non-graphic (i.e., console/terminal) ...
Drew's user avatar
  • 77.7k
3 votes

dirtrack mode with fish-shell

i had to fiddle with it for a while, but here's a working version of Gilles's answer. just stuff this at the end of your ~/.config/fish/config.fish. # emacs dir tracking if [ -n "$INSIDE_EMACS" ] ...
mus0u's user avatar
  • 31
3 votes

Startup script for term-mode

If you run bash in a term buffer, bash will do all of its normal bash initialisation things, just as it would when you run it inside any other terminal emulator. So you can set your prompt in your ~/....
phils's user avatar
  • 51.3k

Only top scored, non community-wiki answers of a minimum length are eligible