33

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 ...


20

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, ...


16

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 ...


6

Another try that disowns the process so your terminal will survive even after emacs is killed. (defun run-gnome-terminal-here () (interactive "@") (shell-command (concat "konsole --workdir" (file-name-directory (or load-file-name buffer-file-name)) " > /dev/null 2>&1 & disown") nil nil))


6

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: ...


6

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 ...


6

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 ...


6

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 ...


5

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 ...


5

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 ...


5

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 ...


4

A possible solution is posted on ubuntuforums. I am posting the answer. The link suggests adding the following to ~/.Xdefaults emacs*font: 7x14 and running the command xrdb -merge ~/.Xdefaults


4

(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\" activate delay 1 try do script with command \"cd %s\" in window 1 on error beep end try end tell" default-directory)))


4

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 ...


4

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/...


4

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.


3

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'. (char-displayable-p CHAR) ...


3

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)))) (add-hook 'after-init-hook `(lambda () ...


3

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 (...


3

Like this: emacs C:\users -f eshell


3

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 ...


3

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 @...


3

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 ...


3

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-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: ...


3

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.


3

Perhaps (evil-set-initial-state 'term-mode 'normal) will do what you want.


3

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.


3

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-coding-system 'utf-8) (setq x-select-request-type '(UTF8_STRING COMPOUND_TEXT TEXT STRING)) (from here). The other possibility is to (setq magit-section-...


2

What terminal emulator are you using? Take KDE's Konsole as example, just write a function: (defun open-konsole () (interactive) (call-process "konsole" nil 0 nil "--workdir" default-directory)) The args from 5st place are konsole's argument. See your prefered terminal simulator's man page. M-x open-konsole will open a new konsole process and use ...


2

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.


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