Parent page: Programming Applications

Emacs is the extensible, customizable, self-documenting real-time display editor.

This article gives you a basic introduction to Emacs.

Installing Emacs

Install the package emacs from synaptic or type in a terminal. Or emacs-snapshot-gtk for the version which supports good readable freetype fonts,gtk and other visual goodies.

sudo apt-get install emacs

sudo apt-get install emacs-snapshot-gtk

A Quick Introduction

You can start Emacs in console mode by typing emacs -nw at the terminal or Emacs in graphical mode by typing emacs (or from Gnome menu).

Hotkeys

Here is a list of general hotkeys (M is Meta button, Alt on many keyboards; C is Ctrl):

File Keys

  • C-x C-f Open file

  • C-x C-f /sudo::/path_to_your_file Open as root

  • C-x C-s Save file (buffer)

  • C-x C-w Save file (buffer) as

  • C-x C-k Close file (buffer)

Moving Keys

  • C-a Move the the beginning of a line

  • C-e Move to the end of a line

  • C-p Move one line up

  • C-n Move one line down

  • C-< Go to the beginning of buffer (file)

  • C-> Go to the end of buffer (file)

Exit Keys

  • C-x C-c Exit Emacs

  • C-z Hide/Minimize Emacs

Search Keys

  • C-s Forward search a string

  • C-r Reverse search a string

Character Edit Keys

  • C-d Delete a character

  • M-d Delete a word

  • C-x u or C-_ Undo

Selection Keys

  • C-x h Select all buffer (file)

  • M-h Select current paragraph

  • C-SPC Start selection (mark)

Copy/Paste Keys

  • M-w Copy (Copy to kill ring)

  • C-w Cut (Kill region)

  • C-y Paste (Yank)

Buffer (Like window tabs)

  • C-x C-b List all buffers

  • C-x b Switch to previous buffer

Others

  • M-d Delete a line

  • C-g Cancel current command

Configuration

Emacs Lisp packages Directory

The directory ~/.emacs.d/ is the location for additional per-user Emacs-specific files written in Emacs Lisp programming language. Since it is located in the home directory (~/), it is unique for each user, just like the ~/.emacs init file.

Startup file

Starting with Emacs 22, the startup configuration file ~/.emacs does not exist, Emacs will try ~/.emacs.d/init.el and ~/.emacs.d/init.elc. The user independent startup file for all Emacs flavors (Emacs 19, Emacs 20, xemacs) will load /etc/emacs/site-start.el.

Further Information

The Emacs Wiki is a community website which collects ELisp code, questions and answers related to ELisp code and style; introductions to ELisp packages and links to their sources; complete manuals or documentation fragments; comments on features, differences, and history of different Emacs versions, flavors, and ports; jokes; pointers to clones and Emacs look-alikes, as well as references to other Emacs related information on the Web.


EmacsHowto (last edited 2013-11-15 16:20:58 by kermit666)