Hot answers tagged

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,032
12 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
  • 76.4k
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
  • 49.7k
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
7 votes
Accepted

In term-mode how can I make line-mode the default

Looking at term.el it seems char mode is enabled right after running term-mode (and hence term-mode-hook) as such enabling term-line-mode in term-mode-hook would not work. The only option I can think ...
Iqbal Ansari's user avatar
  • 7,528
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
  • 49.7k
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
  • 16.8k
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
  • 21.9k
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
Accepted

How to get a fully functional Julia REPL in emacs?

There is a way! The problem with using term is that term doesn't understand some of the escape sequences Julia sends, which causes term to put a bunch of extra prompts on the screen that make it ...
Zorgoth's user avatar
  • 820
5 votes
Accepted

Term buffer font-size

I did this: (defun shell-hook () (text-scale-decrease 1.1)) (add-hook 'term-mode-hook 'shell-hook) and it worked beautifully
iLemming's user avatar
  • 1,233
5 votes
Accepted

Colors illegible after upgrading OS

In general, a terminal application like emacs -nw has only very limited information about what colors are available. The shell will have an environment variable called TERM which contains the name of ...
db48x's user avatar
  • 16.8k
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

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

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,083
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
  • 1,918
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

What linux terminal app is compatible with emacs keybindings?

No terminal emulator will default to supporting all of the key sequences you're asking about, because they are emulating terminals which did not support those sequences. Furthermore, the only ...
phils's user avatar
  • 49.7k
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

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
  • 18.9k
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

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
  • 49.7k
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,535
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,108
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.2k
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
Accepted

Long pause during Emacs startup, prior to init file running

A bit of added information for your init file processing time: Put this at the very start of your init file: (defvar my-init-load-start (current-time)) and this at the very end: ;; Display the ...
phils's user avatar
  • 49.7k
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
  • 76.4k

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