Questions tagged [emacs]

GNU Emacs is an extensible, customizable, self-documenting text editor, which can be extended with Lisp code. Although Emacs is a general-purpose editor, questions may be on-topic here if they are about extending Emacs itself (usually by writing Emacs Lisp functions) or about specific programming modes. Otherwise (and perhaps also in those cases), consider asking your question on Emacs Stack Exchange.

GNU Emacs is an extensible, customizable text editor. Begun in the mid-1970s as a set of macros on top of TECO, it was re-written using C and Emacs Lisp to provide portability and an extendable interface. It continues to be actively developed today.

Emacs provides context-sensitive editing modes with syntax coloring, is self documenting, has full Unicode support and extensions to do almost anything. It similarly has extensive packaging support through the built-in package.el package.

Emacs' package selection includes color themes, language-specific editing modes, RSS readers, email clients, web browsers, etc. Die-hard Emacs users do almost everything from within Emacs: write, compile, run and debug code; read/compose email; browse the web; do project planning, etc. Some other editors, like Visual Studio or Eclipse, provide Emacs key bindings.

Questions about using and configuring Emacs, not specific to programming, are off-topic for Stack Overflow, but they may be suitable for Emacs Stack Exchange. Questions about extending Emacs using Lisp or other languages, or about programming modes, are usually on-topic here.

Useful Links

Wisdom from Stack Exchange

Books

17686 questions
187
votes
7 answers

How to change size of split screen emacs windows?

I have emacs split horizontally - on top I'm editing Perl code, the bottom is the shell. By default emacs makes the two windows equal in size, but I'd like the shell buffer smaller (maybe half the size?). I was wondering how I could do that.
Steve
  • 1,873
  • 2
  • 12
  • 4
179
votes
21 answers

Set 4 Space Indent in Emacs in Text Mode

I've been unsuccessful in getting Emacs to switch from 8 space tabs to 4 space tabs when pressing the TAB in buffers with the major mode text-mode. I've added the following to my .emacs: (setq-default indent-tabs-mode nil) (setq-default tab-width…
Cristian
  • 42,563
  • 25
  • 88
  • 99
178
votes
18 answers

Using Emacs as an IDE

Currently my workflow with Emacs when I am coding in C or C++ involves three windows. The largest on the right contains the file I am working with. The left is split into two, the bottom being a shell which I use to type in compile or make…
user7545
  • 3,020
  • 4
  • 22
  • 22
175
votes
34 answers

How do I duplicate a whole line in Emacs?

I saw this same question for VIM and it has been something that I myself wanted to know how to do for Emacs. In ReSharper I use CTRL-D for this action. What is the least number of commands to perform this in Emacs?
Ray
  • 187,153
  • 97
  • 222
  • 204
175
votes
16 answers

Re-open *scratch* buffer in Emacs?

If I accidentally closed the scratch buffer in Emacs, how do I create a new scratch buffer?
Fortepianissimo
  • 3,317
  • 5
  • 21
  • 15
175
votes
4 answers

Updating packages in Emacs

I have the following setup for packages (not sure if there is a better recommended one): (require 'package) (setq package-archives '(("ELPA" . "http://tromey.com/elpa/") ("gnu" . "http://elpa.gnu.org/packages/") …
Amelio Vazquez-Reina
  • 91,494
  • 132
  • 359
  • 564
174
votes
4 answers

Who originally invented this type of syntax: -*- coding: utf-8 -*-

Python recognizes the following as instruction which defines file's encoding: # -*- coding: utf-8 -*- I definitely saw this kind of instructions before (-*- var: value -*-), so I assume Python did not invent them and is not the only one that uses…
hamstergene
  • 24,039
  • 5
  • 57
  • 72
170
votes
7 answers

Emacs - Multiple columns one buffer

I'm trying to edit some assembly code which tends to be formatted in long but thin listings. I'd like to be able to use some of the acres of horizontal space I have and see more code on-screen at one time. Is there a method for getting Emacs (or…
user119857
  • 1,771
  • 3
  • 12
  • 9
161
votes
7 answers

How to run multiple shells on Emacs

I am using Emacs 23.3.1 on windows 7. I know that I can run shell from emacs using M-x shell. I would like to have multiple shell windows in the same time, but typing M-x shell a second time just opens me the same shell window. Is there a way to…
S4M
  • 4,561
  • 6
  • 37
  • 47
158
votes
10 answers

Is there a (repeat-last-command) in Emacs?

Frequently, I've dug into apropos and docs looking for something like the following only to give up to get back to the task at hand: (repeat-last-command) do the last C- or M- command I just executed (to be rebound to a fn key) or sometimes the…
ack
  • 1,583
  • 2
  • 10
  • 4
158
votes
6 answers

How do I create a directory from within Emacs?

How exactly can I create a new directory using Emacs? What commands do I use? (If possible, please provide an example)
Ray
  • 187,153
  • 97
  • 222
  • 204
149
votes
8 answers

How to open Emacs inside Bash

I'm using Ubuntu 11.10 (Oneiric Ocelot). When I type the command "emacs" in the terminal, it opens Emacs as a separate window. How can I open it inside the terminal, like the nano editor?
jyriand
  • 2,434
  • 3
  • 23
  • 28
147
votes
6 answers

How do I byte-compile everything in my .emacs.d directory?

I have decided to check out Emacs, and I liked it very much. Now, I'm using the Emacs Starter Kit, which sort of provides better defaults and some nice customizations to default install of Emacs. I have customized it a little, added some stuff like…
Mikka
  • 2,113
  • 2
  • 16
  • 12
145
votes
6 answers

How can I delete the current line in Emacs?

What is the emacs equivalent of vi's dd? I want to delete the current line. Tried CTRL + k but it only deletes from current position.
Manoj Govindan
  • 72,339
  • 21
  • 134
  • 141
145
votes
8 answers

Emacs bulk indent for Python

Working with Python in Emacs if I want to add a try/except to a block of code, I often find that I am having to indent the whole block, line by line. In Emacs, how do you indent the whole block at once. I am not an experienced Emacs user, but just…
Vernon
  • 2,703
  • 2
  • 24
  • 30