32 votes

Restart emacs from within emacs

As far as I know you cannot tell Emacs to re-start after terminating, but you can set the exit code so that the process that started Emacs in the first place can detect that you want to re-start. For ...
  • 9,012
31 votes
Accepted

Different theme for -nw (terminal)

Use display-graphic-p to determine if Emacs is in a GUI or not. Assuming solarized is installed and loaded: (if (display-graphic-p) (enable-theme 'solarized) (enable-theme 'wheatgrass)) See ...
29 votes
Accepted

Restart emacs from within emacs

Note: I have wrapped the following in a package restart-emacs available here. Here is an alternate way to achieve what you want using pure elisp (not really since you rely on a shell). The trick is ...
  • 7,368
24 votes
Accepted

emacs on terminal does not recognise option as alt-key on mac

This is a setting in Terminal. In Terminal 2.5.1 the option is set differently than in the above comments: In the main Terminal menu, choose "Preferences" to open a dialog. Click the "Profiles" icon ...
24 votes
Accepted

What was Emacs like back in the 80s?

Emacs predates GNU Emacs and thus predates Emacs Lisp. In most of the 80s, Emacs was only what we now call terminal-mode (and only one frame), and there was no mouse, menu-bar, tool-bar, fringe, ...
  • 72k
22 votes
Accepted

How to use the menu bar in terminal emacs?

I don't think the mouse really works when running in the terminal, so you cannot actually click. But to open the menus press F10 (or fn-F10 depending on your keyboard settings).
  • 1,128
21 votes
Accepted

Is there a way to detect that emacs is running in a terminal?

You can use display-graphic-p to determine if you are running in a terminal or a windowing system. For example, you could do your setup so that you only add those keybindings and theme if you know ...
21 votes
Accepted

Use Super in emacs -nw in linux

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

emacs on terminal does not recognise option as alt-key on mac

I solve the problem with answer of ohruunuruus. Maybe post a snapshot will be more easy to understand.
15 votes
Accepted

Shift+Up isn't recognized by Emacs in a terminal

A text terminal transmits only characters (more precisely, bytes), not keys. Keys and keychords (keys with modifiers) are encoded as character sequences. Keys that insert printable characters are sent ...
15 votes
Accepted

How can I look up help for a key sequence that I can't type

Evaluate the following using eval-expression (M-:) or in a scratch buffer: (describe-key (kbd "C-<whatever>"))
  • 5,038
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 ...
  • 8,739
14 votes
Accepted

less psql, more emacs

Emacs has in-built support for many databases, including Postgres. M-x sql-postgres RET
  • 300
14 votes
Accepted

`M-[` causes emacs to print weird (possibly escape) sequences

You’re in complicated territory. A terminal emulator listens for key events from the operating system, and translates them into characters. It then sends those characters to the running application (...
  • 13.3k
13 votes
Accepted

How do I disable menu-bar-mode only for tty frames?

The function display-graphic-p returns nil for non-GUI Emacs. So something like the following should work: (unless (display-graphic-p) (menu-bar-mode -1)) EDIT My original answer only works for ...
  • 20.9k
12 votes
Accepted

#000000 and true black in terminal Emacs colors

Turns out this was a problem with gnome-terminal. I fixed it by opening the profile preferences from the gnome-terminal menu bar, selecting colours, and changing the built-in scheme to Linux console.
  • 20.9k
12 votes

fix or workaround: "Terminal is not fully functional"

Quick answer That's not an issue, it's a statement of fact. M-x shell isn't a fully functional terminal - it simply can't do what you want it to do. If you want a full terminal emulator in emacs, you ...
  • 20.9k
12 votes
Accepted

Zero width space shows as underscore

Refer to C-hig (elisp)Glyphless Chars By default the zero-width characters are displayed using the thin-space display method which will "Display a thin space, 1-pixel wide on graphical displays, ...
  • 44.9k
9 votes

How can I look up help for a key sequence that I can't type

If you can't use a particular key combination because of your terminal, you can often fake it by manually simulating the key modifier. The following combinations work exactly as though you had used ...
  • 1,346
9 votes
Accepted

copy from shell and paste in terminal-emacs

You can't copy-paste between Emacs and a shell without using a system-wide copy-paste facility. Text terminals in general do not provide a copy-paste facility. It seems that you're running this ...
8 votes

How to use the menu bar in terminal emacs?

If you're intent on using the mouse, you can use a subset of mouse click functionality if your terminal is compatible with xterm. To do so, enable xterm-mouse-mode. Source: manual page on "Using a ...
  • 31.6k
8 votes

What are my options for scroll bars in terminal emacs?

This project is a good alternative: https://github.com/m2ym/yascroll-el because it works with and without GUI. Don't forget the cl require in your .emacs (require 'cl) ;; build-in librairie (require '...
  • 3,089
8 votes

How to hide leading stars in windowless emacs org-mode?

The variable org-hide-leading-stars just uses the face org-hide behind the scenes. Pressing C-hv (to get help on a variable) and then typing org-hide-leading-starsEnter will show you what you need to ...
  • 919
8 votes

What is the difference between standalone version of emacs and the one that runs inside terminal?

Some packages managers provides two different Emacs, emacs and emacs-nox. The core is the same and behave in a very similar way. The nox version (no X means without X11 support) and should be ...
  • 1,505
8 votes
Accepted

How to turn off bracketed paste mode?

My crystal ball said you should remove (global-set-key (kbd "M-[") 'previous-multiframe-window) from your ~/.emacs. You might like to M-x report-emacs-bug and ask for global-set-key to complain ...
  • 25.7k
8 votes
Accepted

Is there an Emacs package for terminal emulation?

Yes, there are many, and several of them come with Emacs. Which you will prefer depends on your precise needs. shell and eshell will both give you shells with no terminal–emulation at all. shell runs ...
  • 13.3k
7 votes
Accepted

Copy and paste between Emacs in an X terminal and other X applications

You can use the external utilities xsel or xclip (they have mostly the same features, I'll use xsel in this answer) to copy data from or to the X clipboard. To copy to the clipboard, pass the desired ...
7 votes
Accepted

Emacs in PuTTY with xterm-mouse-mode: how to paste?

If mouse reporting is on, then Shift+click is still interpreted by the terminal and not passed to the application. Thus, if a right-click pastes outside Emacs, and a straight right-click is passed ...
7 votes

less psql, more emacs

In addition to offby1's answer (which is what you were asking for) also take note of: https://www.emacswiki.org/emacs/CategorySql which covers sql-mode and sql-interactive-mode in general. https://...
  • 44.9k
7 votes
Accepted

Why I can't fold (org-cycle) in non-GUI?

I'll try to answer why pressing the Tab key leads to different results when you're using the Emacs GUI vs. Emacs in a terminal. org-cycle is bound to both <tab> and TAB (at least in my and ...
  • 2,056

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