Emacs
The Thermonuclear Word Processor Text Editor
vi vs. emacs
Getting it out of the way
vi vs. emacs
Getting it out of the way
vi vs. emacs
Getting it out of the way
vi vs. emacs
Getting it out of the way
vi vs. emacs
informal, unscientific poll of JLUG meetup group
vi | 31 |
emacs | 5 |
neither/no answer | 23 |
Emacs
Summary
- What is Emacs?
- History of Emacs
- General Use
- The "Extensible" Editor
- Further Reading
What is Emacs?
The Thermonuclear Word Processor
I
use emacs, which might be thought of as a thermonuclear word
processor... If you are a professional writer... emacs
outshines all other editing software in approximately the
same way that the noonday sun does the stars. It is not just
bigger and brighter; it simply makes everything else vanish.
In the Beginning was the Command Line
-Neal Stephenson, 1998
What is Emacs?
Emacs is mind-blowing!
What is Emacs?
- Emacs is a family of 'extensible' text editors
- The most popular is GNU Emacs (latest: 24.2)
- GNU Emacs is available on a variety of platforms including Windows, Mac OS X, and GNU/Linux
- Features include:
- deep customizability
- infinite extensibility
- editing modes for different file types (e.g. HTML, JavaScript, Perl, etc.)
What is Emacs?
Getting emacs on Ubuntu 12.04
Can be as simple as: apt-get install emacs
But to get the latest, add the following to
your sources.list
:
deb http://ppa.launchpad.net/cassou/emacs/ubuntu
precise main
deb-src http://ppa.launchpad.net/cassou/emacs/ubuntu
precise main
What is Emacs?
DEMO: running emacs
What is Emacs?
EMACS could stand for
- Eight Megabytes And Constantly Swapping
- Emacs Makes A Computer Slow
- Eventually
malloc()s
All Computer Storage
- Eventually Makes All Computers Sick
- Eternally Modifying All Configuration Settings
- Escape, Meta, Alt, Control, Shift
History of emacs
or 35+ years in 5 minutes
- Emacs is old. Like, really old.
- Originally written in 1976 by Richard
Stallman and Guy L. Steele as a set
of Editor MACroS
for the TECO editor
- Between 1976 and 1984, many
Emacs-like editors were developed
- The first Unix port was Gosling Emacs, created by James Gosling
History of Emacs
Richard Stallman
History of Emacs
or 35+ years in 5 minutes
- GNU Emacs, one of GNU's first projects, was
created in 1984 (starting @ v13) as a free (as in freedom)
alternative to the proprietary Gosling Emacs
- In 1991, Emacs was forked with the
development of Lucid Emacs (now XEmacs) after frustration
with the slow development process
- Development is active. Latest release adds package management, right-to-left scripts (e.g. Hebrew), improvements to themes.
General Use
General Use
Buffers, Major & Minor Modes
- Technically, you don't edit files, but buffers
- Buffers can be attached to actual files, but need not be
- Certain buffers are created at startup (e.g. *scratch*); others hold output (e.g. *Messages*)
- Each buffer has only one major mode which allows emacs to adapt to the type of file you are writing
- Example:
html-mode
-
- Performs syntax highlighting of HTML tags
- Indents
<tags>
using tab
- Binds the command
sgml-close-tag
to C‑c C‑e
General Use
Buffers, Major & Minor Modes
- There may be many minor modes applied to a buffer.
- Minor modes should not interfere with the function of major mode
- Example:
M-x yas/minor-mode
: binds the yas-expand
function to tab
General Use
DEMO: Major & Minor modes
General Use
Keybindings
General Use
Keybindings
General Use
Keybindings
- Emacs is notorious for its sometimes complex keybindings
- Many commands are accomplished by a series of keyboard combinations (called chords)
- Meta (abbreviated M) is on most keyboards the Alt key
- Control (abbreviated C) is the Ctrl key
General Use
Keybindings
- C-x C-c: quit
- C-x C-f: open (find)
- C-x C-s: save
- C-x 1,2,3: splits emacs window
- C-k: cut line (kill line)
- C-y: paste line (yank line)
- C-s (incremental search forward)
- C-r (incremental search backward)
- M-x (run function)
- M-/ (autocomplete)
The "Extensible" Editor
or: It's a great OS; all it needs is a text editor
- The core of Emacs is written in C, but nearly all text-manipulation functions are implemented through Emacs Lisp
- The configuration file for emacs is .emacs and is written in Emacs Lisp (eval'd at startup)
(progn
(setq inhibit-startup-screen)
(set-foreground-color "white")
(set-background-color "black")
(set-cursor-color "white"))
The "Extensible" Editor
*scratch*
- Emacs is LISP machine
- Emacs starts with a buffer that evaluates LISP expressions
- Expressions evaluated in *scratch* become part of runtime environment
The "Extensible" Editor
Really important applications run on top of Emacs
M-x snake
M-x tetris
M-x doctor
M-x butterfly
The "Extensible" Editor
DEMO: M-x org-mode
FIN
Daniel Fowler