GNU Emacs

From Gentoo Wiki
Jump to: navigation, search
Resources

GNU Emacs is a powerful, extensible, self-documenting text editor. It is released by the Free Software Foundation and has been under development since 1976. In Gentoo, GNU Emacs is maintained by the team of the same name, which can be reached through emacs@gentoo.org. Detailed developer information can be found on the project page.

Installation

USE flags

Cannot load package information. Is the atom app-editors/emacs-vcs correct?

Note
USE flags for toolkits gtk, motif, and athena are mutually exclusive. Generally, USE="gtk" is a good choice. However, if intending to use Emacs as a daemon, USE="motif -athena -gtk -Xaw3d" or USE="athena Xaw3d -gtk -motif" is recommended instead because of bug #292471. USE="athena Xaw3d" resembles USE="gtk" very well.

Emerge

root #emerge --ask app-editors/emacs

Several versions side-by-side

In Gentoo, several Emacs versions can be installed on a system simultaneously. The upstream version already installs elisp and data files into versioned subdirectories. To avoid file collisions between slots, in Gentoo binaries and man pages are suffixed with their corresponding version number, too.

The eselect module from app-eselect/eselect-emacs can be used to link /usr/bin/emacs and its auxiliary programs to the ones belonging to the desired Emacs version. Consult the eselect user guide for details on eselect.

Configuration

Emacs can be customized by clicking through the GUI (use M-x customize-group RET) or by using the ~/.emacs configuration file which is written in Emacs Lisp, Emacs' own Lisp dialect.

Documentation

For a quick-start documentation, type in Emacs: C-h t (Ctrl+h followed by t). For further help on how to use Emacs, start emacs and type C-h r (Ctrl+h followed by r). To exit Emacs, type C-x C-c (Ctrl+x followed by Ctrl+c).

Additional elisp packages

Emacs has lots of additional packages written in elisp. There is a number of ways to install them, but the standard one is package.el nowadays. On Gentoo it can be used both on per-user and system-wide way.

To install elisp packages per-user use package.el distributed with GNU Emacs.

To install elisp packages system-wide under the Portage control you can use gs-elpa. Read layman documentation before using it, as gs-elpa represents ELPA repositories as layman overlays. It currently supports 4 repositories: gnu-elpa, marmalade, melpa and melpa-stable.

When the layman setup works, install gs-elpa:

root #emerge --ask app-portage/gs-elpa

After it you can start adding elisp repos and emerging packages, e.g.:

root #layman -L
root #layman -a gnu-elpa
root #layman -a melpa-stable
root #emerge --ask app-emacs/starter-kit app-emacs/starter-kit-bindings app-emacs/starter-kit-eshell app-emacs/starter-kit-lisp
Warning
Always add gnu-elpa repository first, as other repos depend on it.

Bugs related to gs-elpa should be reported on its issue tracker.

If you ever find bugs like this one, you can exclude packages from dependencies adding their name to the "external" object in the "common-config" section of /etc/g-sorcery/gs-elpa.json configuration file. For the example issue it would be (together with already added packages):

FILE /etc/g-sorcery/gs-elpa.json
"external": {"emacs": "virtual/emacs", "cl-lib": "virtual/emacs", "eieio": "virtual/emacs"}

See also

  • Emacs — a class of powerful, extensible, self-documenting text editors.
  • Xft support for GNU Emacs — describes how to enable font anti-aliasing in Emacs using the Xft library.
  • Vim — a text editor based on the vi text editor.
  • Nano — an easy to use text editor with additional functionality.