In Shift+Up isn't recognized by Emacs in a terminal I explain how terminals translate most function keys into escape sequences, because the interface between applications and terminals transmits characters (or rather bytes), not keys. Only a few modifier+character combinations have their own character:
Ctrl plus a letter or one of @[\]^_ turns into ...
You will be more comfortable in an X11 Emacs, which can receive keyboard input and display text without going through encoding and decoding for the terminal. The main reason to use a text mode editor is to run it inside screen or tmux on a remote machine, but thanks to Tramp, it's usually easier to edit the remote file in your local Emacs. That being said, ...
First, the more general issue: terminal emulators are often limited in the control and escape sequences they can send. So: it may be the case that the terminal swallows your special characters before they reach Emacs. As a general diagnostic, you can hit C-h l (or M-x view-lossage) to see if your key combinations make it into Emacs.
For more discussion of ...
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
that key is actually sending the BS character. Emacs ought to be
treating <BS> as <DEL>, but it isn’t.
In all of those cases, the immediate ...
The Emacs manual says you can set the option frame-resize-pixelwise to non-nil to allow frame sizes by pixel. Normally the frame dimensions (not counting the menu bar, tool bar, etc) are integer multiples of frame-char-height in height and frame-char-width in width. The manual notes that you need to set this variable to non-nil in your init file so that it ...
The info reader in Emacs can be accessed with C-h i. There you can jump directly into the some-node node with g (some-node) RET.
Alternatively, you can go to the some-node node by eval'ing (info "some-node").
Note that the info reader on the terminal picks man pages when info nodes cannot be found. There is no "glibc" info node, but just a man page. To ...
There's a very underappreciated feature most libraries that handle fonts provide for us, automatic fallback to different fonts if the font one has specified does not have all glyphs necessary to display the requested text correctly.
urxvt however does intentionally not come with automatic font fallback, at least not if you're not using fonts with the xft: ...
Another try that disowns the process so your terminal will survive even after emacs is killed.
(defun run-gnome-terminal-here ()
(shell-command (concat "konsole --workdir"
(file-name-directory (or load-file-name buffer-file-name))
" > /dev/null 2>&1 & disown") nil nil))
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 the terminal you're using. The application can then use a library such as terminfo to pick the right escape sequences to use each feature of the terminal. This ...
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 same command to your .bashrc (or a similar file for your shell, if you don't use bash. but you probably do use bash).
terminfo and termcap are databases ...
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 C-c.
If you're running an Emacs instance in a term buffer in line mode, I don't think there's a direct way to kill the nested Emacs. You have to switch back ...
(defun my-applescript-fn ()
"Open the Terminal.app, wait a second, and CD to the Emacs default-directory
of current buffer."
"tell application \"Terminal\"
do script with command \"cd %s\" in window 1
end tell" default-directory)))
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 terminals offer
two different cursors: a “visible” static cursor, and a “very visible”
blinking cursor. By default, Emacs uses the very visible cursor, and
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 with it. If I know I'm about to issue such a shell command, I pull up a dedicated terminal emulator.
If you're using Emacs 24 then https://www.emacswiki.org/...
I found that I missed this in my .emacs.d configuration:
;; UTF-8 support
(setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING))
(from here). The other possibility is to
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 emulator I'm aware of which is even capable of supporting all the key sequences Emacs recognises is Thomas Dickey's xterm, and configuration is very much non-trivial (...
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) Emacs, but for a graphic display you can use char-displayable-p:
char-displayable-p is an autoloaded Lisp function in `mule-util.el'.
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 time taken to start Emacs.
(let ((my-init-time (time-to-seconds (time-since my-init-load-start))))
Make sure that your $TERM is set correctly before running Emacs.
If launching direct from the terminal, check with echo $TERM - preferably its value would be xterm-256color
Set it either directly before you run Emacs:
TERM=xterm-256color emacs -nw
With any other arguments you need.
As a more permanent solution, set the value of TERM in your terminal ...
Gilles' answer stated: On OSX, you can configure iTerm2 by selecting an escape sequence for each key combination, one by one. I had a little trouble getting there, so here a detailed explanation in case you are like me, confused.
If, when running Emacs in a terminal (e.g., Mac's default Terminal.app), C-x C-; does not run comment-line, and you would like ...
As @shosti pointed out, eshell simply doesn't support any fancy escape sequences.
However my problems with brew can be fixed by resetting fringe-mode and disabling truncate-lines in eshell buffer.
This ensures characters don't wrap to the next line and that long lines (such as the progress bar) don't get covered by the truncation glyph.
I've tried @...
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 answers on what's going on.
My case was the way emacs detects background color. It has a fallback for xterm-*, but not screen-*, and was using black background ...
I found answer by my own - part of rendering ansi color codes in emacs originally answered here, I will double it here:
(defun display-ansi-colors ()
(ansi-color-apply-on-region (point-min) (point-max)))
As for copying tmux buffer to with ansi codes for color - also was already answered here, and it here also:
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 notes, if you're going to be dumping a lot of text in a terminal, emacs will likely be too slow.
emacs --daemon starts an emacs server this needs to be done only once (for every computer start of course).
You can then connect to this server with the program emacsclient.
All files you open from command line with emacsclient -c FILENAME run with the server instance.
If you run emacs FILENAME you start a new emacs process.
When running in -nw mode, Emacs' display is at the mercy of the terminal emulator. If the emulator is using a font which doesn't have a glyph for the character you want to display, the only solution is to change it to use a different font.
ansi-term is a terminal emulator, and appears to work well enough to support ncurses applications.
There are some sticky issues with terminfo, particularly after sshing into remote systems, http://www.emacswiki.org/emacs/AnsiTermHints#toc6 has discussion about this.