master a0d110d00be2 cached
14 files
219.3 KB
68.0k tokens
9 symbols
1 requests
Download .txt
Showing preview only (227K chars total). Download the full file or copy to clipboard to get everything.
Repository: pierre-lecocq/emacs4developers
Branch: master
Commit: a0d110d00be2
Files: 14
Total size: 219.3 KB

Directory structure:
gitextract_dqy0l3r9/

├── README.org
├── chapters/
│   ├── 01-introduction.org
│   ├── 02-the-basics.org
│   ├── 03-building-your-own-editor.org
│   ├── 04-emacs-developing-environments.org
│   ├── 05-special-features.org
│   └── 06-readings-and-resources.org
├── demo/
│   ├── README.org
│   ├── config.el
│   └── src/
│       ├── dummy.rb
│       └── functions.rb
└── exports/
    ├── emacs4developers.html
    ├── emacs4developers.odt
    └── emacs4developers.org

================================================
FILE CONTENTS
================================================

================================================
FILE: README.org
================================================
#+TITLE: Emacs for developers
#+AUTHOR: Pierre Lecocq
#+DESCRIPTION: Learn using Emacs as a developer
#+KEYWORDS: emacs, developer
#+STARTUP: showall

* Emacs for developers

This document will (hopefully) help you to use Emacs as a developer.

**** Disclaimer

- Work in progress, so stay tuned.
- Exports are handled by the author for the moment and do not reflect the very last changes (but are recent anyway). A scripted solution will be provided soon for contributors.

**** Contributions or requests

Do not hesitate to send a pull request or open an issue to fix, add, discuss, ... etc.

** Who is the target of this tutorial

Well, this is a good question. And I won't give an answer but some elements of answer.

What is sure is that it is not written for the people thanked below (Bastien, Dimitri, Sacha, Nic, Avdi, and so on ...), but what is interseting with Emacs is that even if you are a beginner, an intermediate / advanced user or an every day power user, you can learn from others each time you open a web page or a manual dealing with Emacs.

Therefore, this tutorial is written for people who want to improve their experience. Simple as that. Whatever is their knowledge, their feeling, their usage, their config file size (without any pun), etc ...

Remember one thing: Emacs is 30+ years old and brings new users everyday. It is a clue that this is a piece of software that deserve some attention.

* Table of contents

- 1. [[./chapters/01-introduction.org][Introduction]]
   - 1.1 [[./chapters/01-introduction.org#brief-history][Brief history]]
   - 1.2 [[./chapters/01-introduction.org#how-to-get-emacs][How to get Emacs?]]
   - 1.3 [[./chapters/01-introduction.org#more-than-an-editor][More than an editor]]
   - 1.4 [[./chapters/01-introduction.org#the-perfect-development-tool][The perfect development tool]]
- 2. [[./chapters/02-the-basics.org][The basics]]
   - 2.1 [[./chapters/02-the-basics.org#config-files][Config files]]
   - 2.2 [[./chapters/02-the-basics.org#executing-commands][Executing commands]]
   - 2.3 [[./chapters/02-the-basics.org#key-bindings][Key bindings]]
      - 2.3.1 [[./chapters/02-the-basics.org#manipulate-files][Manipulate files]]
      - 2.3.2 [[./chapters/02-the-basics.org#manipulate-the-current-line][Manipulate the current line]]
      - 2.3.3 [[./chapters/02-the-basics.org#selecting-a-region][Selecting a region]]
      - 2.3.4 [[./chapters/02-the-basics.org#commenting][Commenting]]
      - 2.3.5 [[./chapters/02-the-basics.org#windows][Windows]]
      - 2.3.6 [[./chapters/02-the-basics.org#buffers][Buffers]]
      - 2.3.7 [[./chapters/02-the-basics.org#cancel-a-command][Cancel a command]]
      - 2.3.8 [[./chapters/02-the-basics.org#the-most-useless-command][The most useless command]]
   - 2.4 [[./chapters/02-the-basics.org#help][Help!]]
- 3. [[./chapters/03-building-your-own-editor.org][Building your own editor]]
   - 3.1 [[./chapters/03-building-your-own-editor.org#first-basic-configuration][First basic configuration]]
   - 3.2 [[./chapters/03-building-your-own-editor.org#general-basic-configuration][General basic configuration]]
   - 3.3 [[./chapters/03-building-your-own-editor.org#backup-files][Backup files]]
   - 3.4 [[./chapters/03-building-your-own-editor.org#setting-up-the-locales][Setting up the locales]]
   - 3.5 [[./chapters/03-building-your-own-editor.org#more-configuration][More configuration]]
   - 3.6 [[./chapters/03-building-your-own-editor.org#modes][Modes]]
   - 3.7 [[./chapters/03-building-your-own-editor.org#package-managers][Package managers]]
   - 3.8 [[./chapters/03-building-your-own-editor.org#some-useful-packages][Some useful packages]]
   - 3.9 [[./chapters/03-building-your-own-editor.org#code-navigation][Code navigation]]
   - 3.10 [[./chapters/03-building-your-own-editor.org#setting-a-color-theme][Setting a color theme]]
- 4. [[./chapters/04-emacs-developing-environments.org][Emacs developing environments]]
   - 4.1 [[./chapters/04-emacs-developing-environments.org#emacs-for-ruby-developers][Emacs for Ruby developers]]
   - 4.2 [[./chapters/04-emacs-developing-environments.org#emacs-for-python-developers][Emacs for Python developers]]
   - 4.3 [[./chapters/04-emacs-developing-environments.org#emacs-for-ccobjective-c][Emacs for C/C++/Objective-C developers]]
   - 4.4 [[./chapters/04-emacs-developing-environments.org#emacs-for-go-developers][Emacs for Go developers]]
   - 4.5 [[./chapters/04-emacs-developing-environments.org#emacs-for-php-developers][Emacs for PHP developers]]
   - 4.6 [[./chapters/04-emacs-developing-environments.org#emacs-for-java-developers][Emacs for Java developers]]
   - 4.7 [[./chapters/04-emacs-developing-environments.org#emacs-for-r-and-statistics][Emacs for R and statistics]]
- 5. [[./chapters/05-special-features.org][Special features]]
   - 5.1 [[./chapters/05-special-features.org#emacs-as-a-file-manager][Emacs as a file manager]]
   - 5.2 [[./chapters/05-special-features.org#working-locally-vs-remotely][Working locally vs remotely]]
   - 5.3 [[./chapters/05-special-features.org#organize-your-work-write-papers-and-manage-your-agenda][Organize your work, write papers and manage your agenda]]
   - 5.4 [[./chapters/05-special-features.org#emails-in-emacs][Emails in Emacs]]
   - 5.5 [[./chapters/05-special-features.org#some-great-emacs-tips-and-tricks][Some great Emacs tips and tricks]]
   - 5.6 [[./chapters/05-special-features.org#coming-from-other-editors-ie-vim][Coming from other editors (i.e Vim or SublimeText)]]
- 6. [[./chapters/06-readings-and-resources.org][Readings and resources]]

* The demo

Here is a video that covers the basics of this tutorial.
It is a simple, annoted but efficient demo of a session in Emacs.

[[https://github.com/pierre-lecocq/emacs4developers/tree/master/demo][Here is the links, the sources and the dedicated config file!]]

* The Gnus case

If you need a detailed and explained Gnus (an Emacs mail reader) configuration example, please refer to [[http://qsdfgh.com/articles/gnus-configuration-example.html][this dedicated article]]

* Exports

This document is also available in [[./exports/emacs4developers.org][a single ORG file]], [[./exports/emacs4developers.pdf][PDF]], [[./exports/emacs4developers.odt][ODT]] and [[./exports/emacs4developers.html][HTML]].

* License

The content of this project itself is licensed under the [[http://creativecommons.org/licenses/by/3.0/us/deed.en_US][Creative Commons Attribution 3.0 license]], and the underlying source code used to format and display that content is licensed under the [[http://opensource.org/licenses/mit-license.php][MIT license]].

Contributors list can be found [[https://github.com/pierre-lecocq/emacs4developers/network/members][here]].

* Thanks

I want to thank some of the great people who make Emacs a very intersting piece of software or make its community very active (the sort order is absolutely not important here):

Bastien Guerry ([[https://twitter.com/bzg2][@bzg2]]), Dimitri Fontaine ([[https://twitter.com/tapoueh][@tapoueh]]), Julien Danjou ([[https://twitter.com/juldanjou][@juldanjou]]), Sacha Chua ([[https://twitter.com/sachac][@sachac]]), Steve Purcell ([[https://twitter.com/sanityinc][@sanityinc]]), Nic Ferrier ([[https://twitter.com/nicferrier][@nicferrier]]), Avdi Grimm ([[https://twitter.com/avdi][@avdi]]), Magnars ([[https://twitter.com/magnars][@magnars]]), Steve Yegge ([[https://twitter.com/Steve_Yegge][@Steve_Yegge]]), Bozhidar Batsov ([[https://twitter.com/bbatsov][@bbatsov]]), Xah Lee ([[https://twitter.com/xah_lee][@xah_lee]]), and many more ...

You should check those people and their work over the web, twitter, youtube, ...

And thank you for reading this !


================================================
FILE: chapters/01-introduction.org
================================================
#+TITLE: Emacs for developers - Introduction
#+AUTHOR: Pierre Lecocq
#+DESCRIPTION: Learn using Emacs as a developer
#+KEYWORDS: emacs, developer
#+STARTUP: showall

* Emacs for developers - Introduction

** Brief history

- Originally developed by Richard Stallman and Guy Steele in MIT AI lab
- First release in 1976
- Inspired by TECO editor
- Based on macros (Emacs stands for Editor MACroS)
- Written in C and Emacs Lisp
- Part of the GNU project (therefore, we /should/ say "GNU Emacs", not "Emacs")

- Despite its age, new users are still adopting Emacs as their development platform to this day!

** How to get Emacs?

On every Linux distribution, packages are available.
So run your favorite package manager to install it:

- /apt-get install emacs/
- /yum install emacs/
- ...

And if you have an exotic operating system, here are the specific distributions:

- Mac OS X: http://emacsformacosx.com/ (or with homebrew: /brew install emacs/)
- Windows: http://ftp.igh.cnrs.fr/pub/gnu/emacs/windows/

For Max OS X, the Yamamoto Mitsuharu port has some nice features an can be found via this [[https://github.com/railwaycat/emacs-mac-port][github mirror]].

But, in order to get the latest version, it's _highly recommended_ that you compile Emacs yourself: http://ftp.igh.cnrs.fr/pub/gnu/emacs/


** More than an editor

- More than an editor, it is a Lisp interpreter
- Can run any type of program written in Lisp:
  - Email clients (like [[http://www.gnus.org/][Gnus]] or [[http://www.emacswiki.org/emacs/mu4e][mu4e]])
  - Shell (like bash or eshell)
  - File and directory management (with [[http://www.gnu.org/software/emacs/manual/html_node/emacs/Dired.html][Dired mode]])
  - Agenda / Notes / TODO list / Project management (with the amazing [[http://orgmode.org][OrgMode]])
  - IRC / Twitter / Jabber / ... clients
  - Games (like Tetris, Pong, Snake, 5x5, Dunnet, ...)
  - Encrypt/decrypt files (like GPG files)
  - On-the-fly archives editing (thanks to [[http://www.emacswiki.org/emacs/ArchiveMode][archive-mode]])
  - PDF / Image / (...) viewer
  - A powerful front end to R / S+ / SPSS / Stata (with [[http://ess.r-project.org/][EmacsSpeaksStatisics)]]
  - An editor for multi-modal REPL's like IPython (with [[http://tkf.github.io/emacs-ipython-notebook/][EmacsIPythonNotebook]])
  - Music player (with emms, vlc, mplayer, ...)
  - Music programming (with [[http://vimeo.com/22798433][Overtone]])
  - Video editing
  - And so on ...
  - (and of course a document editor that can automatically generate this presentation)

It goes without saying that you can do all of this at the same time with only one Emacs instance.

** The perfect development tool

- As Emacs is a Lisp interpreter, it is extensible. Really, really extensible.
- The (unofficial) goal of Emacs is to be hacked
- Therefore, your goal is to hack Emacs to make it work exactly as you want

- Already provides so many development tools (also extensible, of course)
  - Debuggers
  - Compilers
  - Syntax checkers
  - Documentations
  - Consoles
  - ...

- Also provides /modes/ (extensions) for *every* programming language for
  - Syntax highlighting
  - Documentation search
  - Indentation
  - Source code browsing
  - Compilation commands
  - Specific behaviour
  - ...


================================================
FILE: chapters/02-the-basics.org
================================================
#+TITLE: Emacs for developers - The basics
#+AUTHOR: Pierre Lecocq
#+DESCRIPTION: Learn using Emacs as a developer
#+KEYWORDS: emacs, developer
#+STARTUP: showall

* Emacs for developers - The basics

**  Config files

In order to customize Emacs, you will have to edit its configuration files.
When you install the software, the configuration file does not exist (or is empty) and does nothing until you decide to tweak Emacs.
Some people use Emacs for decades without any extra configuration because they like it out of the box.

There are several ways to manage your Emacs configuration:

- Simply create and edit a *~/.emacs* file
- Create a *~/.emacs.d/* directory with a *~/.emacs.d/init.el* file

The first solution is great if you have a small, clean and exportable configuration file.

The second solution is great if you need several configuration files (keep your configuration parts separated) or you need to install external extensions (you will install them in *~/.emacs.d* to keep them centralized and exportable).

** Executing commands

The main idea of Emacs is that everything is a command. For example: opening a file with a keybinding calls a command that is executed by the Emacs' core.
And all the commands are written in Lisp.

To call a command, you simply have to press *Escape* and then *x*. It could be *Alt-x* for more comfort.
The official name is "/Meta x/" and is written /M-x/

If you type this key sequence, you will see at the bottom of the editor a little prompt.
This part of Emacs is called the /mini buffer/ and is used for every interactive actions.

Let's try something:

- type *M-x*
- Then, in the minibuffer, type *version* and *RET* (return)

Emacs should display the current version number of the software.

#+CAPTION: Execute the version command
[[../images/version.gif]]

Congratulations! You just called your first Emacs command.

** Key bindings

Here are the most useful keys in Emacs. You will use them several hundreds (or thousands) of times a day.

How does it work?

- The sequence /C-something/ means that you have to press and hold the /Control/ key while pressing the /something/ key. Example: /C-a/ means /Control + a/.
- The sequence /C-something somethingelse/ means that you press /Control + something/, then you release Control to press /somethingelse/.
- The sequence /C-something C-somethingelse/ means that you have to press Control while pressing /something/, then releasing /something/ and pressing /somethingelse/.

*** Manipulate files

- *C-x C-f*: open a file, which corresponds to *M-x find-file*
- *C-x C-s*: save a file, which corresponds to *M-x save-buffer*

#+CAPTION: Open a file, modify it and save it
[[../images/open-and-save.gif]]

*** Manipulate the current line

- *C-a*: go to the beginning of the current line, which corresponds to *M-x begining-of-line*
- *C-e*: go to the end of the current line, which corresponds to *M-x end-of-line*
- *C-k*: cut the rest of the line at the cursor position, which corresponds to *M-x kill-line*
- *C-y*: paste what you had cut with the command above, which corresponds to *M-x yank*
- *C-l*: center the buffer at the cursor position, which corresponds to *M-x recenter-top-bottom*

#+CAPTION: Line manipulation
[[../images/line.gif]]

*** Selecting a region

Regions are selections, in Emacs.

They are composed by two points. A starting one and and an ending one.

To select the starting point, move your cursor to the wanted location and simply press *C-Space*. In your minibuffer, you should have seen a message like "Mark set".
Now, move your cursor to the location you wantyour selection to end.

You have now a selection (or a /region/) delimited by the place you set the first mark and your cursor. With this region, you can do what ever you want:

- Copy (*M-w*)
- Cut (*C-k*)
- Paste (*C-y*)
- Replace (*M-%*)
- ... etc

#+CAPTION: Selecting a region
[[../images/selecting.gif]]

*** Commenting

In order to comment a code block, select the region you want to comment and use:

- *M-x comment-region* in order to comment the block
- *M-x uncomment-region* in order to uncomment the block

Of course, Emacs knows, according to the major mode loaded how to comment properly your code. If the major-mode is /ruby-mode/, it will add a "#" before the line; if the major-mode is /lisp-mode/, it will add ";;", and so on and so forth.

#+CAPTION: Commenting
[[../images/comment.gif]]

*** Windows

This might be confusing but a /window/ is a part of a /frame/.

An /Emacs frame/ is the window that you opened when you launched Emacs.

An /Emacs frame/ can be divided into /windows/ in itself.

- *C-x 2*: open a new window horizontally, which corresponds to *M-x split-window-below*
- *C-x 3*: open a new window vertically, which corresponds to *M-x split-window-right*
- *C-x o*: switch to the next window, which corresponds to *M-x other-window*
- *C-x 0*: close the current window, which corresponds to *M-x delete-window*
- *C-x 1*: close all the windows but the one focused, which correspond to *M-x delete-other-windows*

#+CAPTION: Windows manipulation
[[../images/windows.gif]]

*** Buffers

A /buffer/ is displayed in a /frame/.

- *C-x b*: switch to an already opened buffer, which corresponds to *M-x switch-to-buffer*
- *C-x C-b*: list opened buffer (and jump to the selected one), which corresponds to *M-x list-buffers*
- *C-x k*: kill a buffer, which corresponds to *M-x kill-buffer*

On most read-only buffers, press *q* to close it.

#+CAPTION: Buffer navigation
[[../images/buffers.gif]]

*** Cancel a command

- *C-g* or *ESC ESC ESC*: cancel the current command running in the minibuffer, which corresponds to *M-x keyboard-quit*

It also cancels all previously pressed keys.

*** The most useless command

- *C-x C-c*: quit emacs (use at your own risks!), which corresponds to *M-x save-buffers-kill-terminal*

** Help!

Emacs has a powerful built-in help system for key bindings and internal functionalities.

- *C-h f <function-name>*: Find the key binding corresponding to <function-name> (ex: C-h f save-buffer)
- *C-h k <key-sequence>*: Find the function name corresponding to <key-sequence> (ex: C-h k C-x C-s)
- *C-h v var*: Display the documentation of the Lisp variable var (describe-variable) (ex: C-h v emacs-version)
- *<key-sequence> C-h*: Show the next possible keys to press after the <key-sequence> (ex: C-x 4 C-h)

For more detail about Emacs help system, see: https://www.gnu.org/software/emacs/manual/html_node/emacs/Help-Summary.html

When executing these commands, a new frame opens. To close it, switch to it (/C-x o/) and type /q/. If not, simply close it (/C-x 0/)

After executing a command with M-x, if the command have a corresponding keybinding bound to it, a message indicating what to press will appear in the minibuffer.

Emacs also includes the full manual (also available online: http://www.gnu.org/software/emacs/manual/html_node/emacs/)

- *C-h r*: browse the Emacs manual within Emacs

Finally, there are so many other help functions: http://www.emacswiki.org/emacs/EmacsNewbieHelpReference


================================================
FILE: chapters/03-building-your-own-editor.org
================================================
#+TITLE: Emacs for developers - Building your own editor
#+AUTHOR: Pierre Lecocq
#+DESCRIPTION: Learn using Emacs as a developer
#+KEYWORDS: emacs, developer
#+STARTUP: showall

* Emacs for developers - Building your own editor

From this moment on, we will edit the configuration file.
For now, we will put everything in a single *~/.emacs.d/init.el* file. Create it if it does not exist.

#+BEGIN_SRC sh
# Backup old configuration
cp .emacs dot-emacs.old
cp -R .emacs.d dot-emacs.d.old

# Create new and empty configuration
mkdir ~/.emacs.d
touch ~/.emacs.d/init.el
#+END_SRC

** First basic configuration

When you will have to change or add configuration, simply edit your *~/.emacs.d/init.el* file and add what you need.

For example, here is a tweak that does nothing visually but is useful for other packages and the Emacs engine itself.
It allows you to define your name and email. Emacs can use it to add author information to a file when asked.

#+BEGIN_SRC lisp
(setq user-full-name "Your full name")
(setq user-mail-address "your@email.com")
#+END_SRC

After each configuration modification, two solutions:

- the soft & clever way: execute *M-x eval-buffer*
- the hard way: restart Emacs.

** General basic configuration

Now, let's move on to a basic set of more visual basic configurations.
As you did earlier, simply add this to your configuration file:

#+BEGIN_SRC lisp
;; Ask "y" or "n" instead of "yes" or "no". Yes, laziness is great.
(fset 'yes-or-no-p 'y-or-n-p)

;; Highlight corresponding parentheses when cursor is on one
(show-paren-mode t)

;; Highlight tabulations
(setq-default highlight-tabs t)

;; Show trailing white spaces
(setq-default show-trailing-whitespace t)

;; Remove useless whitespace before saving a file
(add-hook 'before-save-hook 'whitespace-cleanup)
(add-hook 'before-save-hook (lambda() (delete-trailing-whitespace)))
#+END_SRC

** Backup files

You may have notice that the files you edit are duplicated and renamed with a /~/ at the end.
They are the backup files that Emacs creates for you with the auto-save feature.
Sometimes it is great because you can recover a file in case of error, sometimes it is annoying because you can have so many of these files.

It is up to you to keep it or disable it.
Here is the configuration to disable it:

#+BEGIN_SRC lisp
;; Remove all backup files
(setq make-backup-files nil)
(setq backup-inhibited t)
(setq auto-save-default nil)
#+END_SRC

An alternative method is to save these backups in a centralized directory:

#+BEGIN_SRC lisp
;; Save backup files in a dedicated directory
(setq backup-directory-alist '(("." . "~/.saves")))
#+END_SRC

** Setting up the locales

You may want to set up a specific locale for your files.
This will do the trick:

#+BEGIN_SRC lisp
;; Set locale to UTF8
(set-language-environment 'utf-8)
(set-terminal-coding-system 'utf-8)
(setq locale-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
#+END_SRC

** More configuration

The best way to improve your configuration is to read the [[http://www.gnu.org/software/emacs/manual/][manual]] ...
But you can also (this is the unofficial method) read others Emacs users' config files.
There are so many people who share their configuration, comment their code, and distribute their modes!

Here is mine: (https://github.com/pierre-lecocq/emacs.d)

If you are a heavy VIM user, you can bring you VIM experience to Emacs by using [[https://github.com/syl20bnr/spacemacs][Spacemacs]]. You can also
find [[https://github.com/emacs-tw/awesome-emacs#starter-kit][Starter Kit]] to start with Emacs.

** Modes

/Modes/ are Emacs /extensions/ that can be installed to extend the capabilities of Emacs. They will allow you to build a powerful tailored editor.

There are 2 kinds of modes: major and minor.

*** Major modes

Major modes are modes that transform Emacs to a specialized software for editing a certain type of files (i.e c-mode) or managing special tasks (i.e reading emails, managing git repository, ...)

Only one major mode can be used at a time.

*** Minor modes

Minor modes are additional modes that are added transparently to the major mode. They add features and behavior (i.e parentheses matching, syntax or spelling checkers, ...)

Several minor modes can be used at any given time.

** Package managers

Emacs has brilliant package managers such as /package.el/ or /el-get/ that allows you to add and update modes really easily.

*** Package.el

/package.el/ is the built in package manager shipped by default with Emacs 24 or later.

To list available packages, simply type this command:

#+BEGIN_SRC lisp
M-x package-list-packages
#+END_SRC

You will see a list of packages. Simply press ENTER on the name of one of them to install it.

Additionally, you can manage the packages list by adding other sources to your configuration file:

#+BEGIN_SRC lisp
;; Add package sources
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
                         ("marmalade" . "http://marmalade-repo.org/packages/")
                         ("melpa" . "http://melpa.org/packages/")))
#+END_SRC

*** El-Get

/[[https://github.com/dimitri/el-get][el-get]]/ is one of the most popular and easy-to-use package managers. It's the "/apt-get/" of Emacs.
It is written by the great [[https://github.com/dimitri][Dimitri Fontaine]] and is based on recipe files that simply describe where the package is located and how to get/compile/install it for you.

To use it, simply add this to your configuration file. It will download and set up /el-get/ for you:

#+BEGIN_SRC lisp
;; Set up el-get
(add-to-list 'load-path "~/.emacs.d/el-get/el-get")
(unless (require 'el-get nil 'noerror)
  (with-current-buffer
      (url-retrieve-synchronously
       "https://raw.github.com/dimitri/el-get/master/el-get-install.el")
    (let (el-get-master-branch)
      (goto-char (point-max))
      (eval-print-last-sexp))))
#+END_SRC

*** The generic method

In order to leave you the choice of the package manager you want to use, here is a function that handles several package managers. For now, it covers /package.el/ and /el-get/.

It also allows you to automatically install packages you want.

In the following snippet, two sample packages are installed

- /color-theme/ in order to allow us to  change colors themes
- /autopair/ in order to close automatically parentheses, brackets and braces when you open it

Simply add this code to your configuration file:

#+BEGIN_SRC lisp
;; Set up the package manager of choice. Supports "el-get" and "package.el"
(setq pmoc "el-get")

;; List of all wanted packages
(setq
 wanted-packages
 '(
   color-theme
   autopair
))

;; Package manager and packages handler
(defun install-wanted-packages ()
  "Install wanted packages according to a specific package manager"
  (interactive)
  (cond
   ;; package.el
   ((string= pmoc "package.el")
    (require 'package)
    (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))
    (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
    (add-to-list 'package-archives '("marmelade" . "http://marmalade-repo.org/packages/"))
    (package-initialize)
    (let ((need-refresh nil))
      (mapc (lambda (package-name)
          (unless (package-installed-p package-name)
        (set 'need-refresh t))) wanted-packages)
      (if need-refresh
        (package-refresh-contents)))
    (mapc (lambda (package-name)
        (unless (package-installed-p package-name)
          (package-install package-name))) wanted-packages)
    )
   ;; el-get
   ((string= pmoc "el-get")
    (add-to-list 'load-path "~/.emacs.d/el-get/el-get")
    (unless (require 'el-get nil 'noerror)
      (with-current-buffer
      (url-retrieve-synchronously
       "https://raw.github.com/dimitri/el-get/master/el-get-install.el")
    (let (el-get-master-branch)
      (goto-char (point-max))
      (eval-print-last-sexp))))
    (el-get 'sync wanted-packages))
   ;; fallback
   (t (error "Unsupported package manager")))
  )

;; Install wanted packages
(install-wanted-packages)
#+END_SRC

Note that some of the following package names could vary if you use /package.el/ or /el-get/.

*** The modern and efficient way

Some upper-level packages make package management easier and cleaner.

For example, John Wiegley's =use-package= software is an elegant and efficient way to install and tidy your external packages configurations.

Here is the way to use it:

First, setup packages sources and install =use-package=

#+BEGIN_SRC lisp
(require 'package)
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
                         ("marmalade" . "http://marmalade-repo.org/packages/")
                         ("melpa" . "http://melpa.org/packages/")))
(package-initialize)

(unless (package-installed-p 'use-package)
  (progn
    (package-refresh-contents)
    (package-install 'use-package)))

(require 'use-package)
#+END_SRC

Then, for each package you want to install, simply add this to your configuration (replace /the-package-name/ by any package name):

#+BEGIN_SRC LISP
(use-package the-package-name
         :ensure the-package-name
         :init (progn
                  ;; Do something after the package is initialized
                ))
#+END_SRC


** Some useful packages

As a developer, you will need some packages that will help you to work, increase your productivity and enhance your comfort while coding.
Please note that even if I am a Ruby/shell/Lisp/web/PHP developer, some packages are compatible and useful for every kind of development. Therefore, the base packages are listed here but some specific packages that might be useful for your work may not be listed here. It is up to you to adapt the list according to your needs!

Tip: After adding packages, restart Emacs in order to let your package manager download and install it properly.

*** Auto complete

Auto completion is a must-have feature in the development world.
This package simply displays a popup at the cursor position with the available completions.

To install it, add =auto-complete= to your packages list.

[[http://www.emacswiki.org/emacs/AutoComplete][Read more]]

[[../images/mode-autocomplete.gif]]

BUT there is a more "modern" mode for auto-completion: /company-mode/. I switched to it in order to try and play with it. It seems very efficient and useful.

To install it, add =company-mode= to your packages list.

[[http://company-mode.github.io/][Read more about company-mode]]

*** Autopair

When you open a quote/parenthese/bracket/curly bracket, this mode automatically adds the closed one and bring your cursor between the two.
Very useful to avoid syntax errors, for example.

To install it, add =autopair= to your packages list.

[[https://github.com/capitaomorte/autopair][Read more]]

[[../images/mode-autopair.gif]]

*** Buffer move

This mode allows you to re-organize and move the buffers from a window to another.
Useful if you want to switch buffer places in order to have your debugging buffer on the right side, for example.

To install it, add =buffer-move= to your packages list.

[[http://www.emacswiki.org/cgi-bin/wiki/buffer-move.el][Read more]]

[[../images/mode-buffermove.gif]]

*** Flycheck

This mode check the syntax of a buffer. It could be used for checking code syntax or typos when writing any kind of text.

To install it, add =flycheck= to your packages list.

[[http://flycheck.readthedocs.org/en/latest/][Read more]]

*** Highlight symbol

This mode highlights all symbols that matches a pattern in your buffer

To install it, add =highlight-symbol= to your packages list.

[[http://www.emacswiki.org/emacs/HighlightSymbol][Read more]]

*** Ido

Ido is a must have mode to navigate, find stuffs, and do things interactively.
It is for comfort, but is indispensable to go fast.

Many extensions of this mode are available, therefore read and chose what you want.

I personally use two of them: /vertical/ and /hack/.

To install it, add =ido-hacks= and =ido-vertical-mode= to your packages list.

[[http://www.emacswiki.org/emacs/InteractivelyDoThings][Read more]]

[[../images/mode-ido.gif]]

*** JS3

This mode is an enhanced mode for editing Javascript files. I do not use it a lot, but it is useful for some javascript-like or NPM files.

To install it, add =js3-mode= to your packages list.

[[http://www.emacswiki.org/emacs/Js2Mode][Read more]]

*** Magit

Magit is a very powerful and elegant mode for interacting with your git repository.
In order to understand how powerful it is, simply watch this amazing [[http://vimeo.com/2871241][video]].

Once installed, always keep the [[http://daemianmack.com/magit-cheatsheet.html][magit cheatsheet]] around.

To install it, add =magit= to your packages list.

*** Git time machine

In addition to Magit, there is an interesting package that allows you to travel in time accross the different versions of a file stored in Git.

Here is a demo and its repository: [[https://github.com/pidu/git-timemachine][git-timemachine on github]].

To install it, add =git-timemachine= to your packages list.

[[https://github.com/magit/magit][Read more]]

*** Multiple cursors

This mode is great and super powerful. Instead of explaining what it is, I'll point you to this amazing [[http://emacsrocks.com/e13.html][video]] by Magnars.

To install it, add =multiple-cursors= to your packages list.

[[https://github.com/magnars/multiple-cursors.el][Read more]]

*** PHP mode

A basic but stable mode for editing PHP files, whatever you think about PHP ...

To install it, add =php-mode= to your packages list.

[[http://php-mode.sourceforge.net/][Read more]]

*** Rainbow mode

A toyish but indispensable mode to add colors to your CSS files when using properties like "color", "background-color".
It is great because it understands every way to write a color (hex, name, ...) and gives you a preview of the color itself.

To install it, add =rainbow-mode= to your packages list.

[[http://julien.danjou.info/projects/emacs-packages][Read more]]

*** RHTML mode

This mode is useful for editing .rhtml files. You can also use it to edit any kind of ruby templates (i.e .erb).

To install it, add =rhtml-mode= to your packages list.

[[https://github.com/eschulte/rhtml][Read more]]

*** Ruby mode

Do I really need to explain ?

Ruby mode is already installed in Emacs and is very stable.

[[http://www.emacswiki.org/emacs/RubyMode][Read more]]

*** Switch window

This mode is cool when you work with a lot of windows opened.
If you want to switch to another one, you have to press *C-x o* until you reach the wanted window.
With this mode, when you press *C-x o*, big numbers replace your opened windows. Simply type the corresponding number to reach the wanted window.

To install it, add =switch-window= to your packages list.

Then do not forget to override the default configuration by adding this to your configuration:

#+BEGIN_SRC lisp
(global-set-key (kbd "C-x o") 'switch-window)
#+END_SRC

[[https://github.com/dimitri/switch-window][Read more]]

[[../images/mode-switchwindow.gif]]

*** Visual regexp

This mode highlights the text that matches the regexp that you are writing in the mini buffer.

To install it, add =visual-regexp= to your packages list.

[[https://github.com/benma/visual-regexp.el][Read more]]

*** YAML mode

Allows you to edit YAML files

To install it, add =yaml-mode= to your packages list.

[[http://www.emacswiki.org/emacs/YamlMode][Read more]]

*** Yasnippet

A mode that allows you to write code faster if you are lazy.
It is very easy to create your own snippets and use it whatever the file you are editing (code, non-code, emails, ...)

I personally do not use it, but people coming from Textmate/Sublime would love it.

To install it, add =yasnippet= to your packages list.

[[http://www.emacswiki.org/emacs/Yasnippet][Read more]]

*** Paredit

Paredit is a really cool mode to "keep parentheses balanced" and navigating in the S-expressions. Useful and indispensable if you write Lisp code, for example.

To install it, add =paredit= to your packages list.

[[http://www.emacswiki.org/emacs/ParEdit][Read more]]

** Code navigation

Navigate through source code is an indispensable feature in code editors. Some other editors are focused on this (like Sublime) but the problem is that they do not leave you the choice of weapons (like every other features).

Emacs, as you noticed (yes, you did) can integrate any external tool or include a large variety of internal tools to make it more efficient. Code navigation is not an exception.

There are a lot of packages that exist to navigate through code, with different methodologies and advantages:

- [[http://www.emacswiki.org/emacs/EmacsTags][TAGS]] (built in. No installation required)
- [[https://github.com/bbatsov/projectile][Projectile]] (install it by adding =projectile= to your packages list)
- [[https://github.com/emacs-helm/helm][Helm]] (install it by adding =helm= to your packages list)
- [[http://cedet.sourceforge.net/][Emacs CEDET]] (install it by adding =cedet= to your packages list)
- ...

(Note: use once at a time! You do not need to install them all.)

After using /Projectile/ for a certain period of time, I gave /Helm/ a shot but finally got back to the simplicity and the efficiency of the /TAGS/ system.
Nevertheless, /Projectile/ and /Helm/ are really powerful and useful. You really should look at them.

For now, I will cover the basics of /TAGS/ since it is a standard (used by other software) and it is built-in (so if you use another Emacs without your config, you still know how to surf in the code). And other useful tricks will be shown here.

*** Tags basics

Basically, the TAGS rely on an index file of the content of your code source.
In the root folder of a project, you must generate your index.
Several methods for this, but here is one command that generates the file:

#+begin_src sh
cd /path/to/your/project
find . -regex ".*\.\(c\|h\|rb\|py\|php\|js\|sh\|bash\)" -print | xargs etags -a
#+end_src

You now should see a "TAGS" file. If needed, exclude this file from your git/svn/whatever repository/.

You are now ready to surf!

Now, here are the main commands to use them:

- *M-.* is the equivalent of *M-x find-tag*: find a tag
- *M-x find-tag-other-window*: find a tag, but in another window
- *M-x tags-search*: find a tag thanks to a regexp
- *M-x tags-query-replace*: replace a tag in all the indexed files
- *M-x tags-apropos*: list all tags that match a regexp
- *M-x list-tags*: list all tags in a file

*** List functions or methods

In order to list and jump easily between the functions or methods of the current file, here is a little trick:

#+begin_src emacs-lisp
(global-set-key (kbd "C-S-f") 'imenu) ;; use iMenu
#+end_src

After pressing Ctrl-Shift-f (replace it by whatever you want!), a menu with all the available resources appears in the minibuffer.
Select the resource you want (let's say /All.methods/ if you are editing some code) and you will be able to search and jump to a method definition directly.

*** Files navigation (a.k.a fuzzy matching) with TAGS and ido

In order to find and jump easily to a file in your project thanks to TAGS, you have to add a little function to your configuration.
For this you should have installed the =ido-mode= described above.

#+begin_src emacs-lisp
(defun ido-find-file-in-tag-files ()
  (interactive)
  (save-excursion
    (let ((enable-recursive-minibuffers t))
      (visit-tags-table-buffer))
    (find-file
     (expand-file-name
      (ido-completing-read
       "Project file: " (tags-table-files) nil t)))))

(global-set-key (kbd "C-S-x C-S-f") 'ido-find-file-in-tag-files)
#+end_src

Now, in your project folder and once you generated your TAGS file, you can press *C-S-x C-S-f* to find files through the whole tree of directories just by typing a pattern.

[[../images/fuzzy.gif]]

*** RGrep

/rgrep/ is a great tool to use in addition of the TAGS. It is a Unix tool that make /grep/ queries recursively. In Emacs, it will show you a new buffer with all the results of the command. To use it, simply type:

*M-x rgrep RET yoursearchterm RET*

Once fired, you can switch to the newly created buffer, parse the results and jump to the wanted files very quickly.

What is cool is that it is integrated in the editor, just beside your code --  it does not require you to switch to a shell and then copy-paste the file you want.

[[../images/rgrep.gif]]

** Setting a color theme

Now, we are talking about something very touchy and that can be a long quest ...

A color theme generally includes colors for:

- background
- syntax color (for code)
- specific modes colors (gnus, dired, git, ...)

There are several ways to install a color theme, but first, we will use the Emacs' internal color-theme library.

Let's try to switch between different themes:

- Type *M-x load-theme RET tango-dark*
- Then type *M-x load-theme RET wombat*
- Finally type *M-x load-theme RET whiteboard*

There is no secret or perfect color theme. There are so many of theme and each user has its preferences in term of colors.

#+CAPTION: color themes
[[../images/colors.gif]]

In order to choose yours, try the default ones, Google a lot or why not considering making your own?

Tip: for an effective choice, here are two showcases:

- [[http://pawelbx.github.io/emacs-theme-gallery/]]
- http://gnuemacscolorthemetest.googlecode.com/svn/html/index-el.html


*** Font settings

After setting up your theme, there are some other tweaks that are "color theme related".
Fonts are something very important depending on your system, your screen size, your current task in Emacs, ... etc

If you want to change the font directly from your current Emacs instance, simply type *M-x set-frame-font RET*.
And if you want to see all supported fonts, type *TAB* twice. It will show you a list.

The global and easy way to do it is to add a line to your configuration:

#+BEGIN_SRC lisp
(set-default-font "DejaVu Sans Mono-10")
#+END_SRC

But to be safe, you'd better add this into your X resource settings file (~/.Xresources):

#+BEGIN_SRC lisp
emacs.font: DejaVu Sans Mono-10
#+END_SRC

Of course, it is possible to set a different font for any system or mode you want. It is cool since you can use different font (size) if you are on Linux or mac OR if you write a book, write code, read your emails, ... etc.
As an exercise, I'll let you search how to do this kind of stuff in Emacs Lisp if you need it.

If you want more about font settings and especially about font names, please see the [[http://www.emacswiki.org/emacs/SetFonts][Emacs wiki page]] or the [[http://www.gnu.org/software/emacs/manual/html_node/emacs/Fonts.html][manual]].

One last point: sometimes you want to change the font size of your current buffer. To do this, simply type:

- *M-x text-scale-increase* or *C-x C-+*
- *M-x text-scale-decrease* or *C-x C--* (Ctrl x, Ctrl dash)

Really handy if you show your screen through an external display or you want to focus on a specific part of a file.


================================================
FILE: chapters/04-emacs-developing-environments.org
================================================
#+TITLE: Emacs for developers - Emacs developing environments
#+AUTHOR: Pierre Lecocq
#+DESCRIPTION: Learn using Emacs as a developer
#+KEYWORDS: emacs, developer
#+STARTUP: showall

* Emacs for developers - Emacs developing environments

Emacs, thanks to major and minor modes, can be transformed into a powerful specific development environment.

According to the kind of files you are editing (or a command you type), it can change and give you specific features that fit the need of a programming language (or a task like debugging, launching unit tests, ...)

** Emacs for Ruby developers

There are many Ruby developers who describe their setup around the web. Here are the most popular:

- [[http://devblog.avdi.org/category/emacs-reboot/][The Emacs reboot series, by Avdi Grimm]] (Avdi is a famous ruby programmer and a great Emacs hacker)
- [[http://crypt.codemancers.com/posts/2013-09-26-setting-up-emacs-as-development-environment-on-osx/][Setting up Emacs as Ruby development environment on OSX]] (even if it is for OSX, the packages remain the same on all OSes)
- [[http://lorefnon.me/2014/02/02/configuring-emacs-for-rails.html][Configuring Emacs as a productive development environment for Rails development]]
- [[http://www.emacswiki.org/emacs/RubyOnRails][The EmacsWiki on Ruby and RoR]]

** Emacs for Python developers

Here are some resources about configuring Emacs for developing in Python:

- [[http://caisah.info/emacs-for-python/][Emacs for python - on caisah.info]]
- [[http://www.emacswiki.org/emacs/PythonProgrammingInEmacs][Python programming in Emacs - on the EmacsWiki]]

** Emacs for C/C++/Objective-C

C languages are very well handled by Emacs and it allows you to edit, debug and run programs with Emacs very easily, with all the control you want.

- [[http://tuhdo.github.io/c-ide.html][C/C++ Development Environment for Emacs]] is a very complete article about this
- [[http://stackoverflow.com/questions/5800317/emacs-as-a-c-programming-ide-configuration][A various tips and packages for C language(s)]] on StackOverflow
- [[http://truongtx.me/2013/03/10/emacs-setting-up-perfect-environment-for-cc-programming/][Setting up perfect environment for C/C++ Programming]] (according to its author. Good resource, though)
- [[http://www.emacswiki.org/emacs/DebuggingWithEmacs][Debugging with Emacs]]
- [[http://cedet.sourceforge.net/][CEDET - Collection of Emacs Development Environment Tools]] An amazing collection of tools for developing in many programming languages, especially for C/C++
- [[http://alexott.net/en/writings/emacs-devenv/EmacsCedet.html][How to configure CEDET]]

** Emacs for Go developers

- If you develop in Go, you really should refer to the great [[http://yousefourabi.com/blog/2014/05/emacs-for-go/][Emacs for Go]] article, written by Yousef Ourabi.
- Another one, with videos, is written by Dominik Honnef: [[http://dominik.honnef.co/posts/2013/03/writing_go_in_emacs/][Writing Go in Emacs]]

** Emacs for PHP developers

PHP, along with all the web technologies (HTML/JS/CSS) are very well supported in Emacs. The PHP mode does almost all the work by itself.

- [[http://www.emacswiki.org/emacs/PhpMode][The EmacsWiki page about php-mode and other associated packages]]
- [[http://stackoverflow.com/questions/912671/what-is-a-good-setup-for-editing-php-in-emacs][A list of useful packages for PHP - on StackOverflow]]
- [[https://drupal.org/node/59868][An example setup for working on Drupal]] (but can be used for PHP in general)
- [[https://code.google.com/p/geben-on-emacs/][GEBEN - remote debugging environment for Emacs]]
- [[http://web-mode.org/][Web Mode - focused on web templates (HTML/JS/CSS)]]

** Emacs for Java developers

Java development is held by Eclipse. But it is not the only editor/environment that allows you to develop in Java!

- [[http://jdee.sourceforge.net/][JDEE - the Java Development Environment for Emacs]]
- [[http://www.emacswiki.org/emacs/JavaDevelopmentEnvironment][The EmacsWiki article on JDEE]]
- [[http:][A video demo of a full Java environment on Emacs]]

** Emacs for R and statistics

Emacs is very useful for scientists and people dealing with data. Statistics, analysis, plotting, ... everything can be done within Emacs.

- [[https://github.com/vikasrawal/orgpaper/blob/master/orgpapers.org][An amazing paper on working with Emacs, OrgMode and R]]
- [[http://ess.r-project.org/][Emacs Speaks Statistics]] is a great project that adds a full statistics environment to your Emacs
- [[http://stats.blogoverflow.com/2011/08/using-emacs-to-work-with-r/][A tutorial on using ESS]]


================================================
FILE: chapters/05-special-features.org
================================================
#+TITLE: Emacs for developers - Special features
#+AUTHOR: Pierre Lecocq
#+DESCRIPTION: Learn using Emacs as a developer
#+KEYWORDS: emacs, developer
#+STARTUP: showall

* Emacs for developers - Special features

** Emacs as a file manager

Emacs has a built-in mode named /dired/ that allows you to manage your file system directly in Emacs really easily.
It is very powerful and has features that graphical file managers do not have.

First of all, to launch it, type:

- *M-x dired RET* and then select a path to open (default is the directory of the file you are editing)
- or *C-x d* if you prefer keybindings

Here are a few quick shortcuts once you are in /dired mode/

- *R* (capital R): rename a file
- *D* (capital D): delete a file
- *+*: create a new directory
- *Z*: compress the file
- *RET* (enter): Open the file
- *g*: refresh
- *q*: close the dired window

Of course, files can be marked to operate on a selection of them. Use *m* to mark, *u* to unmark (*U* to unmark all), *% m* to mark according to a pattern.

Note that there are so many tricks, extensions and features in /dired mode/ that I let you see around what you need.

[[http://www.emacswiki.org/emacs/DiredMode][Read more about Dired]]

[[https://www.gnu.org/software/emacs/manual/html_node/emacs/Dired.html][Read the manual]]

** Working locally vs remotely

Emacs, once installed on your machine will allow you to edit your file locally, obviously.

Other people (non-Emacs users) will do a dirty trick to edit remote files like they were local files. They will mount the remote directory on their machine (thanks to /sshfs/).
But the magic in Emacs is that you can transparently edit remote files on your development servers for example.
To do so, Emacs comes with an ingenious extension named "Tramp". It is already installed and available when you install Emacs.

If you press *C-x C-f*, you can open a file. But if you ask =myname@myserver.com:/path/to/file=, it will automatically connect to the server and let you edit the remote file. Easy as pie.
/Tramp/ supports lots of protocols like ssh, ftp, and so on.

And what is great is that if you are editing a remote file and you launch a shell in Emacs, it will automatically set the shell into your remote environment and open it as if you were in the remote directory the file is in.

A last tip about TRAMP. If you simply add =sudo:= in front of your file path, you edit your file with higher privileges. It is a very useful feature if you need to edit your configuration files on a server, for example. Of course, it works remotely and locally.

[[http://www.emacswiki.org/emacs/TrampMode][Read more about Tramp]]

** Organize your work, write papers and manage your agenda

In Emacs, you can do everything. This is a fact.

One the most amazing and complete mode is the amazing [[http://orgmode.org][Org mode]], written by amazing people.
But when I say amazing, it is absolutely amazing. It allows you to "live in Emacs".

Here a a few of its am... features:

- A full agenda / calendar
- TODO lists and project management
- Writing (research papers, books, an "Emacs for developers" whitepaper, your shopping list ...)
- Include code in you papers
- Tables and spreadsheets (with formulas and calculation)
- Mobile integration
- ...

And what is really cool is that every thing you do in Org is exportable in:

- PDF
- LaTex
- HTML
- Text
- ODT
- iCalendar
- TextInfo
- ... and many more.

You really should check their [[http://orgmode.org/features.html][list of features]].

If you want to see a good example of Org-mode capabilities, check [[http://home.fnal.gov/~neilsen/notebook/orgExamples/org-examples.html][that great page]].

** Emails in Emacs

There are packages that let you use Emacs as a full featured MUA.
Reading emails, sending emails, filtering, archiving ... etc.

Emacs can be a very powerful and fast e-mail client and as it is controlled by the keyboard, it could be more efficient than a graphical e-mail client (clicking is a loss of time).
I've used it for years now and I can not imagine using another program to read my emails.

There are several package to do so, but the most used is [[http://www.gnus.org/][Gnus]]. It is already installed with Emacs.

Here are some of its features beside the basic ones:

- Gnus is in fact a newsreader used to interact with email servers. So you can use to fetch messages from newsgroups, RSS, SMTP, POP, ...
- Easy and powerful mail splitting
- Integration with BBDB, a contact manager
- Message scoring
- LDAP
- PGP signing and encrypting
- Customizable layout
- Encrypted file to manage your credentials
- ... and many more
- ... and of course, it is extensible thanks to Lisp

You really should try it with your personal account. It is easy to configure and integrate with [[http://www.emacswiki.org/emacs/GnusGmail][Gmail]], for example.

If you want a complete configuration example with some of the most important features (imap, smtp, search, contacts, GPG signature, display customization, ...), please refer to this dedicated article: [[http://qsdfgh.com/articles/gnus-configuration-example.html][Gnus configuration example]]

But be careful! If you try it, you will love it.

Some alternatives to Gnus (that I do not use, but that are popular):
- [[http://www.emacswiki.org/emacs/WanderLust][Wanderlust]]
- [[http://www.djcbsoftware.nl/code/mu/mu4e.html][Mu4e]]

** Some great Emacs tips and tricks

- Emacs is all about Macros. This is one of its most powerful feature. Record a sequence and re-play it on other lines! Here is [[http://www.thegeekstuff.com/2010/07/emacs-macro-tutorial-how-to-record-and-play/][how]].
- Using [[http://www.masteringemacs.org/articles/2010/11/01/running-shells-in-emacs-overview/][shell]] inside Emacs is cool
- You really should use the /[[http://www.emacswiki.org/emacs/BookMarks][bookmarks]]/ functionality to save your projects locations (locally or remotely)
- When opening a file, add /sudo:/ in front of its path in order to edit it as a privileged user
- You can edit files in hexadecimal directly in Emacs thanks to the /hexl-mode/
- Emacs allows you to open an archive (gz, bz2, zip, ...), edit its files on-the-fly without extracting yourself the archive. To do so, simple open the file directly in Emacs (*C-x C-f* /path/to/archive.tar.bz2)
- [[http://www.gnu.org/software/emacs/manual/html_node/emacs/Rectangles.html][Rectangle regions]] edition is really easy
- [[http://www.cs.bu.edu/teaching/tool/emacs/programming/#compile][Compilation]] and [[http://www.cs.bu.edu/teaching/tool/emacs/programming/#gdb][debugging]] is really well supported in Emacs
- [[http://www.emacswiki.org/ERC][Erc]] is a great IRC client running in Emacs

/To be continued/

** Coming from other editors (i.e Vim or SublimeText)

Some people use other editors and want to give Emacs a try.
Some people are really used to use a specific editor.
Some people do not want to lose their habits and their learning curve.

I am thinking about Vim, but it is also true for other editors (textmate, sublime, ...)
Emacs has a mode that allows you to use it exactly like Vim.
I have personally never used this mode, but many people use it. Therefore, it allows you to switch gently and softly from Vim to Emacs.

[[http://www.emacswiki.org/emacs/Evil][Read more about Evil-mode]]

There is also a package to recreate SublimeText and its GUI features that some people like (minimap, smooth scrolling, ...)

[[https://github.com/zk-phi/sublimity][Read more about Sublimity]]


================================================
FILE: chapters/06-readings-and-resources.org
================================================
#+TITLE: Emacs for developers - Readings and resources
#+AUTHOR: Pierre Lecocq
#+DESCRIPTION: Learn using Emacs as a developer
#+KEYWORDS: emacs, developer
#+STARTUP: showall

* Emacs for developers - Readings and resources

- [[http://emacsrocks.com/][Emacs rocks videos]]
- [[http://devblog.avdi.org/category/emacs-reboot/][Avdi Grimm Emacs reboot series]]
- [[http://www.masteringemacs.org/][Mastering Emacs]]
- [[http://sachachua.com/blog/category/geek/emacs/][Sacha's blog]] and her wonderful Emacs contributors interviews serie
- [[http://emacsredux.com][Emacs redux]] by Bozhidar Batsov
- [[http://planet.emacsen.org/][Planet Emacsen]]
- [[http://reddit.com/r/emacs][Emacs sub-reddit]]
- [[http://endlessparentheses.com/][Endless Parentheses]], concise emacs productivity tips

And of course, the [[http://www.emacswiki.org/][Emacs wiki]]


================================================
FILE: demo/README.org
================================================
* The demo

A (basic) annoted demo associated to this tutorial is available in video:

- [[https://www.youtube.com/watch?v=oPZ8yliLYMM]] (Watch it in HD for better ... quality !)
- [[https://vimeo.com/110356656]]

** Scenario

*** 1. Setup

- 1.1 Launch using a dedicated config file
- 1.2 Print the current Emacs' version (wouhou !)
- 1.3 Open a file

*** 2. Basic editing

- 2.1 Go to constructor and edit arguments
- 2.2 Select a region
- 2.3 Copy and paste the region
- 2.4 Comment/Uncomment a region
- 2.5 Save the current file (buffer)

*** 3. Searching

- 3.1 Search in the current buffer
- 3.2 Navigate between occurrences
- 3.3 Search in project files with rgrep

*** 4. Windows and buffers

- 4.1 Open a new window
- 4.2 Open a new buffer with a new file
- 4.3 Close window
- 4.4 Switch between buffers in the same window
- 4.5 Re-open several windows with different buffers
- 4.6 Close everything but the current window

*** 5. Dired mode

- 5.1 Open dired mode
- 5.2 Create a directory (+)
- 5.3 Create three new file (C-x C-f) and then refresh the buffer (g)
- 5.4 Rename two file (R) one by one
- 5.5 Mark two files (m) and delete them both (D)
- 5.6 Compress the remaining file (Z)
- 5.7 Change its mode (M)

*** 6. Shell

- 6.1 Open a shell
- 6.2 Execute a command (ls -l)
- 6.4 Select the output and execute a command on the selected region (M-| RET sed -e 's/e/EEE/g' > test-shell.txt)
- 6.5 Execute a command from a buffer (M-! RET ls -l /)


================================================
FILE: demo/config.el
================================================
;;
;; emacs4developer demo - emacs config
;; by Pierre Lecocq
;;
;; See https://github.com/pierre-lecocq/emacs.d for full configuration
;;

(setq debug-on-error t)

;; ----------------
;; Install packages

(when (>= emacs-major-version 24)

  ;; Require the library
  (require 'package)

  ;; Set repositories
  (setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
			   ("marmalade" . "http://marmalade-repo.org/packages/")
			   ("melpa" . "http://melpa.milkbox.net/packages/")))

  ;; Initialize the package manager
  (package-initialize)

  ;; Install autopair package (to match parentheses, brackets, ...)
  (unless (package-installed-p 'autopair)
    (progn
      (package-refresh-contents)
      (package-install 'autopair)))
  
  (require 'autopair)
  (autopair-global-mode)

  ;; Install darkmine-theme package (a darkish theme)
  (unless (package-installed-p 'darkmine-theme)
    (progn
      (package-refresh-contents)
      (package-install 'darkmine-theme)))

  (load-theme 'darkmine t)

  )

;; ------------------
;; Some basic configs

;; See matching pairs of parentheses
(show-paren-mode t)
;; Fontify the text in the buffer
(global-font-lock-mode t)
;; Selection highlighting
(transient-mark-mode t)
;; Display line number in the modeline
(line-number-mode t)
;; Display column number in the modeline
(column-number-mode t)
;; Layziness is the best invention, ever
(fset 'yes-or-no-p 'y-or-n-p)


================================================
FILE: demo/src/dummy.rb
================================================
#!/usr/bin/env ruby

require_relative 'functions'

# A dummy class
class Dummy
  # Accessor - author
  attr_accessor :author

  # Accessor - version
  attr_accessor :version

  # Constructor
  #
  # @param action_name [String]
  def initialize(action_name)
    # Because we are polite
    puts 'Bonjour'

    # Get a few informations
    @author = ENV['user']
    @version = [1, 5, 2].join '.'

    # And then do something ...
    dispatch action_name
  end

  # Dispatcher
  #
  # @param action [Symbol]
  def dispatch(action)
    case action
    when :create
      do_create
    when :update
      do_update
    when :delete
      do_delete
    else
      fail 'Unknown action'
    end
  end

  # Create something
  def do_create
    puts "Let's create something !"
  end

  # Update something
  def do_update
    puts "Let's update something !"
  end

  # Delete something
  def do_delete
    puts "Let's delete something !"
  end

  # The most silly thing, ever
  def compute_version
    result = 0
    @version.split('.').map! { |n| result += n.to_i }
    result
  end
end


================================================
FILE: demo/src/functions.rb
================================================
# Just say something
#
# @param message [String]
# @param prefix [String]
def say(message, prefix = ' => ')
  puts "%s%s" % [
         prefix,
         message
       ]
end

# Symbolize hash keys
# Credits: Avdi Grimm
def symbolize_keys(hash)
  hash.inject({}){|result, (key, value)|
    new_key = case key
              when String then key.to_sym
              else key
              end
    new_value = case value
                when Hash then symbolize_keys(value)
                else value
                end
    result[new_key] = new_value
    result
  }
end


================================================
FILE: exports/emacs4developers.html
================================================
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>*Org HTML Export*</title>
<!-- 2014-10-21 Mar 13:50 -->
<meta  http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta  name="generator" content="Org-mode" />
<meta  name="author" content="Pierre Lecocq" />
<style type="text/css">
 <!--/*--><![CDATA[/*><!--*/
  .title  { text-align: center; }
  .todo   { font-family: monospace; color: red; }
  .done   { color: green; }
  .tag    { background-color: #eee; font-family: monospace;
            padding: 2px; font-size: 80%; font-weight: normal; }
  .timestamp { color: #bebebe; }
  .timestamp-kwd { color: #5f9ea0; }
  .right  { margin-left: auto; margin-right: 0px;  text-align: right; }
  .left   { margin-left: 0px;  margin-right: auto; text-align: left; }
  .center { margin-left: auto; margin-right: auto; text-align: center; }
  .underline { text-decoration: underline; }
  #postamble p, #preamble p { font-size: 90%; margin: .2em; }
  p.verse { margin-left: 3%; }
  pre {
    border: 1px solid #ccc;
    box-shadow: 3px 3px 3px #eee;
    padding: 8pt;
    font-family: monospace;
    overflow: auto;
    margin: 1.2em;
  }
  pre.src {
    position: relative;
    overflow: visible;
    padding-top: 1.2em;
  }
  pre.src:before {
    display: none;
    position: absolute;
    background-color: white;
    top: -10px;
    right: 10px;
    padding: 3px;
    border: 1px solid black;
  }
  pre.src:hover:before { display: inline;}
  pre.src-sh:before    { content: 'sh'; }
  pre.src-bash:before  { content: 'sh'; }
  pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
  pre.src-R:before     { content: 'R'; }
  pre.src-perl:before  { content: 'Perl'; }
  pre.src-java:before  { content: 'Java'; }
  pre.src-sql:before   { content: 'SQL'; }

  table { border-collapse:collapse; }
  caption.t-above { caption-side: top; }
  caption.t-bottom { caption-side: bottom; }
  td, th { vertical-align:top;  }
  th.right  { text-align: center;  }
  th.left   { text-align: center;   }
  th.center { text-align: center; }
  td.right  { text-align: right;  }
  td.left   { text-align: left;   }
  td.center { text-align: center; }
  dt { font-weight: bold; }
  .footpara:nth-child(2) { display: inline; }
  .footpara { display: block; }
  .footdef  { margin-bottom: 1em; }
  .figure { padding: 1em; }
  .figure p { text-align: center; }
  .inlinetask {
    padding: 10px;
    border: 2px solid gray;
    margin: 10px;
    background: #ffffcc;
  }
  #org-div-home-and-up
   { text-align: right; font-size: 70%; white-space: nowrap; }
  textarea { overflow-x: auto; }
  .linenr { font-size: smaller }
  .code-highlighted { background-color: #ffff00; }
  .org-info-js_info-navigation { border-style: none; }
  #org-info-js_console-label
    { font-size: 10px; font-weight: bold; white-space: nowrap; }
  .org-info-js_search-highlight
    { background-color: #ffff00; color: #000000; font-weight: bold; }
  /*]]>*/-->
</style>
<script type="text/javascript">
/*
@licstart  The following is the entire license notice for the
JavaScript code in this tag.

Copyright (C) 2012-2013 Free Software Foundation, Inc.

The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version.  The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.  See the GNU GPL for more details.

As additional permission under GNU GPL version 3 section 7, you
may distribute non-source (e.g., minimized or compacted) forms of
that code without the copy of the GNU GPL normally required by
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.


@licend  The above is the entire license notice
for the JavaScript code in this tag.
*/
<!--/*--><![CDATA[/*><!--*/
 function CodeHighlightOn(elem, id)
 {
   var target = document.getElementById(id);
   if(null != target) {
     elem.cacheClassElem = elem.className;
     elem.cacheClassTarget = target.className;
     target.className = "code-highlighted";
     elem.className   = "code-highlighted";
   }
 }
 function CodeHighlightOff(elem, id)
 {
   var target = document.getElementById(id);
   if(elem.cacheClassElem)
     elem.className = elem.cacheClassElem;
   if(elem.cacheClassTarget)
     target.className = elem.cacheClassTarget;
 }
/*]]>*///-->
</script>
<script type="text/javascript" src="http://orgmode.org/mathjax/MathJax.js"></script>
<script type="text/javascript">
<!--/*--><![CDATA[/*><!--*/
    MathJax.Hub.Config({
        // Only one of the two following lines, depending on user settings
        // First allows browser-native MathML display, second forces HTML/CSS
        //  config: ["MMLorHTML.js"], jax: ["input/TeX"],
            jax: ["input/TeX", "output/HTML-CSS"],
        extensions: ["tex2jax.js","TeX/AMSmath.js","TeX/AMSsymbols.js",
                     "TeX/noUndefined.js"],
        tex2jax: {
            inlineMath: [ ["\\(","\\)"] ],
            displayMath: [ ['$$','$$'], ["\\[","\\]"], ["\\begin{displaymath}","\\end{displaymath}"] ],
            skipTags: ["script","noscript","style","textarea","pre","code"],
            ignoreClass: "tex2jax_ignore",
            processEscapes: false,
            processEnvironments: true,
            preview: "TeX"
        },
        showProcessingMessages: true,
        displayAlign: "center",
        displayIndent: "2em",

        "HTML-CSS": {
             scale: 100,
             availableFonts: ["STIX","TeX"],
             preferredFont: "TeX",
             webFont: "TeX",
             imageFont: "TeX",
             showMathMenu: true,
        },
        MMLorHTML: {
             prefer: {
                 MSIE:    "MML",
                 Firefox: "MML",
                 Opera:   "HTML",
                 other:   "HTML"
             }
        }
    });
/*]]>*///-->
</script>
</head>
<body>
<div id="content">
<h1 class="title">*Org HTML Export*</h1>
<p>
&lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</a>"&gt;
&lt;html xmlns="<a href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</a>" lang="en" xml:lang="en"&gt;
&lt;head&gt;
&lt;title&gt;Emacs for developers&lt;/title&gt;
&lt;!&#x2013; 2014-10-21 Mar 13:50 &#x2013;&gt;
&lt;meta  http-equiv="Content-Type" content="text/html;charset=utf-8" /&gt;
&lt;meta  name="generator" content="Org-mode" /&gt;
&lt;meta  name="author" content="Pierre Lecocq" /&gt;
&lt;meta  name="description" content="Learn using Emacs as a developer"
 /&gt;
&lt;meta  name="keywords" content="emacs, developer" /&gt;
&lt;style type="text/css"&gt;
 &lt;!&#x2013;/*&#x2013;&gt;&lt;![CDATA[/*&gt;&lt;!&#x2013;*/
  .title  { text-align: center; }
  .todo   { font-family: monospace; color: red; }
  .done   { color: green; }
  .tag    { background-color: #eee; font-family: monospace;
            padding: 2px; font-size: 80%; font-weight: normal; }
  .timestamp { color: #bebebe; }
  .timestamp-kwd { color: #5f9ea0; }
  .right  { margin-left: auto; margin-right: 0px;  text-align: right; }
  .left   { margin-left: 0px;  margin-right: auto; text-align: left; }
  .center { margin-left: auto; margin-right: auto; text-align: center; }
  .underline { text-decoration: underline; }
  #postamble p, #preamble p { font-size: 90%; margin: .2em; }
  p.verse { margin-left: 3%; }
  pre {
    border: 1px solid #ccc;
    box-shadow: 3px 3px 3px #eee;
    padding: 8pt;
    font-family: monospace;
    overflow: auto;
    margin: 1.2em;
  }
  pre.src {
    position: relative;
    overflow: visible;
    padding-top: 1.2em;
  }
  pre.src:before {
    display: none;
    position: absolute;
    background-color: white;
    top: -10px;
    right: 10px;
    padding: 3px;
    border: 1px solid black;
  }
  pre.src:hover:before { display: inline;}
  pre.src-sh:before    { content: 'sh'; }
  pre.src-bash:before  { content: 'sh'; }
  pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
  pre.src-R:before     { content: 'R'; }
  pre.src-perl:before  { content: 'Perl'; }
  pre.src-java:before  { content: 'Java'; }
  pre.src-sql:before   { content: 'SQL'; }
</p>

<p>
  table { border-collapse:collapse; }
  caption.t-above { caption-side: top; }
  caption.t-bottom { caption-side: bottom; }
  td, th { vertical-align:top;  }
  th.right  { text-align: center;  }
  th.left   { text-align: center;   }
  th.center { text-align: center; }
  td.right  { text-align: right;  }
  td.left   { text-align: left;   }
  td.center { text-align: center; }
  dt { font-weight: bold; }
  .footpara:nth-child(2) { display: inline; }
  .footpara { display: block; }
  .footdef  { margin-bottom: 1em; }
  .figure { padding: 1em; }
  .figure p { text-align: center; }
  .inlinetask {
    padding: 10px;
    border: 2px solid gray;
    margin: 10px;
    background: #ffffcc;
  }
  #org-div-home-and-up
   { text-align: right; font-size: 70%; white-space: nowrap; }
  textarea { overflow-x: auto; }
  .linenr { font-size: smaller }
  .code-highlighted { background-color: #ffff00; }
  .org-info-js<sub>info</sub>-navigation { border-style: none; }
  #org-info-js<sub>console</sub>-label
    { font-size: 10px; font-weight: bold; white-space: nowrap; }
  .org-info-js<sub>search</sub>-highlight
    { background-color: #ffff00; color: #000000; font-weight: bold; }
  <i><b>]]&gt;</b></i>&#x2013;&gt;
&lt;/style&gt;
&lt;script type="text/javascript"&gt;
/*
@licstart  The following is the entire license notice for the
JavaScript code in this tag.
</p>

<p>
Copyright (C) 2012-2013 Free Software Foundation, Inc.
</p>

<p>
The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version.  The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.  See the GNU GPL for more details.
</p>

<p>
As additional permission under GNU GPL version 3 section 7, you
may distribute non-source (e.g., minimized or compacted) forms of
that code without the copy of the GNU GPL normally required by
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.
</p>


<p>
@licend  The above is the entire license notice
for the JavaScript code in this tag.
<b>/
&lt;!&#x2013;/</b>&#x2013;&gt;&lt;![CDATA[/*&gt;&lt;!&#x2013;*/
 function CodeHighlightOn(elem, id)
 {
   var target = document.getElementById(id);
   if(null != target) {
     elem.cacheClassElem = elem.className;
     elem.cacheClassTarget = target.className;
     target.className = "code-highlighted";
     elem.className   = "code-highlighted";
   }
 }
 function CodeHighlightOff(elem, id)
 {
   var target = document.getElementById(id);
   if(elem.cacheClassElem)
     elem.className = elem.cacheClassElem;
   if(elem.cacheClassTarget)
     target.className = elem.cacheClassTarget;
 }
<i>*]]&gt;*//</i>&#x2013;&gt;
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id="content"&gt;
&lt;h1 class="title"&gt;Emacs for developers&lt;/h1&gt;
&lt;div id="table-of-contents"&gt;
&lt;h2&gt;Table of Contents&lt;/h2&gt;
&lt;div id="text-table-of-contents"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#sec-1"&gt;1. Emacs for developers&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#sec-1-1"&gt;1.1. Who is the target of this tutorial&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-2"&gt;2. Table of contents&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-3"&gt;3. Introduction&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#sec-3-1"&gt;3.1. Brief history&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-3-2"&gt;3.2. How to get Emacs?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-3-3"&gt;3.3. More than an editor&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-3-4"&gt;3.4. The perfect development tool&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-4"&gt;4. The basics&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#sec-4-1"&gt;4.1. Config files&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-4-2"&gt;4.2. Executing commands&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-4-3"&gt;4.3. Key bindings&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#sec-4-3-1"&gt;4.3.1. Manipulate files&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-4-3-2"&gt;4.3.2. Manipulate the line&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-4-3-3"&gt;4.3.3. Selecting a region&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-4-3-4"&gt;4.3.4. Commenting&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-4-3-5"&gt;4.3.5. Windows&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-4-3-6"&gt;4.3.6. Buffers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-4-3-7"&gt;4.3.7. Cancel a command&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-4-3-8"&gt;4.3.8. The most useless one&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-4-4"&gt;4.4. Help!&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5"&gt;5. Building your own editor&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#sec-5-1"&gt;5.1. First basic configuration&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-2"&gt;5.2. General basic configuration&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-3"&gt;5.3. Backup files&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-4"&gt;5.4. Setting up the locales&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-5"&gt;5.5. More configuration&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-6"&gt;5.6. Modes&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#sec-5-6-1"&gt;5.6.1. Major modes&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-6-2"&gt;5.6.2. Minor modes&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-7"&gt;5.7. Package managers&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#sec-5-7-1"&gt;5.7.1. Package.el&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-7-2"&gt;5.7.2. El-Get&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-7-3"&gt;5.7.3. The generic method&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-7-4"&gt;5.7.4. The modern and efficient way&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-8"&gt;5.8. Some useful packages&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#sec-5-8-1"&gt;5.8.1. Auto complete&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-8-2"&gt;5.8.2. Autopair&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-8-3"&gt;5.8.3. Buffer move&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-8-4"&gt;5.8.4. Flycheck&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-8-5"&gt;5.8.5. Highlight symbol&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-8-6"&gt;5.8.6. Ido&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-8-7"&gt;5.8.7. JS3&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-8-8"&gt;5.8.8. Magit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-8-9"&gt;5.8.9. Multiple cursors&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-8-10"&gt;5.8.10. PHP mode&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-8-11"&gt;5.8.11. Rainbow mode&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-8-12"&gt;5.8.12. RHTML mode&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-8-13"&gt;5.8.13. Ruby mode&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-8-14"&gt;5.8.14. Switch window&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-8-15"&gt;5.8.15. Visual regexp&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-8-16"&gt;5.8.16. Yaml mode&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-8-17"&gt;5.8.17. Yasnippet&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-8-18"&gt;5.8.18. Paredit&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-9"&gt;5.9. Code navigation&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#sec-5-9-1"&gt;5.9.1. Tags basics&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-9-2"&gt;5.9.2. List functions or methods&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-9-3"&gt;5.9.3. Files navigation (a.k.a fuzzy matching) with TAGS and ido&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-9-4"&gt;5.9.4. RGrep&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-5-10"&gt;5.10. Setting a color theme&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#sec-5-10-1"&gt;5.10.1. Font settings&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-6"&gt;6. Emacs for developers - Emacs developing environments&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#sec-6-1"&gt;6.1. Emacs for Ruby developers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-6-2"&gt;6.2. Emacs for Python developers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-6-3"&gt;6.3. Emacs for C/C++/Objective-C&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-6-4"&gt;6.4. Emacs for Go developers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-6-5"&gt;6.5. Emacs for PHP developers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-6-6"&gt;6.6. Emacs for Java developers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-6-7"&gt;6.7. Emacs for R and statistics&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-7"&gt;7. Special features&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="#sec-7-1"&gt;7.1. Emacs as a file manager&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-7-2"&gt;7.2. Working locally vs remotely&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-7-3"&gt;7.3. Organize your work, write papers and manage your agenda&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-7-4"&gt;7.4. Emails in Emacs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-7-5"&gt;7.5. Some great Emacs tips and tricks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-7-6"&gt;7.6. Coming from other editors (i.e Vim)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-8"&gt;8. Readings and resources&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-9"&gt;9. License&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="#sec-10"&gt;10. Thanks&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-1" class="outline-2"&gt;
&lt;h2 id="sec-1"&gt;&lt;span class="section-number-2"&gt;1&lt;/span&gt; Emacs for developers&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-1"&gt;
&lt;p&gt;
This document will (hopefully) help you to use Emacs as a developer.
&lt;/p&gt;
&lt;/div&gt;
</p>

<p>
&lt;ol class="org-ol"&gt;&lt;li&gt;&lt;a id="sec-1-0-0-1" name="sec-1-0-0-1"&gt;&lt;/a&gt;Disclaimer&lt;br  /&gt;&lt;div class="outline-text-5" id="text-1-0-0-1"&gt;
&lt;p&gt;
Work in progress, so stay tuned.
&lt;/p&gt;
&lt;/div&gt;
&lt;/li&gt;
</p>

<p>
&lt;div id="outline-container-sec-1-1" class="outline-3"&gt;
&lt;h3 id="sec-1-1"&gt;&lt;span class="section-number-3"&gt;1.1&lt;/span&gt; Who is the target of this tutorial&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-1-1"&gt;
&lt;p&gt;
Well, this is a good question. And I won't give an answer but some elements of answer.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
What is sure is that it is not written for the people thanked below (Batien, Dimitri, Sacha, Nic, Avdi, and so on &amp;#x2026;), but what is interseting with Emacs is that even if you are a beginner, an intermediate / advanced user or an every day power user, you can learn from others each time you open a web page or a manual dealing with Emacs.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
Therefore, this tutorial is written for people who want to improve their experience. Simple as that. Whatever is their knowledge, their feeling, their usage, their config file size (without any pun), etc &amp;#x2026;
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
Remember one thing: Emacs is 30+ years old and brings new users everyday. It is a clue that this is a piece of software that deserve some attention.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-2" class="outline-2"&gt;
&lt;h2 id="sec-2"&gt;&lt;span class="section-number-2"&gt;2&lt;/span&gt; Table of contents&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-2"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;1. &lt;i&gt;Introduction&lt;/i&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;1.1 &lt;i&gt;Brief history&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;1.2 &lt;i&gt;How to get Emacs?&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;1.3 &lt;i&gt;More than an editor&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;1.4 &lt;i&gt;The perfect development tool&lt;/i&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;2. &lt;i&gt;The basics&lt;/i&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;2.1 &lt;i&gt;Config files&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;2.2 &lt;i&gt;Executing commands&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;2.3 &lt;i&gt;Key bindings&lt;/i&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;2.3.1 &lt;i&gt;Manipulate files&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;2.3.2 &lt;i&gt;Manipulate the current line&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;2.3.3 &lt;i&gt;Selecting a region&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;2.3.4 &lt;i&gt;Commenting&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;2.3.5 &lt;i&gt;Windows&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;2.3.6 &lt;i&gt;Buffers&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;2.3.7 &lt;i&gt;Cancel a command&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;2.3.8 &lt;i&gt;The most useless command&lt;/i&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;2.4 &lt;i&gt;Help!&lt;/i&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;3. &lt;i&gt;Building your own editor&lt;/i&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;3.1 &lt;i&gt;First basic configuration&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;3.2 &lt;i&gt;General basic configuration&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;3.3 &lt;i&gt;Backup files&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;3.4 &lt;i&gt;Setting up the locales&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;3.5 &lt;i&gt;More configuration&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;3.6 &lt;i&gt;Modes&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;3.7 &lt;i&gt;Package managers&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;3.8 &lt;i&gt;Some useful packages&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;3.9 &lt;i&gt;Code navigation&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;3.10 &lt;i&gt;Setting a color theme&lt;/i&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;4. &lt;i&gt;Emacs developing environments&lt;/i&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;4.1 &lt;i&gt;Emacs for Ruby developers&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;4.2 &lt;i&gt;Emacs for Python developers&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;4.3 &lt;i&gt;Emacs for C/C++/Objective-C developers&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;4.4 &lt;i&gt;Emacs for Go developers&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;4.5 &lt;i&gt;Emacs for PHP developers&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;4.6 &lt;i&gt;Emacs for Java developers&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;4.7 &lt;i&gt;Emacs for R and statistics&lt;/i&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;5. &lt;i&gt;Special features&lt;/i&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;5.1 &lt;i&gt;Emacs as a file manager&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;5.2 &lt;i&gt;Working locally vs remotely&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;5.3 &lt;i&gt;Organize your work, write papers and manage your agenda&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;5.4 &lt;i&gt;Emails in Emacs&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;5.5 &lt;i&gt;Some great Emacs tips and tricks&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;5.6 &lt;i&gt;Coming from other editors (i.e Vim or SublimeText)&lt;/i&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;6. &lt;i&gt;Readings and resources&lt;/i&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-3" class="outline-2"&gt;
&lt;h2 id="sec-3"&gt;&lt;span class="section-number-2"&gt;3&lt;/span&gt; Introduction&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-3"&gt;
&lt;/div&gt;&lt;div id="outline-container-sec-3-1" class="outline-3"&gt;
&lt;h3 id="sec-3-1"&gt;&lt;span class="section-number-3"&gt;3.1&lt;/span&gt; Brief history&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-3-1"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;Originally developed by Richard Stallman and Guy Steele in MIT AI lab
&lt;/li&gt;
&lt;li&gt;First release in 1976
&lt;/li&gt;
&lt;li&gt;Inspired by TECO editor
&lt;/li&gt;
&lt;li&gt;Based on macros (Emacs stands for Editor MACroS)
&lt;/li&gt;
&lt;li&gt;Written in C and Emacs Lisp
&lt;/li&gt;
&lt;li&gt;Part of the GNU project (therefore, we &lt;i&gt;should&lt;/i&gt; say "GNU Emacs", not "Emacs")
&lt;/li&gt;
</p>

<p>
&lt;li&gt;Despite its age, new users are still adopting Emacs as their development platform to this day!
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-3-2" class="outline-3"&gt;
&lt;h3 id="sec-3-2"&gt;&lt;span class="section-number-3"&gt;3.2&lt;/span&gt; How to get Emacs?&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-3-2"&gt;
&lt;p&gt;
On every Linux distribution, packages are available.
So run your favorite package manager to install it:
&lt;/p&gt;
</p>

<p>
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;i&gt;apt-get install emacs&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;&lt;i&gt;yum install emacs&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;&amp;#x2026;
&lt;/li&gt;
&lt;/ul&gt;
</p>

<p>
&lt;p&gt;
And if you have an exotic operating system, here are the specific distributions:
&lt;/p&gt;
</p>

<p>
&lt;ul class="org-ul"&gt;
&lt;li&gt;Mac OS X: &lt;a href="<a href="http://emacsformacosx.com/">http://emacsformacosx.com/</a>"&gt;<a href="http://emacsformacosx.com/">http://emacsformacosx.com/</a>&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Windows: &lt;a href="<a href="http://ftp.igh.cnrs.fr/pub/gnu/emacs/windows/">http://ftp.igh.cnrs.fr/pub/gnu/emacs/windows/</a>"&gt;<a href="http://ftp.igh.cnrs.fr/pub/gnu/emacs/windows/">http://ftp.igh.cnrs.fr/pub/gnu/emacs/windows/</a>&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
</p>

<p>
&lt;p&gt;
But, in order to get the latest version, it's &lt;span class="underline"&gt;highly recommended&lt;/span&gt; that you compile Emacs yourself: &lt;a href="<a href="http://ftp.igh.cnrs.fr/pub/gnu/emacs/">http://ftp.igh.cnrs.fr/pub/gnu/emacs/</a>"&gt;<a href="http://ftp.igh.cnrs.fr/pub/gnu/emacs/">http://ftp.igh.cnrs.fr/pub/gnu/emacs/</a>&lt;/a&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>


<p>
&lt;div id="outline-container-sec-3-3" class="outline-3"&gt;
&lt;h3 id="sec-3-3"&gt;&lt;span class="section-number-3"&gt;3.3&lt;/span&gt; More than an editor&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-3-3"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;More than an editor, it is a Lisp interpretor
&lt;/li&gt;
&lt;li&gt;Can run any type of program written in Lisp:
&lt;ul class="org-ul"&gt;
&lt;li&gt;Email clients (like &lt;a href="<a href="http://www.gnus.org/">http://www.gnus.org/</a>"&gt;Gnus&lt;/a&gt; or &lt;a href="<a href="http://www.emacswiki.org/emacs/mu4e">http://www.emacswiki.org/emacs/mu4e</a>"&gt;mu4e&lt;/a&gt;)
&lt;/li&gt;
&lt;li&gt;Shell (like bash or eshell)
&lt;/li&gt;
&lt;li&gt;File and directory management (with &lt;a href="<a href="http://www.gnu.org/software/emacs/manual/html_node/emacs/Dired.html">http://www.gnu.org/software/emacs/manual/html_node/emacs/Dired.html</a>"&gt;Dired mode&lt;/a&gt;)
&lt;/li&gt;
&lt;li&gt;Agenda / Notes / TODO list / Project management (with the amazing &lt;a href="<a href="http://orgmode.org">http://orgmode.org</a>"&gt;OrgMode&lt;/a&gt;)
&lt;/li&gt;
&lt;li&gt;IRC / Twitter / Jabber / &amp;#x2026; clients
&lt;/li&gt;
&lt;li&gt;Games (like Tetris, Pong, Snake, 5x5, Dunnet, &amp;#x2026;)
&lt;/li&gt;
&lt;li&gt;Encrypt/decrypt files (like GPG files)
&lt;/li&gt;
&lt;li&gt;On-the-fly archives editing (thanks to &lt;a href="<a href="http://www.emacswiki.org/emacs/ArchiveMode">http://www.emacswiki.org/emacs/ArchiveMode</a>"&gt;archive-mode&lt;/a&gt;)
&lt;/li&gt;
&lt;li&gt;PDF / Image / (&amp;#x2026;) viewer
&lt;/li&gt;
&lt;li&gt;A powerful front end to R / S+ / SPSS / Stata (with &lt;a href="<a href="http://ess.r-project.org/">http://ess.r-project.org/</a>"&gt;EmacsSpeaksStatisics)&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;An editor for multi-modal REPL's like IPython (with &lt;a href="<a href="http://tkf.github.io/emacs-ipython-notebook/">http://tkf.github.io/emacs-ipython-notebook/</a>"&gt;EmacsIPythonNotebook&lt;/a&gt;)
&lt;/li&gt;
&lt;li&gt;Music player (with emms, vlc, mplayer, &amp;#x2026;)
&lt;/li&gt;
&lt;li&gt;Music programming (with &lt;a href="<a href="http://vimeo.com/22798433">http://vimeo.com/22798433</a>"&gt;Overtone&lt;/a&gt;)
&lt;/li&gt;
&lt;li&gt;Video editing
&lt;/li&gt;
&lt;li&gt;And so on &amp;#x2026;
&lt;/li&gt;
&lt;li&gt;(and of course a document editor that can automatically generate this presentation)
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
</p>

<p>
&lt;p&gt;
Naturally, you can do all of that at the same time with only one Emacs instance. Don't need to say it &amp;#x2026;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-3-4" class="outline-3"&gt;
&lt;h3 id="sec-3-4"&gt;&lt;span class="section-number-3"&gt;3.4&lt;/span&gt; The perfect development tool&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-3-4"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;As Emacs is a Lisp interpretor, it is extensible. Really really extensible.
&lt;/li&gt;
&lt;li&gt;The (unofficial) goal of Emacs is to be hacked
&lt;/li&gt;
&lt;li&gt;Therefore your goal is to hack Emacs to make it work perfectly as you want
&lt;/li&gt;
</p>

<p>
&lt;li&gt;Already provides so many development tools (also extensible, of course)
&lt;ul class="org-ul"&gt;
&lt;li&gt;Debuggers
&lt;/li&gt;
&lt;li&gt;Compilers
&lt;/li&gt;
&lt;li&gt;Syntax checkers
&lt;/li&gt;
&lt;li&gt;Documentations
&lt;/li&gt;
&lt;li&gt;Consoles
&lt;/li&gt;
&lt;li&gt;&amp;#x2026;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
</p>

<p>
&lt;li&gt;Also provides &lt;i&gt;modes&lt;/i&gt; (extensions) for &lt;b&gt;every&lt;/b&gt; programming language for
&lt;ul class="org-ul"&gt;
&lt;li&gt;Syntax highlighting
&lt;/li&gt;
&lt;li&gt;Documentation search
&lt;/li&gt;
&lt;li&gt;Indentation
&lt;/li&gt;
&lt;li&gt;Source code browsing
&lt;/li&gt;
&lt;li&gt;Compilation commands
&lt;/li&gt;
&lt;li&gt;Specific behaviour
&lt;/li&gt;
&lt;li&gt;&amp;#x2026;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-4" class="outline-2"&gt;
&lt;h2 id="sec-4"&gt;&lt;span class="section-number-2"&gt;4&lt;/span&gt; The basics&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-4"&gt;
&lt;/div&gt;&lt;div id="outline-container-sec-4-1" class="outline-3"&gt;
&lt;h3 id="sec-4-1"&gt;&lt;span class="section-number-3"&gt;4.1&lt;/span&gt; Config files&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-4-1"&gt;
&lt;p&gt;
In order to customize Emacs, you will have to edit its configuration files.
It does not exist when you install the software (or is an empty file) and does nothing until you decide to tweak Emacs.
Some people use Emacs for decades without any extra configuration because they like it out of the box.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
There are several ways to manage your Emacs configuration:
&lt;/p&gt;
</p>

<p>
&lt;ul class="org-ul"&gt;
&lt;li&gt;Simply create and edit a &lt;b&gt;~/.emacs&lt;/b&gt; file
&lt;/li&gt;
&lt;li&gt;Create a &lt;b&gt;~/.emacs.d/&lt;/b&gt; directory with a &lt;b&gt;~/.emacs.d/init.el&lt;/b&gt; file
&lt;/li&gt;
&lt;/ul&gt;
</p>

<p>
&lt;p&gt;
The first solution is great if you have a small, tidied and exportable configuration file.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
The second solution is great if you need several configuration files (keep you configuration parts separated) or you need to install external extensions (you will install them in &lt;b&gt;~/.emacs.d&lt;/b&gt; to keep them centralized and exportable).
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-4-2" class="outline-3"&gt;
&lt;h3 id="sec-4-2"&gt;&lt;span class="section-number-3"&gt;4.2&lt;/span&gt; Executing commands&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-4-2"&gt;
&lt;p&gt;
The main idea of Emacs is that everything is a command. For example: opening a file with a keybinding calls a command that is executed by the Emacs' core.
And all the commands are written in Lisp.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
To call a command, you simply have to press &lt;b&gt;Escape&lt;/b&gt; and then &lt;b&gt;x&lt;/b&gt;. It could be &lt;b&gt;Alt-x&lt;/b&gt; for more comfort.
The official name is "&lt;i&gt;Meta x&lt;/i&gt;" and is written &lt;i&gt;M-x&lt;/i&gt;
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
If you type this key sequence, you will see at the bottom of the editor a little prompt.
This part of Emacs is called the &lt;i&gt;mini buffer&lt;/i&gt; and is used for every interactive actions.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
Let's try something:
&lt;/p&gt;
</p>

<p>
&lt;ul class="org-ul"&gt;
&lt;li&gt;type &lt;b&gt;M-x&lt;/b&gt;
&lt;/li&gt;
&lt;li&gt;Then, in the minibuffer, type &lt;b&gt;version&lt;/b&gt; and &lt;b&gt;RET&lt;/b&gt; (return)
&lt;/li&gt;
&lt;/ul&gt;
</p>

<p>
&lt;p&gt;
Emacs should display the current version number of the software.
&lt;/p&gt;
</p>


<p>
&lt;div class="figure"&gt;
&lt;p&gt;&lt;img src="../images/version.gif" alt="version.gif" /&gt;
&lt;/p&gt;
&lt;p&gt;&lt;span class="figure-number"&gt;Figure 1:&lt;/span&gt; Execute the version command&lt;/p&gt;
&lt;/div&gt;
</p>

<p>
&lt;p&gt;
Congratulations! You just called your first Emacs command.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-4-3" class="outline-3"&gt;
&lt;h3 id="sec-4-3"&gt;&lt;span class="section-number-3"&gt;4.3&lt;/span&gt; Key bindings&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-4-3"&gt;
&lt;p&gt;
Here are the most useful keys in Emacs. You will use them several hundreds (or thousands) times a day.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
How it works?
&lt;/p&gt;
</p>

<p>
&lt;ul class="org-ul"&gt;
&lt;li&gt;The sequence &lt;i&gt;C-something&lt;/i&gt; means that you have to press and hold the &lt;i&gt;Control&lt;/i&gt; key while hitting the &lt;i&gt;something&lt;/i&gt; key. Example: &lt;i&gt;C-a&lt;/i&gt; means &lt;i&gt;Control + a&lt;/i&gt;.
&lt;/li&gt;
&lt;li&gt;The sequence &lt;i&gt;C-something somethingelse&lt;/i&gt; means that you press &lt;i&gt;Control + something&lt;/i&gt;, then you release Control to hit &lt;i&gt;somethingelse&lt;/i&gt;.
&lt;/li&gt;
&lt;li&gt;The sequence &lt;i&gt;C-something C-somethingelse&lt;/i&gt; means that you have to press Control while hitting &lt;i&gt;something&lt;/i&gt; and &lt;i&gt;somethingelse&lt;/i&gt;.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-4-3-1" class="outline-4"&gt;
&lt;h4 id="sec-4-3-1"&gt;&lt;span class="section-number-4"&gt;4.3.1&lt;/span&gt; Manipulate files&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-4-3-1"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;b&gt;C-x C-f&lt;/b&gt;: open a file, which corresponds to &lt;b&gt;M-x find-file&lt;/b&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;C-x C-s&lt;/b&gt;: save a file, which corresponds to &lt;b&gt;M-x save-buffer&lt;/b&gt;
&lt;/li&gt;
&lt;/ul&gt;
</p>


<p>
&lt;div class="figure"&gt;
&lt;p&gt;&lt;img src="../images/open-and-save.gif" alt="open-and-save.gif" /&gt;
&lt;/p&gt;
&lt;p&gt;&lt;span class="figure-number"&gt;Figure 2:&lt;/span&gt; Open a file, modify it and save it&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-4-3-2" class="outline-4"&gt;
&lt;h4 id="sec-4-3-2"&gt;&lt;span class="section-number-4"&gt;4.3.2&lt;/span&gt; Manipulate the line&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-4-3-2"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;b&gt;C-a&lt;/b&gt;: go to the beginning of the current line, which corresponds to &lt;b&gt;M-x begining-of-line&lt;/b&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;C-e&lt;/b&gt;: go to the end of the current line, which corresponds to &lt;b&gt;M-x end-of-line&lt;/b&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;C-k&lt;/b&gt;: cut the rest of the line at the cursor position, which corresponds to &lt;b&gt;M-x kill-line&lt;/b&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;C-y&lt;/b&gt;: paste what you had cut with the command above, which corresponds to &lt;b&gt;M-x yank&lt;/b&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;C-l&lt;/b&gt;: center the buffer at the cursor position, which corresponds to &lt;b&gt;M-x recenter-top-bottom&lt;/b&gt;
&lt;/li&gt;
&lt;/ul&gt;
</p>


<p>
&lt;div class="figure"&gt;
&lt;p&gt;&lt;img src="../images/line.gif" alt="line.gif" /&gt;
&lt;/p&gt;
&lt;p&gt;&lt;span class="figure-number"&gt;Figure 3:&lt;/span&gt; Line manipulation&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-4-3-3" class="outline-4"&gt;
&lt;h4 id="sec-4-3-3"&gt;&lt;span class="section-number-4"&gt;4.3.3&lt;/span&gt; Selecting a region&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-4-3-3"&gt;
&lt;p&gt;
Regions are selections, in Emacs.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
They are composed by two points. A starting one and and an ending one.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
To select the starting point, move your cursor to the wanted location and simply press &lt;b&gt;C-Space&lt;/b&gt;. In your minibuffer, you should have seen a message like "Mark set".
Now, move your cursor to the location you wantyour selection to end.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
You have now a selection (or a &lt;i&gt;region&lt;/i&gt;) delimited by the place you set the first mark and your cursor. With this region, you can do what ever you want:
&lt;/p&gt;
</p>

<p>
&lt;ul class="org-ul"&gt;
&lt;li&gt;Copy (&lt;b&gt;M-w&lt;/b&gt;)
&lt;/li&gt;
&lt;li&gt;Cut (&lt;b&gt;C-k&lt;/b&gt;)
&lt;/li&gt;
&lt;li&gt;Paste (&lt;b&gt;C-y&lt;/b&gt;)
&lt;/li&gt;
&lt;li&gt;Replace (&lt;b&gt;M-%&lt;/b&gt;)
&lt;/li&gt;
&lt;li&gt;&amp;#x2026; etc
&lt;/li&gt;
&lt;/ul&gt;
</p>


<p>
&lt;div class="figure"&gt;
&lt;p&gt;&lt;img src="../images/selecting.gif" alt="selecting.gif" /&gt;
&lt;/p&gt;
&lt;p&gt;&lt;span class="figure-number"&gt;Figure 4:&lt;/span&gt; Selecting a region&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-4-3-4" class="outline-4"&gt;
&lt;h4 id="sec-4-3-4"&gt;&lt;span class="section-number-4"&gt;4.3.4&lt;/span&gt; Commenting&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-4-3-4"&gt;
&lt;p&gt;
In order to comment a code block, select the region you want to comment and use:
&lt;/p&gt;
</p>

<p>
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;b&gt;M-x comment-region&lt;/b&gt; in order to comment the block
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;M-x uncomment-region&lt;/b&gt; in order to uncomment the block
&lt;/li&gt;
&lt;/ul&gt;
</p>

<p>
&lt;p&gt;
Of course, Emacs knows, according to the major mode loaded how to comment properly your code. If the major-mode is &lt;i&gt;ruby-mode&lt;/i&gt;, it will add a "#" before the line; if the major-mode is &lt;i&gt;lisp-mode&lt;/i&gt;, it will add ";;", and so on and so forth.
&lt;/p&gt;
</p>


<p>
&lt;div class="figure"&gt;
&lt;p&gt;&lt;img src="../images/comment.gif" alt="comment.gif" /&gt;
&lt;/p&gt;
&lt;p&gt;&lt;span class="figure-number"&gt;Figure 5:&lt;/span&gt; Commenting&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-4-3-5" class="outline-4"&gt;
&lt;h4 id="sec-4-3-5"&gt;&lt;span class="section-number-4"&gt;4.3.5&lt;/span&gt; Windows&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-4-3-5"&gt;
&lt;p&gt;
This might be confusing but a &lt;i&gt;window&lt;/i&gt; is a part of a &lt;i&gt;frame&lt;/i&gt;.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
An &lt;i&gt;Emacs frame&lt;/i&gt; is the window that you opened when you launched Emacs.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
An &lt;i&gt;Emacs frame&lt;/i&gt; can be divided into &lt;i&gt;windows&lt;/i&gt; in itself.
&lt;/p&gt;
</p>

<p>
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;b&gt;C-x 2&lt;/b&gt;: open a new window horizontally, which corresponds to &lt;b&gt;M-x split-window-below&lt;/b&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;C-x 3&lt;/b&gt;: open a new window vertically, which corresponds to &lt;b&gt;M-x split-window-right&lt;/b&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;C-x o&lt;/b&gt;: switch to the next window, which corresponds to &lt;b&gt;M-x other-window&lt;/b&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;C-x 0&lt;/b&gt;: close the current window, which corresponds to &lt;b&gt;M-x delete-window&lt;/b&gt;
&lt;/li&gt;
&lt;/ul&gt;
</p>


<p>
&lt;div class="figure"&gt;
&lt;p&gt;&lt;img src="../images/windows.gif" alt="windows.gif" /&gt;
&lt;/p&gt;
&lt;p&gt;&lt;span class="figure-number"&gt;Figure 6:&lt;/span&gt; Windows manipulation&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-4-3-6" class="outline-4"&gt;
&lt;h4 id="sec-4-3-6"&gt;&lt;span class="section-number-4"&gt;4.3.6&lt;/span&gt; Buffers&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-4-3-6"&gt;
&lt;p&gt;
A &lt;i&gt;buffer&lt;/i&gt; is displayed in a &lt;i&gt;frame&lt;/i&gt;.
&lt;/p&gt;
</p>

<p>
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;b&gt;C-x b&lt;/b&gt;: switch to an already opened buffer, which corresponds to &lt;b&gt;M-x switch-to-buffer&lt;/b&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;C-x C-b&lt;/b&gt;: list opened buffer (and jump to the selected one), which corresponds to &lt;b&gt;M-x list-buffers&lt;/b&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;C-x k&lt;/b&gt;: kill a buffer, which corresponds to &lt;b&gt;M-x kill-buffer&lt;/b&gt;
&lt;/li&gt;
&lt;/ul&gt;
</p>


<p>
&lt;div class="figure"&gt;
&lt;p&gt;&lt;img src="../images/buffers.gif" alt="buffers.gif" /&gt;
&lt;/p&gt;
&lt;p&gt;&lt;span class="figure-number"&gt;Figure 7:&lt;/span&gt; Buffer navigation&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-4-3-7" class="outline-4"&gt;
&lt;h4 id="sec-4-3-7"&gt;&lt;span class="section-number-4"&gt;4.3.7&lt;/span&gt; Cancel a command&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-4-3-7"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;b&gt;C-g&lt;/b&gt; or &lt;b&gt;ESC ESC ESC&lt;/b&gt;: cancel the current command running in the minibuffer, which corresponds to &lt;b&gt;M-x keyboard-quit&lt;/b&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-4-3-8" class="outline-4"&gt;
&lt;h4 id="sec-4-3-8"&gt;&lt;span class="section-number-4"&gt;4.3.8&lt;/span&gt; The most useless one&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-4-3-8"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;b&gt;C-x C-c&lt;/b&gt;: quit emacs (use at your own risks!), which corresponds to &lt;b&gt;M-x save-buffers-kill-terminal&lt;/b&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-4-4" class="outline-3"&gt;
&lt;h3 id="sec-4-4"&gt;&lt;span class="section-number-3"&gt;4.4&lt;/span&gt; Help!&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-4-4"&gt;
&lt;p&gt;
Emacs has a powerful built-in help system for key bindings and internal functionalities.
&lt;/p&gt;
</p>

<p>
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;b&gt;C-h f &amp;lt;function-name&amp;gt;&lt;/b&gt;: Find the key binding corresponding to &amp;lt;function-name&amp;gt; (ex: C-h f save-buffer)
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;C-h k &amp;lt;key-sequence&amp;gt;&lt;/b&gt;: Find the function name corresponding to &amp;lt;key-sequence&amp;gt; (ex: C-h k C-x C-s)
&lt;/li&gt;
&lt;/ul&gt;
</p>

<p>
&lt;p&gt;
When executing these commands, a new frame opens. To close it, switch to it (&lt;i&gt;C-x o&lt;/i&gt;) and type &lt;i&gt;q&lt;/i&gt;. If not, simply close it (&lt;i&gt;C-x 0&lt;/i&gt;)
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
Emacs also includes the full manual (also available online: &lt;a href="<a href="http://www.gnu.org/software/emacs/manual/html_node/emacs/">http://www.gnu.org/software/emacs/manual/html_node/emacs/</a>"&gt;<a href="http://www.gnu.org/software/emacs/manual/html_node/emacs/">http://www.gnu.org/software/emacs/manual/html_node/emacs/</a>&lt;/a&gt;)
&lt;/p&gt;
</p>

<p>
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;b&gt;C-h r&lt;/b&gt;: browse the Emacs manual within Emacs
&lt;/li&gt;
&lt;/ul&gt;
</p>

<p>
&lt;p&gt;
Finally, there are so many other help functions: &lt;a href="<a href="http://www.emacswiki.org/emacs/EmacsNewbieHelpReference">http://www.emacswiki.org/emacs/EmacsNewbieHelpReference</a>"&gt;<a href="http://www.emacswiki.org/emacs/EmacsNewbieHelpReference">http://www.emacswiki.org/emacs/EmacsNewbieHelpReference</a>&lt;/a&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5" class="outline-2"&gt;
&lt;h2 id="sec-5"&gt;&lt;span class="section-number-2"&gt;5&lt;/span&gt; Building your own editor&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-5"&gt;
&lt;p&gt;
From this point, we will edit the configuration file.
For the moment, we will put everything in a single &lt;b&gt;~/.emacs.d/init.el&lt;/b&gt; file. Create it if it does not exist.
&lt;/p&gt;
</p>

<p>
&lt;div class="org-src-container"&gt;
</p>

<p>
&lt;pre class="src src-sh"&gt;&lt;span style="color: #a5a5a5;"&gt;# &lt;/span&gt;&lt;span style="color: #a5a5a5;"&gt;Backup old configuration&lt;/span&gt;
cp .emacs dot-emacs.old
cp -R .emacs.d dot-emacs.d.old
</p>

<p>
&lt;span style="color: #a5a5a5;"&gt;# &lt;/span&gt;&lt;span style="color: #a5a5a5;"&gt;Create new and empty configuration&lt;/span&gt;
mkdir ~/.emacs.d
touch ~/.emacs.d/init.el
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-1" class="outline-3"&gt;
&lt;h3 id="sec-5-1"&gt;&lt;span class="section-number-3"&gt;5.1&lt;/span&gt; First basic configuration&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-5-1"&gt;
&lt;p&gt;
When you will have to change or add configuration, simply edit your &lt;b&gt;~/.emacs.d/init.el&lt;/b&gt; file and add what you need.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
For exemple, here is a tweak that does nothing visually but is useful for other packages and the Emacs engine itself.
It allows you to define your name and email. Emacs can use it to add author informations to a file when asked.
&lt;/p&gt;
</p>

<p>
&lt;div class="org-src-container"&gt;
</p>

<p>
&lt;pre class="src src-lisp"&gt;(setq user-full-name &lt;span style="color: #aa3939;"&gt;"Your full name"&lt;/span&gt;)
(setq user-mail-address &lt;span style="color: #aa3939;"&gt;"your@email.com"&lt;/span&gt;)
&lt;/pre&gt;
&lt;/div&gt;
</p>

<p>
&lt;p&gt;
After each configuration modification, two solutions:
&lt;/p&gt;
</p>

<p>
&lt;ul class="org-ul"&gt;
&lt;li&gt;the soft &amp;amp; clever way: execute &lt;b&gt;M-x eval-buffer&lt;/b&gt;
&lt;/li&gt;
&lt;li&gt;the hard way: restart Emacs.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-2" class="outline-3"&gt;
&lt;h3 id="sec-5-2"&gt;&lt;span class="section-number-3"&gt;5.2&lt;/span&gt; General basic configuration&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-5-2"&gt;
&lt;p&gt;
Now, let's move to a more visual configuration basic set.
As before, simply add this to your configuration file:
&lt;/p&gt;
</p>

<p>
&lt;div class="org-src-container"&gt;
</p>

<p>
&lt;pre class="src src-lisp"&gt;&lt;span style="color: #a5a5a5;"&gt;;; &lt;/span&gt;&lt;span style="color: #a5a5a5;"&gt;Ask "y" or "n" instead of "yes" or "no". Yes, laziness is great.&lt;/span&gt;
(fset 'yes-or-no-p 'y-or-n-p)
</p>

<p>
&lt;span style="color: #a5a5a5;"&gt;;; &lt;/span&gt;&lt;span style="color: #a5a5a5;"&gt;Highlight corresponding parenthese when cursor is on one&lt;/span&gt;
(show-paren-mode t)
</p>

<p>
&lt;span style="color: #a5a5a5;"&gt;;; &lt;/span&gt;&lt;span style="color: #a5a5a5;"&gt;Highlight tabulations&lt;/span&gt;
(setq-default highlight-tabs t)
</p>

<p>
&lt;span style="color: #a5a5a5;"&gt;;; &lt;/span&gt;&lt;span style="color: #a5a5a5;"&gt;Show trailing white spaces&lt;/span&gt;
(setq-default show-trailing-whitespace t)
</p>

<p>
&lt;span style="color: #a5a5a5;"&gt;;; &lt;/span&gt;&lt;span style="color: #a5a5a5;"&gt;Remove useless whitespaces before saving a file&lt;/span&gt;
(add-hook 'before-save-hook 'whitespace-cleanup)
(add-hook 'before-save-hook (&lt;span style="color: #5FB7CC;"&gt;lambda&lt;/span&gt;() (delete-trailing-whitespace)))
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-3" class="outline-3"&gt;
&lt;h3 id="sec-5-3"&gt;&lt;span class="section-number-3"&gt;5.3&lt;/span&gt; Backup files&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-5-3"&gt;
&lt;p&gt;
You may have notice that the files you edit are duplicated and renamed with a &lt;i&gt;~&lt;/i&gt; at the end.
They are the backup files that Emacs creates for you with an auto-save feature.
Sometimes it is great because you can recover a file in case of error, sometimes it is annoying because you can have some many of these files.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
It is up to you to keep it or disable it.
Here is the configuration for that:
&lt;/p&gt;
</p>

<p>
&lt;div class="org-src-container"&gt;
</p>

<p>
&lt;pre class="src src-lisp"&gt;&lt;span style="color: #a5a5a5;"&gt;;; &lt;/span&gt;&lt;span style="color: #a5a5a5;"&gt;Remove all backup files&lt;/span&gt;
(setq make-backup-files nil)
(setq backup-inhibited t)
(setq auto-save-default nil)
&lt;/pre&gt;
&lt;/div&gt;
</p>

<p>
&lt;p&gt;
An alternative method is to save these backups in a centralized folder:
&lt;/p&gt;
</p>

<p>
&lt;div class="org-src-container"&gt;
</p>

<p>
&lt;pre class="src src-lisp"&gt;&lt;span style="color: #a5a5a5;"&gt;;; &lt;/span&gt;&lt;span style="color: #a5a5a5;"&gt;Save backup files in a dedicated directory&lt;/span&gt;
(setq backup-directory-alist '((&lt;span style="color: #aa3939;"&gt;"."&lt;/span&gt; . &lt;span style="color: #aa3939;"&gt;"~/.saves"&lt;/span&gt;)))
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-4" class="outline-3"&gt;
&lt;h3 id="sec-5-4"&gt;&lt;span class="section-number-3"&gt;5.4&lt;/span&gt; Setting up the locales&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-5-4"&gt;
&lt;p&gt;
You may want to set up a specific locale for your files.
Here is the trick:
&lt;/p&gt;
</p>

<p>
&lt;div class="org-src-container"&gt;
</p>

<p>
&lt;pre class="src src-lisp"&gt;&lt;span style="color: #a5a5a5;"&gt;;; &lt;/span&gt;&lt;span style="color: #a5a5a5;"&gt;Set locale to UTF8&lt;/span&gt;
(set-language-environment 'utf-8)
(set-terminal-coding-system 'utf-8)
(setq locale-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-5" class="outline-3"&gt;
&lt;h3 id="sec-5-5"&gt;&lt;span class="section-number-3"&gt;5.5&lt;/span&gt; More configuration&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-5-5"&gt;
&lt;p&gt;
The best way to get your configuration better, is to read the &lt;a href="<a href="http://www.gnu.org/software/emacs/manual/">http://www.gnu.org/software/emacs/manual/</a>"&gt;manual&lt;/a&gt; &amp;#x2026;
But you can also (this is the un-official method) read the others Emacs users' config files.
There are so many people who share their configuration, comment their code, and distribute their modes!
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
Here is mine: (&lt;a href="<a href="https://github.com/pierre-lecocq/emacs.d">https://github.com/pierre-lecocq/emacs.d</a>"&gt;<a href="https://github.com/pierre-lecocq/emacs.d">https://github.com/pierre-lecocq/emacs.d</a>&lt;/a&gt;)
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-6" class="outline-3"&gt;
&lt;h3 id="sec-5-6"&gt;&lt;span class="section-number-3"&gt;5.6&lt;/span&gt; Modes&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-5-6"&gt;
&lt;p&gt;
&lt;i&gt;Modes&lt;/i&gt; are Emacs' &lt;i&gt;extensions&lt;/i&gt; that can be installed to extend the capabilities of Emacs. They will allow you to build a powerful tailored editor.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
There are 2 kind of modes: minor and major.
&lt;/p&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-6-1" class="outline-4"&gt;
&lt;h4 id="sec-5-6-1"&gt;&lt;span class="section-number-4"&gt;5.6.1&lt;/span&gt; Major modes&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-5-6-1"&gt;
&lt;p&gt;
Major modes are modes that transform Emacs to a specialized software for editing a certain type of files (i.e c-mode) or managing special tasks (i.e reading emails, managing git repository, &amp;#x2026;)
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
Only one major mode can be used at a time.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-6-2" class="outline-4"&gt;
&lt;h4 id="sec-5-6-2"&gt;&lt;span class="section-number-4"&gt;5.6.2&lt;/span&gt; Minor modes&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-5-6-2"&gt;
&lt;p&gt;
Minor modes are additionnal modes that are added transparently to the major mode. They add more features to the main one (i.e parentheses matching, syntax or spelling checkers, &amp;#x2026;)
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
Several minor modes can be used at a time.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-7" class="outline-3"&gt;
&lt;h3 id="sec-5-7"&gt;&lt;span class="section-number-3"&gt;5.7&lt;/span&gt; Package managers&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-5-7"&gt;
&lt;p&gt;
Emacs has brilliant package managers such as &lt;i&gt;package.el&lt;/i&gt; or &lt;i&gt;el-get&lt;/i&gt; that allows you to add and update modes really easily.
&lt;/p&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-7-1" class="outline-4"&gt;
&lt;h4 id="sec-5-7-1"&gt;&lt;span class="section-number-4"&gt;5.7.1&lt;/span&gt; Package.el&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-5-7-1"&gt;
&lt;p&gt;
&lt;i&gt;package.el&lt;/i&gt; is the built in package manager shipped by default with Emacs 24 or later.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
To list available packages, simply type this command:
&lt;/p&gt;
</p>

<p>
&lt;div class="org-src-container"&gt;
</p>

<p>
&lt;pre class="src src-lisp"&gt;M-x package-list-packages
&lt;/pre&gt;
&lt;/div&gt;
</p>

<p>
&lt;p&gt;
You will have a list of packages. Simply press ENTER on the name of one of it to install it.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
Additionnaly, you can manage the packages list by adding other sources to your configuration file:
&lt;/p&gt;
</p>

<p>
&lt;div class="org-src-container"&gt;
</p>

<p>
&lt;pre class="src src-lisp"&gt;&lt;span style="color: #a5a5a5;"&gt;;; &lt;/span&gt;&lt;span style="color: #a5a5a5;"&gt;Add package sources&lt;/span&gt;
(setq package-archives '((&lt;span style="color: #aa3939;"&gt;"gnu"&lt;/span&gt; . &lt;span style="color: #aa3939;"&gt;"<a href="http://elpa.gnu.org/packages/">http://elpa.gnu.org/packages/</a>"&lt;/span&gt;)
                         (&lt;span style="color: #aa3939;"&gt;"marmalade"&lt;/span&gt; . &lt;span style="color: #aa3939;"&gt;"<a href="http://marmalade-repo.org/packages/">http://marmalade-repo.org/packages/</a>"&lt;/span&gt;)
                         (&lt;span style="color: #aa3939;"&gt;"melpa"&lt;/span&gt; . &lt;span style="color: #aa3939;"&gt;"<a href="http://melpa.milkbox.net/packages/">http://melpa.org/packages/</a>"&lt;/span&gt;)))
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-7-2" class="outline-4"&gt;
&lt;h4 id="sec-5-7-2"&gt;&lt;span class="section-number-4"&gt;5.7.2&lt;/span&gt; El-Get&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-5-7-2"&gt;
&lt;p&gt;
&lt;i&gt;&lt;a href="<a href="https://github.com/dimitri/el-get">https://github.com/dimitri/el-get</a>"&gt;el-get&lt;/a&gt;&lt;/i&gt; is one of the most popular and easy to use package manager. The "&lt;i&gt;apt-get&lt;/i&gt;" of Emacs.
It is written by the great &lt;a href="<a href="https://github.com/dimitri">https://github.com/dimitri</a>"&gt;Dimitri Fontaine&lt;/a&gt; and is based on recipe files that simply describe where is located the package and how to get/compile/install it for you.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
To use it, simply add this to your configuration file. It will download and set up &lt;i&gt;el-get&lt;/i&gt; for you:
&lt;/p&gt;
</p>

<p>
&lt;div class="org-src-container"&gt;
</p>

<p>
&lt;pre class="src src-lisp"&gt;&lt;span style="color: #a5a5a5;"&gt;;; &lt;/span&gt;&lt;span style="color: #a5a5a5;"&gt;Set up el-get&lt;/span&gt;
(add-to-list 'load-path &lt;span style="color: #aa3939;"&gt;"~/.emacs.d/el-get/el-get"&lt;/span&gt;)
(&lt;span style="color: #5FB7CC;"&gt;unless&lt;/span&gt; (&lt;span style="color: #5FB7CC;"&gt;require&lt;/span&gt; '&lt;span style="color: #8dd7e9;"&gt;el-get&lt;/span&gt; nil 'noerror)
  (with-current-buffer
      (url-retrieve-synchronously
       &lt;span style="color: #aa3939;"&gt;"<a href="https://raw.github.com/dimitri/el-get/master/el-get-install.el">https://raw.github.com/dimitri/el-get/master/el-get-install.el</a>"&lt;/span&gt;)
    (&lt;span style="color: #5FB7CC;"&gt;let&lt;/span&gt; (el-get-master-branch)
      (goto-char (point-max))
      (eval-print-last-sexp))))
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-7-3" class="outline-4"&gt;
&lt;h4 id="sec-5-7-3"&gt;&lt;span class="section-number-4"&gt;5.7.3&lt;/span&gt; The generic method&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-5-7-3"&gt;
&lt;p&gt;
In order to leave you the choice of the package manager you want to use, here is a function that handles several package managers. For now, it covers &lt;i&gt;package.el&lt;/i&gt; and &lt;i&gt;el-get&lt;/i&gt;.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
It also allows you to automatically install packages you want.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
In the following snippet, two sample packages are installed
&lt;/p&gt;
</p>

<p>
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;i&gt;color-theme&lt;/i&gt; in order to allow us to  change colors themes
&lt;/li&gt;
&lt;li&gt;&lt;i&gt;autopair&lt;/i&gt; in order to close automatically parentheses, brackets and braces when you open it
&lt;/li&gt;
&lt;/ul&gt;
</p>

<p>
&lt;p&gt;
Simply add this code to your configuration file:
&lt;/p&gt;
</p>

<p>
&lt;div class="org-src-container"&gt;
</p>

<p>
&lt;pre class="src src-lisp"&gt;&lt;span style="color: #a5a5a5;"&gt;;; &lt;/span&gt;&lt;span style="color: #a5a5a5;"&gt;Set up the package manager of choice. Supports "el-get" and "package.el"&lt;/span&gt;
(setq pmoc &lt;span style="color: #aa3939;"&gt;"el-get"&lt;/span&gt;)
</p>

<p>
&lt;span style="color: #a5a5a5;"&gt;;; &lt;/span&gt;&lt;span style="color: #a5a5a5;"&gt;List of all wanted packages&lt;/span&gt;
(setq
 wanted-packages
 '(
   color-theme
   autopair
))
</p>

<p>
&lt;span style="color: #a5a5a5;"&gt;;; &lt;/span&gt;&lt;span style="color: #a5a5a5;"&gt;Package manager and packages handler&lt;/span&gt;
(&lt;span style="color: #5FB7CC;"&gt;defun&lt;/span&gt; &lt;span style="color: #1D68C4;"&gt;install-wanted-packages&lt;/span&gt; ()
  &lt;span style="color: #aa3939;"&gt;"Install wanted packages according to a specific package manager"&lt;/span&gt;
  (interactive)
  (&lt;span style="color: #5FB7CC;"&gt;cond&lt;/span&gt;
   &lt;span style="color: #a5a5a5;"&gt;;; &lt;/span&gt;&lt;span style="color: #a5a5a5;"&gt;package.el&lt;/span&gt;
   ((string= pmoc &lt;span style="color: #aa3939;"&gt;"package.el"&lt;/span&gt;)
    (&lt;span style="color: #5FB7CC;"&gt;require&lt;/span&gt; '&lt;span style="color: #8dd7e9;"&gt;package&lt;/span&gt;)
    (add-to-list 'package-archives '(&lt;span style="color: #aa3939;"&gt;"gnu"&lt;/span&gt; . &lt;span style="color: #aa3939;"&gt;"<a href="http://elpa.gnu.org/packages/">http://elpa.gnu.org/packages/</a>"&lt;/span&gt;))
    (add-to-list 'package-archives '(&lt;span style="color: #aa3939;"&gt;"melpa"&lt;/span&gt; . &lt;span style="color: #aa3939;"&gt;"<a href="http://melpa.milkbox.net/packages/">http://melpa.org/packages/</a>"&lt;/span&gt;))
    (add-to-list 'package-archives '(&lt;span style="color: #aa3939;"&gt;"marmelade"&lt;/span&gt; . &lt;span style="color: #aa3939;"&gt;"<a href="http://marmalade-repo.org/packages/">http://marmalade-repo.org/packages/</a>"&lt;/span&gt;))
    (package-initialize)
    (&lt;span style="color: #5FB7CC;"&gt;let&lt;/span&gt; ((need-refresh nil))
      (mapc (&lt;span style="color: #5FB7CC;"&gt;lambda&lt;/span&gt; (package-name)
          (&lt;span style="color: #5FB7CC;"&gt;unless&lt;/span&gt; (package-installed-p package-name)
        (set 'need-refresh t))) wanted-packages)
      (&lt;span style="color: #5FB7CC;"&gt;if&lt;/span&gt; need-refresh
        (package-refresh-contents)))
    (mapc (&lt;span style="color: #5FB7CC;"&gt;lambda&lt;/span&gt; (package-name)
        (&lt;span style="color: #5FB7CC;"&gt;unless&lt;/span&gt; (package-installed-p package-name)
          (package-install package-name))) wanted-packages)
    )
   &lt;span style="color: #a5a5a5;"&gt;;; &lt;/span&gt;&lt;span style="color: #a5a5a5;"&gt;el-get&lt;/span&gt;
   ((string= pmoc &lt;span style="color: #aa3939;"&gt;"el-get"&lt;/span&gt;)
    (add-to-list 'load-path &lt;span style="color: #aa3939;"&gt;"~/.emacs.d/el-get/el-get"&lt;/span&gt;)
    (&lt;span style="color: #5FB7CC;"&gt;unless&lt;/span&gt; (&lt;span style="color: #5FB7CC;"&gt;require&lt;/span&gt; '&lt;span style="color: #8dd7e9;"&gt;el-get&lt;/span&gt; nil 'noerror)
      (with-current-buffer
      (url-retrieve-synchronously
       &lt;span style="color: #aa3939;"&gt;"<a href="https://raw.github.com/dimitri/el-get/master/el-get-install.el">https://raw.github.com/dimitri/el-get/master/el-get-install.el</a>"&lt;/span&gt;)
    (&lt;span style="color: #5FB7CC;"&gt;let&lt;/span&gt; (el-get-master-branch)
      (goto-char (point-max))
      (eval-print-last-sexp))))
    (el-get 'sync wanted-packages))
   &lt;span style="color: #a5a5a5;"&gt;;; &lt;/span&gt;&lt;span style="color: #a5a5a5;"&gt;fallback&lt;/span&gt;
   (t (&lt;span style="color: #ffc0cb; font-weight: bold;"&gt;error&lt;/span&gt; &lt;span style="color: #aa3939;"&gt;"Unsupported package manager"&lt;/span&gt;)))
  )
</p>

<p>
&lt;span style="color: #a5a5a5;"&gt;;; &lt;/span&gt;&lt;span style="color: #a5a5a5;"&gt;Install wanted packages&lt;/span&gt;
(install-wanted-packages)
&lt;/pre&gt;
&lt;/div&gt;
</p>

<p>
&lt;p&gt;
Note that some of the following package names could vary if you use &lt;i&gt;package.el&lt;/i&gt; or &lt;i&gt;el-get&lt;/i&gt;.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-7-4" class="outline-4"&gt;
&lt;h4 id="sec-5-7-4"&gt;&lt;span class="section-number-4"&gt;5.7.4&lt;/span&gt; The modern and efficient way&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-5-7-4"&gt;
&lt;p&gt;
Some upper-level packages make package management easier and cleaner.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
For example, John Wiegley's &lt;code&gt;use-package&lt;/code&gt; software is an elegant and efficient way to install and tidy your external packages configurations.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
Here is the way to use it:
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
First, setup packages sources and install &lt;code&gt;use-package&lt;/code&gt;
&lt;/p&gt;
</p>

<p>
&lt;div class="org-src-container"&gt;
</p>

<p>
&lt;pre class="src src-lisp"&gt;(&lt;span style="color: #5FB7CC;"&gt;require&lt;/span&gt; '&lt;span style="color: #8dd7e9;"&gt;package&lt;/span&gt;)
(setq package-archives '((&lt;span style="color: #aa3939;"&gt;"gnu"&lt;/span&gt; . &lt;span style="color: #aa3939;"&gt;"<a href="http://elpa.gnu.org/packages/">http://elpa.gnu.org/packages/</a>"&lt;/span&gt;)
                         (&lt;span style="color: #aa3939;"&gt;"marmalade"&lt;/span&gt; . &lt;span style="color: #aa3939;"&gt;"<a href="http://marmalade-repo.org/packages/">http://marmalade-repo.org/packages/</a>"&lt;/span&gt;)
                         (&lt;span style="color: #aa3939;"&gt;"melpa"&lt;/span&gt; . &lt;span style="color: #aa3939;"&gt;"<a href="http://melpa.milkbox.net/packages/">http://melpa.org/packages/</a>"&lt;/span&gt;)))
(package-initialize)
</p>

<p>
(&lt;span style="color: #5FB7CC;"&gt;unless&lt;/span&gt; (package-installed-p 'use-package)
  (&lt;span style="color: #5FB7CC;"&gt;progn&lt;/span&gt;
    (package-refresh-contents)
    (package-install 'use-package)))
</p>

<p>
(&lt;span style="color: #5FB7CC;"&gt;require&lt;/span&gt; '&lt;span style="color: #8dd7e9;"&gt;use-package&lt;/span&gt;)
&lt;/pre&gt;
&lt;/div&gt;
</p>

<p>
&lt;p&gt;
Then, for each package you want to install, simply add this to your configuration (replace &lt;i&gt;the-package-name&lt;/i&gt; by any package name):
&lt;/p&gt;
</p>

<p>
&lt;div class="org-src-container"&gt;
</p>

<p>
&lt;pre class="src src-LISP"&gt;(use-package the-package-name
</p>
<p>
:ensure the-package-name
</p>
<p>
         :init (progn
                  ;; Do something after the package is initialized
                ))
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-8" class="outline-3"&gt;
&lt;h3 id="sec-5-8"&gt;&lt;span class="section-number-3"&gt;5.8&lt;/span&gt; Some useful packages&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-5-8"&gt;
&lt;p&gt;
As a developer, you will need some packages that will help you to work, increase your productivity and enhance your confort while coding.
Please note that even if I am a Ruby/shell/Lisp/web/PHP developer, some packages are compatible and useful for every kind of development. Therefore, the base packages are listed here but some specific packages that might be useful for your work are eventually not listed here. It is up to you to adapt the list according to your needs!
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
Tip: After adding packages, restart Emacs in order to let &lt;i&gt;el-get&lt;/i&gt; download and install it properly.
&lt;/p&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-8-1" class="outline-4"&gt;
&lt;h4 id="sec-5-8-1"&gt;&lt;span class="section-number-4"&gt;5.8.1&lt;/span&gt; Auto complete&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-5-8-1"&gt;
&lt;p&gt;
Auto completion is a must-have feature in the development world.
This package simply displays a popup at the cursor position with the available completions.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
To install it, add &lt;code&gt;auto-complete&lt;/code&gt; to your packages list.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
&lt;a href="<a href="http://www.emacswiki.org/emacs/AutoComplete">http://www.emacswiki.org/emacs/AutoComplete</a>"&gt;Read more&lt;/a&gt;
&lt;/p&gt;
</p>


<p>
&lt;div class="figure"&gt;
&lt;p&gt;&lt;img src="../images/mode-autocomplete.gif" alt="mode-autocomplete.gif" /&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-8-2" class="outline-4"&gt;
&lt;h4 id="sec-5-8-2"&gt;&lt;span class="section-number-4"&gt;5.8.2&lt;/span&gt; Autopair&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-5-8-2"&gt;
&lt;p&gt;
When you open a quote/parenthese/bracket/curly bracket, this mode automatically adds the closed one and bring your cusror between the two.
Very useful to avoid syntax errors, for example.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
To install it, add &lt;code&gt;autopair&lt;/code&gt; to your packages list.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
&lt;a href="<a href="https://github.com/capitaomorte/autopair">https://github.com/capitaomorte/autopair</a>"&gt;Read more&lt;/a&gt;
&lt;/p&gt;
</p>


<p>
&lt;div class="figure"&gt;
&lt;p&gt;&lt;img src="../images/mode-autopair.gif" alt="mode-autopair.gif" /&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-8-3" class="outline-4"&gt;
&lt;h4 id="sec-5-8-3"&gt;&lt;span class="section-number-4"&gt;5.8.3&lt;/span&gt; Buffer move&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-5-8-3"&gt;
&lt;p&gt;
This mode allows you to re-organize and move the buffers from a window to another.
Useful if you want to switch buffer places in order to have your debugging buffer on the right side, for example.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
To install it, add &lt;code&gt;buffer-move&lt;/code&gt; to your packages list.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
&lt;a href="<a href="http://www.emacswiki.org/cgi-bin/wiki/buffer-move.el">http://www.emacswiki.org/cgi-bin/wiki/buffer-move.el</a>"&gt;Read more&lt;/a&gt;
&lt;/p&gt;
</p>


<p>
&lt;div class="figure"&gt;
&lt;p&gt;&lt;img src="../images/mode-buffermove.gif" alt="mode-buffermove.gif" /&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-8-4" class="outline-4"&gt;
&lt;h4 id="sec-5-8-4"&gt;&lt;span class="section-number-4"&gt;5.8.4&lt;/span&gt; Flycheck&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-5-8-4"&gt;
&lt;p&gt;
This mode check the syntax of a buffer. It could be used for checking code syntax or typos when writing any kind of text.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
To install it, add &lt;code&gt;flycheck&lt;/code&gt; to your packages list.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
&lt;a href="<a href="https://github.com/flycheck/flycheck">https://github.com/flycheck/flycheck</a>"&gt;Read more&lt;/a&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-8-5" class="outline-4"&gt;
&lt;h4 id="sec-5-8-5"&gt;&lt;span class="section-number-4"&gt;5.8.5&lt;/span&gt; Highlight symbol&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-5-8-5"&gt;
&lt;p&gt;
This mode highlights all symbols that matches a pattern in your buffer
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
To install it, add &lt;code&gt;highlight-symbol&lt;/code&gt; to your packages list.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
&lt;a href="<a href="http://www.emacswiki.org/emacs/HighlightSymbol">http://www.emacswiki.org/emacs/HighlightSymbol</a>"&gt;Read more&lt;/a&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-8-6" class="outline-4"&gt;
&lt;h4 id="sec-5-8-6"&gt;&lt;span class="section-number-4"&gt;5.8.6&lt;/span&gt; Ido&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-5-8-6"&gt;
&lt;p&gt;
Ido is a must have mode to navigate, find stuffs, and do things interactively.
It is for comfort, but is indispensable to go fast.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
Many extensions of this mode are available, therefore read and chose what you want.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
I personnaly use two of them: &lt;i&gt;vertical&lt;/i&gt; and &lt;i&gt;hack&lt;/i&gt;.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
To install it, add &lt;code&gt;ido-hacks&lt;/code&gt; and &lt;code&gt;ido-vertical-mode&lt;/code&gt; to your packages list.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
&lt;a href="<a href="http://www.emacswiki.org/emacs/InteractivelyDoThings">http://www.emacswiki.org/emacs/InteractivelyDoThings</a>"&gt;Read more&lt;/a&gt;
&lt;/p&gt;
</p>


<p>
&lt;div class="figure"&gt;
&lt;p&gt;&lt;img src="../images/mode-ido.gif" alt="mode-ido.gif" /&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-8-7" class="outline-4"&gt;
&lt;h4 id="sec-5-8-7"&gt;&lt;span class="section-number-4"&gt;5.8.7&lt;/span&gt; JS3&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-5-8-7"&gt;
&lt;p&gt;
This mode is an enhanced mode for editing Javascript files. I do not use it a lot, but it is useful for some javascript-like or NPM files.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
To install it, add &lt;code&gt;js3-mode&lt;/code&gt; to your packages list.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
&lt;a href="<a href="http://www.emacswiki.org/emacs/Js2Mode">http://www.emacswiki.org/emacs/Js2Mode</a>"&gt;Read more&lt;/a&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-8-8" class="outline-4"&gt;
&lt;h4 id="sec-5-8-8"&gt;&lt;span class="section-number-4"&gt;5.8.8&lt;/span&gt; Magit&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-5-8-8"&gt;
&lt;p&gt;
Magit is a very powerful and elegant mode for intercating with your git repository.
In order to understand how powerful it is, simply watch this amazing &lt;a href="<a href="http://vimeo.com/2871241">http://vimeo.com/2871241</a>"&gt;video&lt;/a&gt;
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
To install it, add &lt;code&gt;magit&lt;/code&gt; to your packages list.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
&lt;a href="<a href="https://github.com/magit/magit">https://github.com/magit/magit</a>"&gt;Read more&lt;/a&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-8-9" class="outline-4"&gt;
&lt;h4 id="sec-5-8-9"&gt;&lt;span class="section-number-4"&gt;5.8.9&lt;/span&gt; Multiple cursors&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-5-8-9"&gt;
&lt;p&gt;
This mode is great and super powerful. Instead of explaining what it is, check this amazing &lt;a href="<a href="http://emacsrocks.com/e13.html">http://emacsrocks.com/e13.html</a>"&gt;video&lt;/a&gt; by Magnars.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
To install it, add &lt;code&gt;multiple-cursors&lt;/code&gt; to your packages list.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
&lt;a href="<a href="https://github.com/magnars/multiple-cursors.el">https://github.com/magnars/multiple-cursors.el</a>"&gt;Read more&lt;/a&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-8-10" class="outline-4"&gt;
&lt;h4 id="sec-5-8-10"&gt;&lt;span class="section-number-4"&gt;5.8.10&lt;/span&gt; PHP mode&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-5-8-10"&gt;
&lt;p&gt;
A basic but stable mode for editing PHP files, whatever you think about PHP &amp;#x2026;
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
To install it, add &lt;code&gt;php-mode&lt;/code&gt; to your packages list.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
&lt;a href="<a href="http://php-mode.sourceforge.net/">http://php-mode.sourceforge.net/</a>"&gt;Read more&lt;/a&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-8-11" class="outline-4"&gt;
&lt;h4 id="sec-5-8-11"&gt;&lt;span class="section-number-4"&gt;5.8.11&lt;/span&gt; Rainbow mode&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-5-8-11"&gt;
&lt;p&gt;
A useless but indispensable mode to add colors to your CSS files when using properties like "color", "background-color".
It is cool since it understands every way to write a color (hex, name, &amp;#x2026;) and gives you a preview of the color itself.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
To install it, add &lt;code&gt;rainbow-mode&lt;/code&gt; to your packages list.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
&lt;a href="<a href="http://julien.danjou.info/projects/emacs-packages">http://julien.danjou.info/projects/emacs-packages</a>"&gt;Read more&lt;/a&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-8-12" class="outline-4"&gt;
&lt;h4 id="sec-5-8-12"&gt;&lt;span class="section-number-4"&gt;5.8.12&lt;/span&gt; RHTML mode&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-5-8-12"&gt;
&lt;p&gt;
This mode is useful for editing .rhtml files. You can also use it to edit any kinf of ruby templates (i.e .erb).
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
To install it, add &lt;code&gt;rhtml-mode&lt;/code&gt; to your packages list.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
&lt;a href="<a href="https://github.com/eschulte/rhtml">https://github.com/eschulte/rhtml</a>"&gt;Read more&lt;/a&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-8-13" class="outline-4"&gt;
&lt;h4 id="sec-5-8-13"&gt;&lt;span class="section-number-4"&gt;5.8.13&lt;/span&gt; Ruby mode&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-5-8-13"&gt;
&lt;p&gt;
Do I really need to explain ?
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
Ruby mode is already installed in Emacs and is very stable.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
&lt;a href="<a href="http://www.emacswiki.org/emacs/RubyMode">http://www.emacswiki.org/emacs/RubyMode</a>"&gt;Read more&lt;/a&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-8-14" class="outline-4"&gt;
&lt;h4 id="sec-5-8-14"&gt;&lt;span class="section-number-4"&gt;5.8.14&lt;/span&gt; Switch window&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-5-8-14"&gt;
&lt;p&gt;
This mode is cool when you work with a lot of windows opened.
If you want to switch to another one, you have to press &lt;b&gt;C-x o&lt;/b&gt; until you reach the wanted window.
With this mode, when you press &lt;b&gt;C-x o&lt;/b&gt;, big numbers replace your opened windows. Simply type the corresponding number to reach the wanted window.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
To install it, add &lt;code&gt;switch-window&lt;/code&gt; to your packages list.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
Then do not forget to override the defaut configuration by adding this to your configuration:
&lt;/p&gt;
</p>

<p>
&lt;div class="org-src-container"&gt;
</p>

<p>
&lt;pre class="src src-lisp"&gt;(global-set-key (kbd &lt;span style="color: #aa3939;"&gt;"C-x o"&lt;/span&gt;) 'switch-window)
&lt;/pre&gt;
&lt;/div&gt;
</p>

<p>
&lt;p&gt;
&lt;a href="<a href="https://github.com/dimitri/switch-window">https://github.com/dimitri/switch-window</a>"&gt;Read more&lt;/a&gt;
&lt;/p&gt;
</p>


<p>
&lt;div class="figure"&gt;
&lt;p&gt;&lt;img src="../images/mode-switchwindow.gif" alt="mode-switchwindow.gif" /&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-8-15" class="outline-4"&gt;
&lt;h4 id="sec-5-8-15"&gt;&lt;span class="section-number-4"&gt;5.8.15&lt;/span&gt; Visual regexp&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-5-8-15"&gt;
&lt;p&gt;
This mode highlights the text that matches the regexp that you are writing in the mini buffer.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
To install it, add &lt;code&gt;visual-regexp&lt;/code&gt; to your packages list.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
&lt;a href="<a href="https://github.com/benma/visual-regexp.el">https://github.com/benma/visual-regexp.el</a>"&gt;Read more&lt;/a&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-8-16" class="outline-4"&gt;
&lt;h4 id="sec-5-8-16"&gt;&lt;span class="section-number-4"&gt;5.8.16&lt;/span&gt; Yaml mode&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-5-8-16"&gt;
&lt;p&gt;
Alows you to edit .yml files
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
To install it, add &lt;code&gt;yaml-mode&lt;/code&gt; to your packages list.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
&lt;a href="<a href="http://www.emacswiki.org/emacs/YamlMode">http://www.emacswiki.org/emacs/YamlMode</a>"&gt;Read more&lt;/a&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-8-17" class="outline-4"&gt;
&lt;h4 id="sec-5-8-17"&gt;&lt;span class="section-number-4"&gt;5.8.17&lt;/span&gt; Yasnippet&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-5-8-17"&gt;
&lt;p&gt;
A mode that allows you to write code faster if you are lazy.
It is very easy to create your own snippets and use it whatever the file you are editing (code, non-code, emails, &amp;#x2026;)
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
I personnaly do not use it, but people coming from Textmate/Sublime would love it.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
To install it, add &lt;code&gt;yasnippet&lt;/code&gt; to your packages list.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
&lt;a href="<a href="http://www.emacswiki.org/emacs/Yasnippet">http://www.emacswiki.org/emacs/Yasnippet</a>"&gt;Read more&lt;/a&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-8-18" class="outline-4"&gt;
&lt;h4 id="sec-5-8-18"&gt;&lt;span class="section-number-4"&gt;5.8.18&lt;/span&gt; Paredit&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-5-8-18"&gt;
&lt;p&gt;
Paredit is a really cool mode to "keep parentheses balanced" and navigating in the S-expressions. Useful and indispensable if you write Lisp code, for example.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
To install it, add &lt;code&gt;paredit&lt;/code&gt; to your packages list.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
&lt;a href="<a href="http://www.emacswiki.org/emacs/ParEdit">http://www.emacswiki.org/emacs/ParEdit</a>"&gt;Read more&lt;/a&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-9" class="outline-3"&gt;
&lt;h3 id="sec-5-9"&gt;&lt;span class="section-number-3"&gt;5.9&lt;/span&gt; Code navigation&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-5-9"&gt;
&lt;p&gt;
Navigate through source code is an indispensable feature in code editors. Some of other editors are focused on this (like Sublime) but the problem is that they do not leave you the choices of the weapons (like every other features).
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
Emacs, as you noticed (yes, you did) can integrate any external tool or include a large variety of internal tools to make it more efficient. Code navigation is not an exception.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
There are a lot of packages in order to navigate through code, with different methodologies and advantages:
&lt;/p&gt;
</p>

<p>
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a href="<a href="http://www.emacswiki.org/emacs/EmacsTags">http://www.emacswiki.org/emacs/EmacsTags</a>"&gt;TAGS&lt;/a&gt; (built in. No installation required)
&lt;/li&gt;
&lt;li&gt;&lt;a href="<a href="https://github.com/bbatsov/projectile">https://github.com/bbatsov/projectile</a>"&gt;Projectile&lt;/a&gt; (install it by adding &lt;code&gt;projectile&lt;/code&gt; to your packages list)
&lt;/li&gt;
&lt;li&gt;&lt;a href="<a href="https://github.com/emacs-helm/helm">https://github.com/emacs-helm/helm</a>"&gt;Helm&lt;/a&gt; (install it by adding &lt;code&gt;heml&lt;/code&gt; to your packages list)
&lt;/li&gt;
&lt;li&gt;&lt;a href="<a href="http://cedet.sourceforge.net/">http://cedet.sourceforge.net/</a>"&gt;Emacs CEDET&lt;/a&gt; (install it by adding &lt;code&gt;cedet&lt;/code&gt; to your packages list)
&lt;/li&gt;
&lt;li&gt;&amp;#x2026;
&lt;/li&gt;
&lt;/ul&gt;
</p>

<p>
&lt;p&gt;
(Note: use once at a time! You do not need to install them all)
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
After using &lt;i&gt;Projectile&lt;/i&gt; for a certain period of time, I gave &lt;i&gt;Helm&lt;/i&gt; a shot but finally got back to the simplicity and the efficiency of the &lt;i&gt;TAGS&lt;/i&gt; system.
Nevertheless, &lt;i&gt;Projectile&lt;/i&gt; and &lt;i&gt;Helm&lt;/i&gt; are really powerful and useful. You really should look at them.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
For now, I will cover the basics of &lt;i&gt;TAGS&lt;/i&gt; since it is a standard (used by other softwares) and it is built-in (so if you use another Emacs without your config, you still know how to surf in the code). And other useful tricks will be shown here.
&lt;/p&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-9-1" class="outline-4"&gt;
&lt;h4 id="sec-5-9-1"&gt;&lt;span class="section-number-4"&gt;5.9.1&lt;/span&gt; Tags basics&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-5-9-1"&gt;
&lt;p&gt;
Basically, the TAGS rely on an index file of the content of your code source.
In the root folder of a project, you must generate your index.
Several methods for this, but here is one command that generates the file:
&lt;/p&gt;
</p>

<p>
&lt;div class="org-src-container"&gt;
</p>

<p>
&lt;pre class="src src-sh"&gt;&lt;span style="color: #7FFFD4;"&gt;cd&lt;/span&gt; /path/to/your/project
find . -regex &lt;span style="color: #aa3939;"&gt;".*\.\(c\|h\|rb\|py\|php\|js\|sh\|bash\)"&lt;/span&gt; -print | xargs etags -a
&lt;/pre&gt;
&lt;/div&gt;
</p>

<p>
&lt;p&gt;
You now should see a "TAGS" file. If needed, exclude this file from your git/svn/whatever repository/.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
You are now ready to surf!
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
Now, here are the main commands to use them:
&lt;/p&gt;
</p>

<p>
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;b&gt;M-.&lt;/b&gt; is the equivalent of &lt;b&gt;M-x find-tag&lt;/b&gt;: find a tag
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;M-x find-tag-other-window&lt;/b&gt;: find a tag, but in another window
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;M-x tags-search&lt;/b&gt;: find a tag thanks to a regexp
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;M-x tags-query-replace&lt;/b&gt;: replace a tag in all the indexed files
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;M-x tags-apropos&lt;/b&gt;: list all tags that match a regexp
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;M-x list-tags&lt;/b&gt;: list all tags in a file
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-9-2" class="outline-4"&gt;
&lt;h4 id="sec-5-9-2"&gt;&lt;span class="section-number-4"&gt;5.9.2&lt;/span&gt; List functions or methods&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-5-9-2"&gt;
&lt;p&gt;
In order to list and jump easily between the functions or methods of the current file, here is a little trick:
&lt;/p&gt;
</p>

<p>
&lt;div class="org-src-container"&gt;
</p>

<p>
&lt;pre class="src src-emacs-lisp"&gt;(global-set-key (kbd &lt;span style="color: #aa3939;"&gt;"C-S-f"&lt;/span&gt;) 'imenu) &lt;span style="color: #a5a5a5;"&gt;;; &lt;/span&gt;&lt;span style="color: #a5a5a5;"&gt;use iMenu&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
</p>

<p>
&lt;p&gt;
After pressing Ctrl-Shift-f (replace it by whatever you want!), a menu with all the available resources appears in the minibuffer.
Select the resource you want (let's say &lt;i&gt;All.methods&lt;/i&gt; if you are editing some code) and you will be able to search and jump to a method definition directly.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-9-3" class="outline-4"&gt;
&lt;h4 id="sec-5-9-3"&gt;&lt;span class="section-number-4"&gt;5.9.3&lt;/span&gt; Files navigation (a.k.a fuzzy matching) with TAGS and ido&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-5-9-3"&gt;
&lt;p&gt;
In order to find and jump easily to a file in your project thanks to TAGS, you have to add a little function to your confiugration.
For this you should have installed the &lt;code&gt;ido-mode&lt;/code&gt; described above.
&lt;/p&gt;
</p>

<p>
&lt;div class="org-src-container"&gt;
</p>

<p>
&lt;pre class="src src-emacs-lisp"&gt;(&lt;span style="color: #5FB7CC;"&gt;defun&lt;/span&gt; &lt;span style="color: #1D68C4;"&gt;ido-find-file-in-tag-files&lt;/span&gt; ()
  (interactive)
  (&lt;span style="color: #5FB7CC;"&gt;save-excursion&lt;/span&gt;
    (&lt;span style="color: #5FB7CC;"&gt;let&lt;/span&gt; ((enable-recursive-minibuffers t))
      (visit-tags-table-buffer))
    (find-file
     (expand-file-name
      (ido-completing-read
       &lt;span style="color: #aa3939;"&gt;"Project file: "&lt;/span&gt; (tags-table-files) nil t)))))
</p>

<p>
(global-set-key (kbd &lt;span style="color: #aa3939;"&gt;"C-S-x C-S-f"&lt;/span&gt;) 'ido-find-file-in-tag-files)
&lt;/pre&gt;
&lt;/div&gt;
</p>

<p>
&lt;p&gt;
Now, in your project folder and once you generated your TAGS file, you can press &lt;b&gt;C-S-x C-S-f&lt;/b&gt; to find files through the whole tree of directories just by typing a pattern.
&lt;/p&gt;
</p>


<p>
&lt;div class="figure"&gt;
&lt;p&gt;&lt;img src="../images/fuzzy.gif" alt="fuzzy.gif" /&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-9-4" class="outline-4"&gt;
&lt;h4 id="sec-5-9-4"&gt;&lt;span class="section-number-4"&gt;5.9.4&lt;/span&gt; RGrep&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-5-9-4"&gt;
&lt;p&gt;
&lt;i&gt;rgrep&lt;/i&gt; is a great tool to use in addition of the TAGS. It is a Unix tool that make &lt;i&gt;grep&lt;/i&gt; queries recursively. In Emacs, it will bring you a new buffer with all the results of the command. To use it, simply type:
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
&lt;b&gt;M-x rgrep RET yoursearchterm RET&lt;/b&gt;
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
Once fired, you can swith to the newly created buffer, parse the results and jump to the wanted files very quickly.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
What is cool is that it is integrated in the editor, just beside your code and does not require to switch to a shell and then copy-paste the files path you want.
&lt;/p&gt;
</p>


<p>
&lt;div class="figure"&gt;
&lt;p&gt;&lt;img src="../images/rgrep.gif" alt="rgrep.gif" /&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>


<p>
&lt;div id="outline-container-sec-5-10" class="outline-3"&gt;
&lt;h3 id="sec-5-10"&gt;&lt;span class="section-number-3"&gt;5.10&lt;/span&gt; Setting a color theme&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-5-10"&gt;
&lt;p&gt;
Now, we are talking about something very touchy and that can be a long quest &amp;#x2026;
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
A color theme generally includes colors for:
&lt;/p&gt;
</p>

<p>
&lt;ul class="org-ul"&gt;
&lt;li&gt;background
&lt;/li&gt;
&lt;li&gt;syntax color (for code)
&lt;/li&gt;
&lt;li&gt;specific modes colors (gnus, dired, git, &amp;#x2026;)
&lt;/li&gt;
&lt;/ul&gt;
</p>

<p>
&lt;p&gt;
There are several ways to install a color theme, but first, we will use the Emacs' internal color-theme library.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
Let's try to switch between different themes:
&lt;/p&gt;
</p>

<p>
&lt;ul class="org-ul"&gt;
&lt;li&gt;Type &lt;b&gt;M-x load-theme RET tango-dark&lt;/b&gt;
&lt;/li&gt;
&lt;li&gt;Then type &lt;b&gt;M-x load-theme RET wombat&lt;/b&gt;
&lt;/li&gt;
&lt;li&gt;Finally type &lt;b&gt;M-x load-theme RET whiteboard&lt;/b&gt;
&lt;/li&gt;
&lt;/ul&gt;
</p>

<p>
&lt;p&gt;
There is no secret or perfect color theme. There are so many of theme and each user has its preferences in term of colors.
&lt;/p&gt;
</p>


<p>
&lt;div class="figure"&gt;
&lt;p&gt;&lt;img src="../images/colors.gif" alt="colors.gif" /&gt;
&lt;/p&gt;
&lt;p&gt;&lt;span class="figure-number"&gt;Figure 15:&lt;/span&gt; color themes&lt;/p&gt;
&lt;/div&gt;
</p>

<p>
&lt;p&gt;
In order to choose yours, try the default ones, see this &lt;a href="<a href="http://gnuemacscolorthemetest.googlecode.com/svn/html/index-el.html">http://gnuemacscolorthemetest.googlecode.com/svn/html/index-el.html</a>"&gt;showcase&lt;/a&gt;, make your own or google a lot !
&lt;/p&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-5-10-1" class="outline-4"&gt;
&lt;h4 id="sec-5-10-1"&gt;&lt;span class="section-number-4"&gt;5.10.1&lt;/span&gt; Font settings&lt;/h4&gt;
&lt;div class="outline-text-4" id="text-5-10-1"&gt;
&lt;p&gt;
After setting up your theme, there are some other tweaks that are "color theme related".
Fonts is something very important depending on your system, your screen size, your current task in Emacs, &amp;#x2026; etc
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
If you want to change the font directly from your current Emacs instance, simply type &lt;b&gt;M-x set-frame-font RET&lt;/b&gt;.
And if you want to see all supported fonts, type &lt;b&gt;TAB&lt;/b&gt; twice. It will show you a list.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
The global and easy way to do it is to add a line to your configuration:
&lt;/p&gt;
</p>

<p>
&lt;div class="org-src-container"&gt;
</p>

<p>
&lt;pre class="src src-lisp"&gt;(set-default-font &lt;span style="color: #aa3939;"&gt;"DejaVu Sans Mono-10"&lt;/span&gt;)
&lt;/pre&gt;
&lt;/div&gt;
</p>

<p>
&lt;p&gt;
But to be safe, you'd better add this into your X resource settings file (~/.Xresources):
&lt;/p&gt;
</p>

<p>
&lt;div class="org-src-container"&gt;
</p>

<p>
&lt;pre class="src src-lisp"&gt;emacs.font: DejaVu Sans Mono-10
&lt;/pre&gt;
&lt;/div&gt;
</p>

<p>
&lt;p&gt;
Of course, it is possible to set a different font for any system or mode you want. It is cool since you can use different font (size) if you are on Linux or mac OR if you write a book, write code, read your emails, &amp;#x2026; etc.
As an exercise, I'll let you search how to do this kind of stuff in Emacs Lisp if you need it.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
If you want more about font settings and especially about font names, please see the &lt;a href="<a href="http://www.emacswiki.org/emacs/SetFonts">http://www.emacswiki.org/emacs/SetFonts</a>"&gt;Emacs wiki page&lt;/a&gt; or the &lt;a href="<a href="http://www.gnu.org/software/emacs/manual/html_node/emacs/Fonts.html">http://www.gnu.org/software/emacs/manual/html_node/emacs/Fonts.html</a>"&gt;manual&lt;/a&gt;.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
A last point: sometimes you want to change the font size of your current buffer. To do this, simply type:
&lt;/p&gt;
</p>

<p>
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;b&gt;M-x text-scale-increase&lt;/b&gt; or &lt;b&gt;C-x C-+&lt;/b&gt;
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;M-x text-scale-decrease&lt;/b&gt; or &lt;b&gt;C-x C&#x2013;&lt;/b&gt; (Ctrl x, Ctrl dash)
&lt;/li&gt;
&lt;/ul&gt;
</p>

<p>
&lt;p&gt;
Really handy if you show your screen through an external display or you want to focus on a specific part of a file.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-6" class="outline-2"&gt;
&lt;h2 id="sec-6"&gt;&lt;span class="section-number-2"&gt;6&lt;/span&gt; Emacs for developers - Emacs developing environments&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-6"&gt;
&lt;p&gt;
Emacs, thanks to major or minor modes can be transformed into a powerful specific environment.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
According to the kind of files you are editing (or a command you type), it can mutate and give you specific features that fits the need of a programming language (or a task like debugging, launching unit tests, &amp;#x2026;)
&lt;/p&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-6-1" class="outline-3"&gt;
&lt;h3 id="sec-6-1"&gt;&lt;span class="section-number-3"&gt;6.1&lt;/span&gt; Emacs for Ruby developers&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-6-1"&gt;
&lt;p&gt;
There are many ruby developer who decribe their set up around the web. Here are the most popular:
&lt;/p&gt;
</p>

<p>
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a href="<a href="http://devblog.avdi.org/category/emacs-reboot/">http://devblog.avdi.org/category/emacs-reboot/</a>"&gt;The Emacs reboot serie, by Avdi Grimm&lt;/a&gt; (Avdi is a famous ruby programmer and a great Emacs hacker)
&lt;/li&gt;
&lt;li&gt;&lt;a href="<a href="http://crypt.codemancers.com/posts/2013-09-26-setting-up-emacs-as-development-environment-on-osx/">http://crypt.codemancers.com/posts/2013-09-26-setting-up-emacs-as-development-environment-on-osx/</a>"&gt;Setting up Emacs as Ruby development environment on OSX&lt;/a&gt; (even if it is for OSX, the packages remain the same on all OSes)
&lt;/li&gt;
&lt;li&gt;&lt;a href="<a href="http://lorefnon.me/2014/02/02/configuring-emacs-for-rails.html">http://lorefnon.me/2014/02/02/configuring-emacs-for-rails.html</a>"&gt;Configuring Emacs as a productive development environment for Rails development&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="<a href="http://www.emacswiki.org/emacs/RubyOnRails">http://www.emacswiki.org/emacs/RubyOnRails</a>"&gt;The EmacsWiki on Ruby and RoR&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-6-2" class="outline-3"&gt;
&lt;h3 id="sec-6-2"&gt;&lt;span class="section-number-3"&gt;6.2&lt;/span&gt; Emacs for Python developers&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-6-2"&gt;
&lt;p&gt;
Here are some resources about setting Emacs for developing in python:
&lt;/p&gt;
</p>

<p>
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a href="<a href="http://caisah.info/emacs-for-python/">http://caisah.info/emacs-for-python/</a>"&gt;Emacs for python - on caisah.info&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="<a href="http://www.emacswiki.org/emacs/PythonProgrammingInEmacs">http://www.emacswiki.org/emacs/PythonProgrammingInEmacs</a>"&gt;Python programming in Emacs - on the EmacsWiki&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-6-3" class="outline-3"&gt;
&lt;h3 id="sec-6-3"&gt;&lt;span class="section-number-3"&gt;6.3&lt;/span&gt; Emacs for C/C++/Objective-C&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-6-3"&gt;
&lt;p&gt;
C languages are very well handled by Emacs and it allows you to edit, debug and run programs with Emacs very easily, with all the control you want.
&lt;/p&gt;
</p>

<p>
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a href="<a href="http://tuhdo.github.io/c-ide.html">http://tuhdo.github.io/c-ide.html</a>"&gt;C/C++ Development Environment for Emacs&lt;/a&gt; is a very complete article about this
&lt;/li&gt;
&lt;li&gt;&lt;a href="<a href="http://stackoverflow.com/questions/5800317/emacs-as-a-c-programming-ide-configuration">http://stackoverflow.com/questions/5800317/emacs-as-a-c-programming-ide-configuration</a>"&gt;A various tips and packages for C language(s)&lt;/a&gt; on StackOverflow
&lt;/li&gt;
&lt;li&gt;&lt;a href="<a href="http://truongtx.me/2013/03/10/emacs-setting-up-perfect-environment-for-cc-programming/">http://truongtx.me/2013/03/10/emacs-setting-up-perfect-environment-for-cc-programming/</a>"&gt;Setting up perfect environment for C/C++ Programming&lt;/a&gt; (according to its auhor. Good resource, though)
&lt;/li&gt;
&lt;li&gt;&lt;a href="<a href="http://www.emacswiki.org/emacs/DebuggingWithEmacs">http://www.emacswiki.org/emacs/DebuggingWithEmacs</a>"&gt;Debugging with Emacs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="<a href="http://cedet.sourceforge.net/">http://cedet.sourceforge.net/</a>"&gt;CEDET - Collection of Emacs Development Environment Tools&lt;/a&gt; An amazing collection of tools for developping in many programming languages, especially for C/C++
&lt;/li&gt;
&lt;li&gt;&lt;a href="<a href="http://alexott.net/en/writings/emacs-devenv/EmacsCedet.html">http://alexott.net/en/writings/emacs-devenv/EmacsCedet.html</a>"&gt;How to configure CEDET&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-6-4" class="outline-3"&gt;
&lt;h3 id="sec-6-4"&gt;&lt;span class="section-number-3"&gt;6.4&lt;/span&gt; Emacs for Go developers&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-6-4"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;If you develop in Go, you really should refer to the great &lt;a href="<a href="http://yousefourabi.com/blog/2014/05/emacs-for-go/">http://yousefourabi.com/blog/2014/05/emacs-for-go/</a>"&gt;Emacs for Go&lt;/a&gt; article, written by Yousef Ourabi.
&lt;/li&gt;
&lt;li&gt;Another one, with videos, is written by Dominik Honnef: &lt;a href="<a href="http://dominik.honnef.co/posts/2013/03/writing_go_in_emacs/">http://dominik.honnef.co/posts/2013/03/writing_go_in_emacs/</a>"&gt;Writing Go in Emacs&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-6-5" class="outline-3"&gt;
&lt;h3 id="sec-6-5"&gt;&lt;span class="section-number-3"&gt;6.5&lt;/span&gt; Emacs for PHP developers&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-6-5"&gt;
&lt;p&gt;
PHP, along with all the web technologies (HTML/JS/CSS) are very well supported in Emacs. The PHP mode does almost all the job by itself.
&lt;/p&gt;
</p>

<p>
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a href="<a href="http://www.emacswiki.org/emacs/PhpMode">http://www.emacswiki.org/emacs/PhpMode</a>"&gt;The EmacsWiki page about php-mode and other assicated packages&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="<a href="http://stackoverflow.com/questions/912671/what-is-a-good-setup-for-editing-php-in-emacs">http://stackoverflow.com/questions/912671/what-is-a-good-setup-for-editing-php-in-emacs</a>"&gt;A list of useful packages for PHP - on StackOverflow&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="<a href="https://drupal.org/node/59868">https://drupal.org/node/59868</a>"&gt;An example setup for working on Drupal&lt;/a&gt; (but can be used for PHP in general)
&lt;/li&gt;
&lt;li&gt;&lt;a href="<a href="https://code.google.com/p/geben-on-emacs/">https://code.google.com/p/geben-on-emacs/</a>"&gt;GEBEN - remote debugging environment for Emacs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="<a href="http://web-mode.org/">http://web-mode.org/</a>"&gt;Web Mode - focused on web templates (HTML/JS/CSS)&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-6-6" class="outline-3"&gt;
&lt;h3 id="sec-6-6"&gt;&lt;span class="section-number-3"&gt;6.6&lt;/span&gt; Emacs for Java developers&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-6-6"&gt;
&lt;p&gt;
Java development is held by Eclipse. But it is not the only editor/environment that allows you to develop in Java !
&lt;/p&gt;
</p>

<p>
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a href="<a href="http://jdee.sourceforge.net/">http://jdee.sourceforge.net/</a>"&gt;JDEE - the Java Development Environment for Emacs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="<a href="http://www.emacswiki.org/emacs/JavaDevelopmentEnvironment">http://www.emacswiki.org/emacs/JavaDevelopmentEnvironment</a>"&gt;The EmacsWiki article on JDEE&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="http:"&gt;A video demo of a full Java environment on Emacs&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-6-7" class="outline-3"&gt;
&lt;h3 id="sec-6-7"&gt;&lt;span class="section-number-3"&gt;6.7&lt;/span&gt; Emacs for R and statistics&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-6-7"&gt;
&lt;p&gt;
Emacs is very useful for scientists and people dealing with data. Statistics, analysis, plotting, &amp;#x2026; everything can be done within Emacs.
&lt;/p&gt;
</p>

<p>
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a href="<a href="https://github.com/vikasrawal/orgpaper/blob/master/orgpapers.org">https://github.com/vikasrawal/orgpaper/blob/master/orgpapers.org</a>"&gt;An amazing paper on working with Emacs, OrgMode and R&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="<a href="http://ess.r-project.org/">http://ess.r-project.org/</a>"&gt;Emacs Speaks Statistics&lt;/a&gt; is a great project that adds a full statistics environment to your Emacs
&lt;/li&gt;
&lt;li&gt;&lt;a href="<a href="http://stats.blogoverflow.com/2011/08/using-emacs-to-work-with-r/">http://stats.blogoverflow.com/2011/08/using-emacs-to-work-with-r/</a>"&gt;A tutorial on using ESS&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-7" class="outline-2"&gt;
&lt;h2 id="sec-7"&gt;&lt;span class="section-number-2"&gt;7&lt;/span&gt; Special features&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-7"&gt;
&lt;/div&gt;&lt;div id="outline-container-sec-7-1" class="outline-3"&gt;
&lt;h3 id="sec-7-1"&gt;&lt;span class="section-number-3"&gt;7.1&lt;/span&gt; Emacs as a file manager&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-7-1"&gt;
&lt;p&gt;
Emacs has a built-in mode named &lt;i&gt;dired&lt;/i&gt; that allows you to manage your file system directly in Emacs really easily.
It is very powerful and has features that graphical file managers do not have.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
First of all, to launch it, type:
&lt;/p&gt;
</p>

<p>
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;b&gt;M-x dired RET&lt;/b&gt; and then select a path to open (default is the directory of the file you are editing)
&lt;/li&gt;
&lt;li&gt;or &lt;b&gt;C-x d&lt;/b&gt; if you prefer keybindings
&lt;/li&gt;
&lt;/ul&gt;
</p>

<p>
&lt;p&gt;
Here are a few quick shortcuts once you are in &lt;i&gt;dired mode&lt;/i&gt;
&lt;/p&gt;
</p>

<p>
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;b&gt;R&lt;/b&gt; (capital R): rename a file
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;D&lt;/b&gt; (capital D): delete a file
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;+&lt;/b&gt;: create a new directory
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Z&lt;/b&gt;: compress the file
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;RET&lt;/b&gt; (enter): Open the file
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;g&lt;/b&gt;: refresh
&lt;/li&gt;
&lt;li&gt;&lt;b&gt;q&lt;/b&gt;: close the dired window
&lt;/li&gt;
&lt;/ul&gt;
</p>

<p>
&lt;p&gt;
Of course, files can be marked to operate on a selection of them. Use &lt;b&gt;m&lt;/b&gt; to mark, &lt;b&gt;u&lt;/b&gt; to unmark (&lt;b&gt;U&lt;/b&gt; to unmark all), &lt;b&gt;% m&lt;/b&gt; to mark according to a pattern.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
Note that there are so many tricks, extensions and features in &lt;i&gt;dired mode&lt;/i&gt; that I let you see around what you need.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
&lt;a href="<a href="http://www.emacswiki.org/emacs/DiredMode">http://www.emacswiki.org/emacs/DiredMode</a>"&gt;Read more about Dired&lt;/a&gt;
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
&lt;a href="<a href="https://www.gnu.org/software/emacs/manual/html_node/emacs/Dired.html">https://www.gnu.org/software/emacs/manual/html_node/emacs/Dired.html</a>"&gt;Read the manual&lt;/a&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-7-2" class="outline-3"&gt;
&lt;h3 id="sec-7-2"&gt;&lt;span class="section-number-3"&gt;7.2&lt;/span&gt; Working locally vs remotely&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-7-2"&gt;
&lt;p&gt;
Emacs, once installed on your machine will allow you to edit your file locally, obviously.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
Other people (non-Emacs users) will do a dirty trick to edit remote files like they were local files. They will mount the remote directory on their machine (thanks to &lt;i&gt;sshfs&lt;/i&gt;).
But the magic in Emacs is that you can transparently edit remote files on your development servers for example.
To do so, Emacs comes with a genious extension named "Tramp". It is alreay installed and available when you install Emacs.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
If you press &lt;b&gt;C-x C-f&lt;/b&gt;, you can open a file. But if you ask &lt;code&gt;myname@myserver.com:/path/to/file&lt;/code&gt;, it will automatically connect to the server and let you edit the remote file. Easy as pie.
&lt;i&gt;Tramp&lt;/i&gt; supports lots of protocols like ssh, ftp, and so on.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
And what is great is that if you are editing a remote file and you launch a shell in Emacs, it will automatically set the shell into your remote environment and open it as if you were in the remote directory the file is in.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
A last tip about TRAMP. If you simply add &lt;code&gt;sudo:&lt;/code&gt; in front of your file path, you edit your file with higher privileges. It is a very useful feature if you need to edit your configuration files on a server, for example. Of course, it works remotely and locally.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
&lt;a href="<a href="http://www.emacswiki.org/emacs/TrampMode">http://www.emacswiki.org/emacs/TrampMode</a>"&gt;Read more about Tramp&lt;/a&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-7-3" class="outline-3"&gt;
&lt;h3 id="sec-7-3"&gt;&lt;span class="section-number-3"&gt;7.3&lt;/span&gt; Organize your work, write papers and manage your agenda&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-7-3"&gt;
&lt;p&gt;
In Emacs, you can do everything. This is a fact.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
One the most amazing and complete mode is the amazing &lt;a href="<a href="http://orgmode.org">http://orgmode.org</a>"&gt;Org mode&lt;/a&gt;, written by amazing people.
But when I say amazing, it is absolutly amazing. It allows you to "live in Emacs".
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
Here a a few of its am&amp;#x2026; features:
&lt;/p&gt;
</p>

<p>
&lt;ul class="org-ul"&gt;
&lt;li&gt;A full agenda / calendar
&lt;/li&gt;
&lt;li&gt;TODO lists and project management
&lt;/li&gt;
&lt;li&gt;Writing (research papers, books, an "Emacs for developers" whitepaper, your shopping list &amp;#x2026;)
&lt;/li&gt;
&lt;li&gt;Include code in you papers
&lt;/li&gt;
&lt;li&gt;Tables and spreadsheets (with formulas and calculation)
&lt;/li&gt;
&lt;li&gt;Mobile integration
&lt;/li&gt;
&lt;li&gt;&amp;#x2026;
&lt;/li&gt;
&lt;/ul&gt;
</p>

<p>
&lt;p&gt;
And what is really cool is that every thing you do in Org is exportable in:
&lt;/p&gt;
</p>

<p>
&lt;ul class="org-ul"&gt;
&lt;li&gt;PDF
&lt;/li&gt;
&lt;li&gt;LaTex
&lt;/li&gt;
&lt;li&gt;HTML
&lt;/li&gt;
&lt;li&gt;Text
&lt;/li&gt;
&lt;li&gt;ODT
&lt;/li&gt;
&lt;li&gt;iCalendar
&lt;/li&gt;
&lt;li&gt;TextInfo
&lt;/li&gt;
&lt;li&gt;&amp;#x2026; and many more.
&lt;/li&gt;
&lt;/ul&gt;
</p>

<p>
&lt;p&gt;
You really should check their &lt;a href="<a href="http://orgmode.org/features.html">http://orgmode.org/features.html</a>"&gt;list of features&lt;/a&gt;
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
If you want to see a good example of Org-mode capabilities, check &lt;a href="<a href="http://home.fnal.gov/~neilsen/notebook/orgExamples/org-examples.html">http://home.fnal.gov/~neilsen/notebook/orgExamples/org-examples.html</a>"&gt;that great page&lt;/a&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-7-4" class="outline-3"&gt;
&lt;h3 id="sec-7-4"&gt;&lt;span class="section-number-3"&gt;7.4&lt;/span&gt; Emails in Emacs&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-7-4"&gt;
&lt;p&gt;
There are packages that let you use Emacs as a full featured MUA.
Reading emails, sending emails, filtering, archiving &amp;#x2026; etc.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
Emacs can be a very powerful and fast e-mail client and as it is controlled by the keyboard, it could be more efficient than a graphical e-mail client (clicking is a loss of time).
I use it for years now and I can not imagine using another program to read my emails.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
There are several package to do so, but the most used is &lt;a href="<a href="http://www.gnus.org/">http://www.gnus.org/</a>"&gt;Gnus&lt;/a&gt;. It is already installed with Emacs.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
Here are some of its features beside the basic ones:
&lt;/p&gt;
</p>

<p>
&lt;ul class="org-ul"&gt;
&lt;li&gt;Gnus is in fact a newsreader used to interact with email servers. So you can use to fetch messages from newsgroups, RSS, SMTP, POP, &amp;#x2026;
&lt;/li&gt;
&lt;li&gt;Easy and powerful mail splitting
&lt;/li&gt;
&lt;li&gt;Integration with BBDB, a contact manager
&lt;/li&gt;
&lt;li&gt;Message scoring
&lt;/li&gt;
&lt;li&gt;LDAP
&lt;/li&gt;
&lt;li&gt;PGP signing and encrypting
&lt;/li&gt;
&lt;li&gt;Customizable layout
&lt;/li&gt;
&lt;li&gt;Encrypted file to manage your credentials
&lt;/li&gt;
&lt;li&gt;&amp;#x2026; and many more
&lt;/li&gt;
&lt;li&gt;&amp;#x2026; and of course, it is extensible thanks to Lisp
&lt;/li&gt;
&lt;/ul&gt;
</p>

<p>
&lt;p&gt;
You really should try it with your personnal account. It is easy to configure and integrate with &lt;a href="<a href="http://www.emacswiki.org/emacs/GnusGmail">http://www.emacswiki.org/emacs/GnusGmail</a>"&gt;Gmail&lt;/a&gt;, for example.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
But be careful! If you try it, you will love it.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
Some alternatives to Gnus (that I do not use, but that are popular):
&lt;/p&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a href="<a href="http://www.emacswiki.org/emacs/WanderLust">http://www.emacswiki.org/emacs/WanderLust</a>"&gt;Wanderlust&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="<a href="http://www.djcbsoftware.nl/code/mu/mu4e.html">http://www.djcbsoftware.nl/code/mu/mu4e.html</a>"&gt;Mu4e&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-7-5" class="outline-3"&gt;
&lt;h3 id="sec-7-5"&gt;&lt;span class="section-number-3"&gt;7.5&lt;/span&gt; Some great Emacs tips and tricks&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-7-5"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;Emacs is all about Macros. This is one of its most powerful feature. Record a sequence and re-play it on other lines! Here is &lt;a href="<a href="http://www.thegeekstuff.com/2010/07/emacs-macro-tutorial-how-to-record-and-play/">http://www.thegeekstuff.com/2010/07/emacs-macro-tutorial-how-to-record-and-play/</a>"&gt;how&lt;/a&gt;.
&lt;/li&gt;
&lt;li&gt;Using &lt;a href="<a href="http://www.masteringemacs.org/articles/2010/11/01/running-shells-in-emacs-overview/">http://www.masteringemacs.org/articles/2010/11/01/running-shells-in-emacs-overview/</a>"&gt;shell&lt;/a&gt; inside Emacs is cool
&lt;/li&gt;
&lt;li&gt;You really should use the &lt;i&gt;&lt;a href="<a href="http://www.emacswiki.org/emacs/BookMarks">http://www.emacswiki.org/emacs/BookMarks</a>"&gt;bookmarks&lt;/a&gt;&lt;/i&gt; functionnality to save your projects locations (locally or remotely)
&lt;/li&gt;
&lt;li&gt;When opening a file, add &lt;i&gt;sudo:&lt;/i&gt; in front of its path in order to edit it as a privileged user
&lt;/li&gt;
&lt;li&gt;You can edit files in hexadecimal directly in Emacs thanks to the &lt;i&gt;hexl-mode&lt;/i&gt;
&lt;/li&gt;
&lt;li&gt;Emacs allows you to open an archive (gz, bz2, zip, &amp;#x2026;), edit its files on-the-fly without extracting yourself the archive. To do so, simple open the file directly in Emacs (&lt;b&gt;C-x C-f&lt;/b&gt; /path/to/archive.tar.bz2)
&lt;/li&gt;
&lt;li&gt;&lt;a href="<a href="http://www.gnu.org/software/emacs/manual/html_node/emacs/Rectangles.html">http://www.gnu.org/software/emacs/manual/html_node/emacs/Rectangles.html</a>"&gt;Rectangle regions&lt;/a&gt; edition is really easy
&lt;/li&gt;
&lt;li&gt;&lt;a href="<a href="http://www.cs.bu.edu/teaching/tool/emacs/programming/#compile">http://www.cs.bu.edu/teaching/tool/emacs/programming/#compile</a>"&gt;Compilation&lt;/a&gt; and &lt;a href="<a href="http://www.cs.bu.edu/teaching/tool/emacs/programming/#gdb">http://www.cs.bu.edu/teaching/tool/emacs/programming/#gdb</a>"&gt;debugging&lt;/a&gt; is really well supported in Emacs
&lt;/li&gt;
&lt;li&gt;&lt;a href="<a href="http://www.emacswiki.org/ERC">http://www.emacswiki.org/ERC</a>"&gt;Erc&lt;/a&gt; is a great IRC client running in Emacs
&lt;/li&gt;
&lt;/ul&gt;
</p>

<p>
&lt;p&gt;
&lt;i&gt;To be continued&lt;/i&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-7-6" class="outline-3"&gt;
&lt;h3 id="sec-7-6"&gt;&lt;span class="section-number-3"&gt;7.6&lt;/span&gt; Coming from other editors (i.e Vim)&lt;/h3&gt;
&lt;div class="outline-text-3" id="text-7-6"&gt;
&lt;p&gt;
Some people use other editors and want to give Emacs a try.
Some people are really used to use a specific editor.
Some people do not want to lose their habits and their learning curve.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
I am thinking about Vim, but it is also true for other editors (textmate, sublime, &amp;#x2026;)
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
Emacs has a mode that allows you to use it exactly like Vim.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
I personnaly never used this mode, but many people use it. Therefore, it allows you to switch gently and softly from Vim to Emacs.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
&lt;a href="<a href="http://www.emacswiki.org/emacs/Evil">http://www.emacswiki.org/emacs/Evil</a>"&gt;Read more about Evil-mode&lt;/a&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-8" class="outline-2"&gt;
&lt;h2 id="sec-8"&gt;&lt;span class="section-number-2"&gt;8&lt;/span&gt; Readings and resources&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-8"&gt;
&lt;ul class="org-ul"&gt;
&lt;li&gt;&lt;a href="<a href="http://emacsrocks.com/">http://emacsrocks.com/</a>"&gt;Emacs rocks videos&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="<a href="http://devblog.avdi.org/category/emacs-reboot/">http://devblog.avdi.org/category/emacs-reboot/</a>"&gt;Avdi Grimm Emacs reboot series&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="<a href="http://www.masteringemacs.org/">http://www.masteringemacs.org/</a>"&gt;Mastering Emacs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="<a href="http://sachachua.com/blog/category/geek/emacs/">http://sachachua.com/blog/category/geek/emacs/</a>"&gt;Sacha's blog&lt;/a&gt; and her wonderful Emacs contributors interviews serie
&lt;/li&gt;
&lt;li&gt;&lt;a href="<a href="http://emacsredux.com">http://emacsredux.com</a>"&gt;Emacs redux&lt;/a&gt; by Bozhidar Batsov
&lt;/li&gt;
&lt;li&gt;&lt;a href="<a href="http://planet.emacsen.org/">http://planet.emacsen.org/</a>"&gt;Planet Emacsen&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="<a href="http://reddit.com/r/emacs">http://reddit.com/r/emacs</a>"&gt;Emacs sub-reddit&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
</p>

<p>
&lt;p&gt;
And of course, the &lt;a href="<a href="http://www.emacswiki.org/">http://www.emacswiki.org/</a>"&gt;Emacs wiki&lt;/a&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-9" class="outline-2"&gt;
&lt;h2 id="sec-9"&gt;&lt;span class="section-number-2"&gt;9&lt;/span&gt; License&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-9"&gt;
&lt;p&gt;
The content of this project itself is licensed under the &lt;a href="<a href="http://creativecommons.org/licenses/by/3.0/us/deed.en_US">http://creativecommons.org/licenses/by/3.0/us/deed.en_US</a>"&gt;Creative Commons Attribution 3.0 license&lt;/a&gt;, and the underlying source code used to format and display that content is licensed under the &lt;a href="<a href="http://opensource.org/licenses/mit-license.php">http://opensource.org/licenses/mit-license.php</a>"&gt;MIT license&lt;/a&gt;.
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
Contributors list can be found &lt;a href="<a href="https://github.com/pierre-lecocq/emacs4developers/network/members">https://github.com/pierre-lecocq/emacs4developers/network/members</a>"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
</p>

<p>
&lt;div id="outline-container-sec-10" class="outline-2"&gt;
&lt;h2 id="sec-10"&gt;&lt;span class="section-number-2"&gt;10&lt;/span&gt; Thanks&lt;/h2&gt;
&lt;div class="outline-text-2" id="text-10"&gt;
&lt;p&gt;
I want to thank some of the great people who make Emacs a very intersting piece of software or make its community very active (the sort order is absolutly not important here):
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
Bastien Guerry, Dimitri Fontaine, Julien Danjou, Sacha Chua, Steve Purcell, Nic Ferrier, Avdi Grimm, Magnars, Steve Yegge, Bozhidar Batsov, Xah Lee, and many more &amp;#x2026;
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
You should check those people and their work over the web, twitter, youtube, &amp;#x2026;
&lt;/p&gt;
</p>

<p>
&lt;p&gt;
And thank you for reading this !
&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div id="postamble" class="status"&gt;
&lt;p class="author"&gt;Author: Pierre Lecocq&lt;/p&gt;
&lt;p class="date"&gt;Created: 2014-10-21 Mar 13:50&lt;/p&gt;
&lt;p class="creator"&gt;&lt;a href="<a href="http://www.gnu.org/software/emacs/">http://www.gnu.org/software/emacs/</a>"&gt;Emacs&lt;/a&gt; 24.4.1 (&lt;a href="<a href="http://orgmode.org">http://orgmode.org</a>"&gt;Org&lt;/a&gt; mode 8.2.10)&lt;/p&gt;
&lt;p class="validation"&gt;&lt;a href="<a href="http://validator.w3.org/check?uri=referer">http://validator.w3.org/check?uri=referer</a>"&gt;Validate&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;</p>
</div>
<div id="postamble" class="status">
<p class="author">Author: Pierre Lecocq</p>
<p class="date">Created: 2014-10-21 Mar 13:50</p>
<p class="creator"><a href="http://www.gnu.org/software/emacs/">Emacs</a> 24.4.1 (<a href="http://orgmode.org">Org</a> mode 8.2.10)</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>
</html>


================================================
FILE: exports/emacs4developers.org
================================================
#+TITLE: Emacs for developers
#+AUTHOR: Pierre Lecocq
#+DESCRIPTION: Learn using Emacs as a developer
#+KEYWORDS: emacs, developer
#+STARTUP: showall

* Emacs for developers

This document will (hopefully) help you to use Emacs as a developer.

**** Disclaimer

Work in progress, so stay tuned.

** Who is the target of this tutorial

Well, this is a good question. And I won't give an answer but some elements of answer.

What is sure is that it is not written for the people thanked below (Batien, Dimitri, Sacha, Nic, Avdi, and so on ...), but what is interseting with Emacs is that even if you are a beginner, an intermediate / advanced user or an every day power user, you can learn from others each time you open a web page or a manual dealing with Emacs.

Therefore, this tutorial is written for people who want to improve their experience. Simple as that. Whatever is their knowledge, their feeling, their usage, their config file size (without any pun), etc ...

Remember one thing: Emacs is 30+ years old and brings new users everyday. It is a clue that this is a piece of software that deserve some attention.

* Table of contents

- 1. [[#introduction][Introduction]]
   - 1.1 [[#brief-history][Brief history]]
   - 1.2 [[#how-to-get-emacs][How to get Emacs?]]
   - 1.3 [[#more-than-an-editor][More than an editor]]
   - 1.4 [[#the-perfect-development-tool][The perfect development tool]]
- 2. [[#the-basics][The basics]]
   - 2.1 [[#config-files][Config files]]
   - 2.2 [[#executing-commands][Executing commands]]
   - 2.3 [[#key-bindings][Key bindings]]
      - 2.3.1 [[#manipulate-files][Manipulate files]]
      - 2.3.2 [[#manipulate-the-current-line][Manipulate the current line]]
      - 2.3.3 [[#selecting-a-region][Selecting a region]]
      - 2.3.4 [[#commenting][Commenting]]
      - 2.3.5 [[#windows][Windows]]
      - 2.3.6 [[#buffers][Buffers]]
      - 2.3.7 [[#cancel-a-command][Cancel a command]]
      - 2.3.8 [[#the-most-useless-command][The most useless command]]
   - 2.4 [[#help][Help!]]
- 3. [[#building-your-own-editor][Building your own editor]]
   - 3.1 [[#first-basic-configuration][First basic configuration]]
   - 3.2 [[#general-basic-configuration][General basic configuration]]
   - 3.3 [[#backup-files][Backup files]]
   - 3.4 [[#setting-up-the-locals][Setting up the locales]]
   - 3.5 [[#more-configuration][More configuration]]
   - 3.6 [[#modes][Modes]]
   - 3.7 [[#package-managers][Package managers]]
   - 3.8 [[#some-useful-packages][Some useful packages]]
   - 3.9 [[#code-navigation][Code navigation]]
   - 3.10 [[#setting-a-color-theme][Setting a color theme]]
- 4. [[#emacs-developing-environments][Emacs developing environments]]
   - 4.1 [[#emacs-for-ruby-developers][Emacs for Ruby developers]]
   - 4.2 [[#emacs-for-python-developers][Emacs for Python developers]]
   - 4.3 [[#emacs-for-ccobjective-c][Emacs for C/C++/Objective-C developers]]
   - 4.4 [[#emacs-for-go-developers][Emacs for Go developers]]
   - 4.5 [[#emacs-for-php-developers][Emacs for PHP developers]]
   - 4.6 [[#emacs-for-java-developers][Emacs for Java developers]]
   - 4.7 [[#emacs-for-r-and-statistics][Emacs for R and statistics]]
- 5. [[#special-features][Special features]]
   - 5.1 [[#emacs-as-a-file-manager][Emacs as a file manager]]
   - 5.2 [[#working-locally-vs-remotely][Working locally vs remotely]]
   - 5.3 [[#organize-your-work-write-papers-and-manage-your-agenda][Organize your work, write papers and manage your agenda]]
   - 5.4 [[#emails-in-emacs][Emails in Emacs]]
   - 5.5 [[#some-great-emacs-tips-and-tricks][Some great Emacs tips and tricks]]
   - 5.6 [[#coming-from-other-editors-ie-vim][Coming from other editors (i.e Vim or SublimeText)]]
- 6. [[#readings-and-resources][Readings and resources]]

* Introduction

** Brief history

- Originally developed by Richard Stallman and Guy Steele in MIT AI lab
- First release in 1976
- Inspired by TECO editor
- Based on macros (Emacs stands for Editor MACroS)
- Written in C and Emacs Lisp
- Part of the GNU project (therefore, we /should/ say "GNU Emacs", not "Emacs")

- Despite its age, new users are still adopting Emacs as their development platform to this day!

** How to get Emacs?

On every Linux distribution, packages are available.
So run your favorite package manager to install it:

- /apt-get install emacs/
- /yum install emacs/
- ...

And if you have an exotic operating system, here are the specific distributions:

- Mac OS X: http://emacsformacosx.com/
- Windows: http://ftp.igh.cnrs.fr/pub/gnu/emacs/windows/

But, in order to get the latest version, it's _highly recommended_ that you compile Emacs yourself: http://ftp.igh.cnrs.fr/pub/gnu/emacs/


** More than an editor

- More than an editor, it is a Lisp interpretor
- Can run any type of program written in Lisp:
  - Email clients (like [[http://www.gnus.org/][Gnus]] or [[http://www.emacswiki.org/emacs/mu4e][mu4e]])
  - Shell (like bash or eshell)
  - File and directory management (with [[http://www.gnu.org/software/emacs/manual/html_node/emacs/Dired.html][Dired mode]])
  - Agenda / Notes / TODO list / Project management (with the amazing [[http://orgmode.org][OrgMode]])
  - IRC / Twitter / Jabber / ... clients
  - Games (like Tetris, Pong, Snake, 5x5, Dunnet, ...)
  - Encrypt/decrypt files (like GPG files)
  - On-the-fly archives editing (thanks to [[http://www.emacswiki.org/emacs/ArchiveMode][archive-mode]])
  - PDF / Image / (...) viewer
  - A powerful front end to R / S+ / SPSS / Stata (with [[http://ess.r-project.org/][EmacsSpeaksStatisics)]]
  - An editor for multi-modal REPL's like IPython (with [[http://tkf.github.io/emacs-ipython-notebook/][EmacsIPythonNotebook]])
  - Music player (with emms, vlc, mplayer, ...)
  - Music programming (with [[http://vimeo.com/22798433][Overtone]])
  - Video editing
  - And so on ...
  - (and of course a document editor that can automatically generate this presentation)

Naturally, you can do all of that at the same time with only one Emacs instance. Don't need to say it ...

** The perfect development tool

- As Emacs is a Lisp interpretor, it is extensible. Really really extensible.
- The (unofficial) goal of Emacs is to be hacked
- Therefore your goal is to hack Emacs to make it work perfectly as you want

- Already provides so many development tools (also extensible, of course)
  - Debuggers
  - Compilers
  - Syntax checkers
  - Documentations
  - Consoles
  - ...

- Also provides /modes/ (extensions) for *every* programming language for
  - Syntax highlighting
  - Documentation search
  - Indentation
  - Source code browsing
  - Compilation commands
  - Specific behaviour
  - ...

* The basics

**  Config files

In order to customize Emacs, you will have to edit its configuration files.
It does not exist when you install the software (or is an empty file) and does nothing until you decide to tweak Emacs.
Some people use Emacs for decades without any extra configuration because they like it out of the box.

There are several ways to manage your Emacs configuration:

- Simply create and edit a *~/.emacs* file
- Create a *~/.emacs.d/* directory with a *~/.emacs.d/init.el* file

The first solution is great if you have a small, tidied and exportable configuration file.

The second solution is great if you need several configuration files (keep you configuration parts separated) or you need to install external extensions (you will install them in *~/.emacs.d* to keep them centralized and exportable).

** Executing commands

The main idea of Emacs is that everything is a command. For example: opening a file with a keybinding calls a command that is executed by the Emacs' core.
And all the commands are written in Lisp.

To call a command, you simply have to press *Escape* and then *x*. It could be *Alt-x* for more comfort.
The official name is "/Meta x/" and is written /M-x/

If you type this key sequence, you will see at the bottom of the editor a little prompt.
This part of Emacs is called the /mini buffer/ and is used for every interactive actions.

Let's try something:

- type *M-x*
- Then, in the minibuffer, type *version* and *RET* (return)

Emacs should display the current version number of the software.

#+CAPTION: Execute the version command
[[../images/version.gif]]

Congratulations! You just called your first Emacs command.

** Key bindings

Here are the most useful keys in Emacs. You will use them several hundreds (or thousands) times a day.

How it works?

- The sequence /C-something/ means that you have to press and hold the /Control/ key while hitting the /something/ key. Example: /C-a/ means /Control + a/.
- The sequence /C-something somethingelse/ means that you press /Control + something/, then you release Control to hit /somethingelse/.
- The sequence /C-something C-somethingelse/ means that you have to press Control while hitting /something/ and /somethingelse/.

*** Manipulate files

- *C-x C-f*: open a file, which corresponds to *M-x find-file*
- *C-x C-s*: save a file, which corresponds to *M-x save-buffer*

#+CAPTION: Open a file, modify it and save it
[[../images/open-and-save.gif]]

*** Manipulate the line

- *C-a*: go to the beginning of the current line, which corresponds to *M-x begining-of-line*
- *C-e*: go to the end of the current line, which corresponds to *M-x end-of-line*
- *C-k*: cut the rest of the line at the cursor position, which corresponds to *M-x kill-line*
- *C-y*: paste what you had cut with the command above, which corresponds to *M-x yank*
- *C-l*: center the buffer at the cursor position, which corresponds to *M-x recenter-top-bottom*

#+CAPTION: Line manipulation
[[../images/line.gif]]

*** Selecting a region

Regions are selections, in Emacs.

They are composed by two points. A starting one and and an ending one.

To select the starting point, move your cursor to the wanted location and simply press *C-Space*. In your minibuffer, you should have seen a message like "Mark set".
Now, move your cursor to the location you wantyour selection to end.

You have now a selection (or a /region/) delimited by the place you set the first mark and your cursor. With this region, you can do what ever you want:

- Copy (*M-w*)
- Cut (*C-k*)
- Paste (*C-y*)
- Replace (*M-%*)
- ... etc

#+CAPTION: Selecting a region
[[../images/selecting.gif]]

*** Commenting

In order to comment a code block, select the region you want to comment and use:

- *M-x comment-region* in order to comment the block
- *M-x uncomment-region* in order to uncomment the block

Of course, Emacs knows, according to the major mode loaded how to comment properly your code. If the major-mode is /ruby-mode/, it will add a "#" before the line; if the major-mode is /lisp-mode/, it will add ";;", and so on and so forth.

#+CAPTION: Commenting
[[../images/comment.gif]]

*** Windows

This might be confusing but a /window/ is a part of a /frame/.

An /Emacs frame/ is the window that you opened when you launched Emacs.

An /Emacs frame/ can be divided into /windows/ in itself.

- *C-x 2*: open a new window horizontally, which corresponds to *M-x split-window-below*
- *C-x 3*: open a new window vertically, which corresponds to *M-x split-window-right*
- *C-x o*: switch to the next window, which corresponds to *M-x other-window*
- *C-x 0*: close the current window, which corresponds to *M-x delete-window*

#+CAPTION: Windows manipulation
[[../images/windows.gif]]

*** Buffers

A /buffer/ is displayed in a /frame/.

- *C-x b*: switch to an already opened buffer, which corresponds to *M-x switch-to-buffer*
- *C-x C-b*: list opened buffer (and jump to the selected one), which corresponds to *M-x list-buffers*
- *C-x k*: kill a buffer, which corresponds to *M-x kill-buffer*

#+CAPTION: Buffer navigation
[[../images/buffers.gif]]

*** Cancel a command

- *C-g* or *ESC ESC ESC*: cancel the current command running in the minibuffer, which corresponds to *M-x keyboard-quit*

*** The most useless one

- *C-x C-c*: quit emacs (use at your own risks!), which corresponds to *M-x save-buffers-kill-terminal*

** Help!

Emacs has a powerful built-in help system for key bindings and internal functionalities.

- *C-h f <function-name>*: Find the key binding corresponding to <function-name> (ex: C-h f save-buffer)
- *C-h k <key-sequence>*: Find the function name corresponding to <key-sequence> (ex: C-h k C-x C-s)

When executing these commands, a new frame opens. To close it, switch to it (/C-x o/) and type /q/. If not, simply close it (/C-x 0/)

Emacs also includes the full manual (also available online: http://www.gnu.org/software/emacs/manual/html_node/emacs/)

- *C-h r*: browse the Emacs manual within Emacs

Finally, there are so many other help functions: http://www.emacswiki.org/emacs/EmacsNewbieHelpReference

* Building your own editor

From this point, we will edit the configuration file.
For the moment, we will put everything in a single *~/.emacs.d/init.el* file. Create it if it does not exist.

#+BEGIN_SRC sh
# Backup old configuration
cp .emacs dot-emacs.old
cp -R .emacs.d dot-emacs.d.old

# Create new and empty configuration
mkdir ~/.emacs.d
touch ~/.emacs.d/init.el
#+END_SRC

** First basic configuration

When you will have to change or add configuration, simply edit your *~/.emacs.d/init.el* file and add what you need.

For exemple, here is a tweak that does nothing visually but is useful for other packages and the Emacs engine itself.
It allows you to define your name and email. Emacs can use it to add author informations to a file when asked.

#+BEGIN_SRC lisp
(setq user-full-name "Your full name")
(setq user-mail-address "your@email.com")
#+END_SRC

After each configuration modification, two solutions:

- the soft & clever way: execute *M-x eval-buffer*
- the hard way: restart Emacs.

** General basic configuration

Now, let's move to a more visual configuration basic set.
As before, simply add this to your configuration file:

#+BEGIN_SRC lisp
;; Ask "y" or "n" instead of "yes" or "no". Yes, laziness is great.
(fset 'yes-or-no-p 'y-or-n-p)

;; Highlight corresponding parenthese when cursor is on one
(show-paren-mode t)

;; Highlight tabulations
(setq-default highlight-tabs t)

;; Show trailing white spaces
(setq-default show-trailing-whitespace t)

;; Remove useless whitespaces before saving a file
(add-hook 'before-save-hook 'whitespace-cleanup)
(add-hook 'before-save-hook (lambda() (delete-trailing-whitespace)))
#+END_SRC

** Backup files

You may have notice that the files you edit are duplicated and renamed with a /~/ at the end.
They are the backup files that Emacs creates for you with an auto-save feature.
Sometimes it is great because you can recover a file in case of error, sometimes it is annoying because you can have some many of these files.

It is up to you to keep it or disable it.
Here is the configuration for that:

#+BEGIN_SRC lisp
;; Remove all backup files
(setq make-backup-files nil)
(setq backup-inhibited t)
(setq auto-save-default nil)
#+END_SRC

An alternative method is to save these backups in a centralized folder:

#+BEGIN_SRC lisp
;; Save backup files in a dedicated directory
(setq backup-directory-alist '(("." . "~/.saves")))
#+END_SRC

** Setting up the locales

You may want to set up a specific locale for your files.
Here is the trick:

#+BEGIN_SRC lisp
;; Set locale to UTF8
(set-language-environment 'utf-8)
(set-terminal-coding-system 'utf-8)
(setq locale-coding-system 'utf-8)
(set-default-coding-systems 'utf-8)
(set-selection-coding-system 'utf-8)
(prefer-coding-system 'utf-8)
#+END_SRC

** More configuration

The best way to get your configuration better, is to read the [[http://www.gnu.org/software/emacs/manual/][manual]] ...
But you can also (this is the un-official method) read the others Emacs users' config files.
There are so many people who share their configuration, comment their code, and distribute their modes!

Here is mine: (https://github.com/pierre-lecocq/emacs.d)

** Modes

/Modes/ are Emacs' /extensions/ that can be installed to extend the capabilities of Emacs. They will allow you to build a powerful tailored editor.

There are 2 kind of modes: minor and major.

*** Major modes

Major modes are modes that transform Emacs to a specialized software for editing a certain type of files (i.e c-mode) or managing special tasks (i.e reading emails, managing git repository, ...)

Only one major mode can be used at a time.

*** Minor modes

Minor modes are additionnal modes that are added transparently to the major mode. They add more features to the main one (i.e parentheses matching, syntax or spelling checkers, ...)

Several minor modes can be used at a time.

** Package managers

Emacs has brilliant package managers such as /package.el/ or /el-get/ that allows you to add and update modes really easily.

*** Package.el

/package.el/ is the built in package manager shipped by default with Emacs 24 or later.

To list available packages, simply type this command:

#+BEGIN_SRC lisp
M-x package-list-packages
#+END_SRC

You will have a list of packages. Simply press ENTER on the name of one of it to install it.

Additionnaly, you can manage the packages list by adding other sources to your configuration file:

#+BEGIN_SRC lisp
;; Add package sources
(setq package-archives '(("gnu" . "http://elpa.gnu.org/packages/")
                         ("marmalade" . "http://marmalade-repo.org/packages/")
                         ("melpa" . "http://melpa.org/packages/")))
#+END_SRC

*** El-Get

/[[https://github.com/dimitri/el-get][el-get]]/ is one of the most popular and easy to use package manager. The "/apt-get/" of Emacs.
It is written by the great [[https://github.com/dimitri][Dimitri Fontaine]] and is based on recipe files that simply describe where is located the package and how to get/compile/install it for you.

To use it, simply add this to your configuration file. It will download and set up /el-get/ for you:

#+BEGIN_SRC lisp
;; Set up el-get
(add-to-list 'load-path "~/.emacs.d/el-get/el-get")
(unless (require 'el-get nil 'noerror)
  (with-current-buffer
      (url-retrieve-synchronously
       "https://raw.github.com/dimitri/el-get/master/el-get-install.el")
    (let (el-get-master-branch)
      (goto-char (point-max))
      (eval-print-last-sexp))))
#+END_SRC

*** The generic method

In order to leave you the choice of the package manager you want to use, here is a function that handles several package managers. For now, it covers /package.el/ and /el-get/.

It also allows you to automatically install packages you want.

In the following snippet, two sample packages are installed

- /color-theme/ in order to allow us to  change colors themes
- /autopair/ in order to close automatically parentheses, brackets and braces when you open it

Simply add this code to your configuration file:

#+BEGIN_SRC lisp
;; Set up the package manager of choice. Supports "el-get" and "package.el"
(setq pmoc "el-get")

;; List of all wanted packages
(setq
 wanted-packages
 '(
   color-theme
   autopair
))

;; Package manager and packages handler
(defun install-wanted-packages ()
  "Install wanted packages according to a specific package manager"
  (interactive)
  (cond
   ;; package.el
   ((string= pmoc "package.el")
    (require 'package)
    (add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/"))
    (add-to-list 'package-archives '("melpa" . "http://melpa.org/packages/"))
    (add-to-list 'package-archives '("marmelade" . "http://marmalade-repo.org/packages/"))
    (package-initialize)
    (let ((need-refresh nil))
      (mapc (lambda (package-name)
          (unless (package-installed-p package-name)
        (set 'need-refresh t))) wanted-packages)
      (if need-refresh
        (package-refresh-contents)))
    (mapc (lambda (package-name)
        (unless (package-installed-p package-name)
          (package-install package-name))) wanted-packages)
    )
   ;; el-get
   ((string= pmoc "el-get")
    (add-to-list 'load-path "~/.emacs.d/el-get/el-get")
    (unless (require 'el-get nil 'noerror)
      (with-current-buffer
      (url-retrieve-synchronously
       "https://raw.github.com/dimitri/el-get/master/el-get-install.el")
    (let (el-get-master-branch)
      (goto-char (point-max))
      (eval-print-last-sexp))))
    (el-get 'sync wanted-packages))
   ;; fallback
   (t (error "Unsupported package manager")))
  )

;; Install wanted packages
(install-wanted-packages)
#+END_SRC

Note that some of the following package names could vary if you use /package.el/ or /el-get/.

*** The modern and efficient way

Some upper-level packages make package management easier and cleaner.

For example, John Wiegley's =use-package= software is an elegant and efficient way to install and tidy your external packages configurations.

Here is the way to use it:

First, setup packages sources and install =use-package=

#+BEGIN_SRC 
Download .txt
gitextract_dqy0l3r9/

├── README.org
├── chapters/
│   ├── 01-introduction.org
│   ├── 02-the-basics.org
│   ├── 03-building-your-own-editor.org
│   ├── 04-emacs-developing-environments.org
│   ├── 05-special-features.org
│   └── 06-readings-and-resources.org
├── demo/
│   ├── README.org
│   ├── config.el
│   └── src/
│       ├── dummy.rb
│       └── functions.rb
└── exports/
    ├── emacs4developers.html
    ├── emacs4developers.odt
    └── emacs4developers.org
Download .txt
SYMBOL INDEX (9 symbols across 2 files)

FILE: demo/src/dummy.rb
  class Dummy (line 6) | class Dummy
    method initialize (line 16) | def initialize(action_name)
    method dispatch (line 31) | def dispatch(action)
    method do_create (line 45) | def do_create
    method do_update (line 50) | def do_update
    method do_delete (line 55) | def do_delete
    method compute_version (line 60) | def compute_version

FILE: demo/src/functions.rb
  function say (line 5) | def say(message, prefix = ' => ')
  function symbolize_keys (line 14) | def symbolize_keys(hash)
Condensed preview — 14 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (234K chars).
[
  {
    "path": "README.org",
    "chars": 7680,
    "preview": "#+TITLE: Emacs for developers\n#+AUTHOR: Pierre Lecocq\n#+DESCRIPTION: Learn using Emacs as a developer\n#+KEYWORDS: emacs,"
  },
  {
    "path": "chapters/01-introduction.org",
    "chars": 3262,
    "preview": "#+TITLE: Emacs for developers - Introduction\n#+AUTHOR: Pierre Lecocq\n#+DESCRIPTION: Learn using Emacs as a developer\n#+K"
  },
  {
    "path": "chapters/02-the-basics.org",
    "chars": 7076,
    "preview": "#+TITLE: Emacs for developers - The basics\n#+AUTHOR: Pierre Lecocq\n#+DESCRIPTION: Learn using Emacs as a developer\n#+KEY"
  },
  {
    "path": "chapters/03-building-your-own-editor.org",
    "chars": 23104,
    "preview": "#+TITLE: Emacs for developers - Building your own editor\n#+AUTHOR: Pierre Lecocq\n#+DESCRIPTION: Learn using Emacs as a d"
  },
  {
    "path": "chapters/04-emacs-developing-environments.org",
    "chars": 4581,
    "preview": "#+TITLE: Emacs for developers - Emacs developing environments\n#+AUTHOR: Pierre Lecocq\n#+DESCRIPTION: Learn using Emacs a"
  },
  {
    "path": "chapters/05-special-features.org",
    "chars": 7507,
    "preview": "#+TITLE: Emacs for developers - Special features\n#+AUTHOR: Pierre Lecocq\n#+DESCRIPTION: Learn using Emacs as a developer"
  },
  {
    "path": "chapters/06-readings-and-resources.org",
    "chars": 846,
    "preview": "#+TITLE: Emacs for developers - Readings and resources\n#+AUTHOR: Pierre Lecocq\n#+DESCRIPTION: Learn using Emacs as a dev"
  },
  {
    "path": "demo/README.org",
    "chars": 1460,
    "preview": "* The demo\n\nA (basic) annoted demo associated to this tutorial is available in video:\n\n- [[https://www.youtube.com/watch"
  },
  {
    "path": "demo/config.el",
    "chars": 1427,
    "preview": ";;\n;; emacs4developer demo - emacs config\n;; by Pierre Lecocq\n;;\n;; See https://github.com/pierre-lecocq/emacs.d for ful"
  },
  {
    "path": "demo/src/dummy.rb",
    "chars": 1078,
    "preview": "#!/usr/bin/env ruby\n\nrequire_relative 'functions'\n\n# A dummy class\nclass Dummy\n  # Accessor - author\n  attr_accessor :au"
  },
  {
    "path": "demo/src/functions.rb",
    "chars": 568,
    "preview": "# Just say something\n#\n# @param message [String]\n# @param prefix [String]\ndef say(message, prefix = ' => ')\n  puts \"%s%s"
  },
  {
    "path": "exports/emacs4developers.html",
    "chars": 118814,
    "preview": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"\n\"http://www.w3.org/TR/xh"
  },
  {
    "path": "exports/emacs4developers.org",
    "chars": 47179,
    "preview": "#+TITLE: Emacs for developers\n#+AUTHOR: Pierre Lecocq\n#+DESCRIPTION: Learn using Emacs as a developer\n#+KEYWORDS: emacs,"
  }
]

// ... and 1 more files (download for full content)

About this extraction

This page contains the full source code of the pierre-lecocq/emacs4developers GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 14 files (219.3 KB), approximately 68.0k tokens, and a symbol index with 9 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!