GNU Emacs on Gentoo
1.
Introduction
What is Emacs?
Emacs is the
extensible, customizable, self-documenting real-time display editor.
Large parts are written in the Lisp dialect Emacs Lisp, with which
extensions can be easily developed. Apart from its editing features,
GNU Emacs provides a whole environment to manage your system, mail,
IRC chats and texts (be it correspondence or programming).
2.
Maintaining the editor itself
Available versions
Currently the following Emacs versions are available:
| Package |
Version |
Type |
SLOT |
eselect name |
Remarks |
| emacs |
18.59 |
released |
18 |
emacs-18 |
|
| emacs |
21.4 |
released |
21 |
emacs-21 |
|
| emacs |
22.2 |
released |
22 |
emacs-22 |
|
| emacs-cvs |
22.2.9999 |
CVS (EMACS_22_BASE branch) |
22 |
emacs-22-cvs |
|
| emacs-cvs |
23.0.50_pre20080201 |
Snapshot (trunk) |
23 |
emacs-23 |
Last version before the unicode-2 merge |
| emacs-cvs |
23.0.9999 |
CVS (trunk) |
23 |
emacs-23 |
|
Locations of files
The following files are installed in different locations or under a
different name (as compared to vanilla GNU Emacs):
- Emacs executable: /usr/bin/emacs-suffix,
where suffix is normally equal to the Emacs major version
- Auxiliary programs (e.g., ctags):
/usr/bin/ctags-emacs-suffix
- Man pages are named accordingly
- Info files of Emacs are installed in directory
/usr/share/info/emacs-suffix/
The programs are symlinked to their original names by the Emacs
eselect module, apart from ctags, which has its own module.
USE flags
Emacs has many USE flags, most are easy to understand what they are
good for, others have some hidden "features" one should know about.
| Flag |
Description |
Notes |
| alsa |
Determine if ALSA should be used |
Emacs autodetects ALSA. That test is removed by the ebuild if the flag
is not set. This is for cases where ALSA is installed but the user
does not wish support for it in Emacs. |
| dbus |
Make Emacs D-Bus aware |
|
| gif |
Support for GIF images. |
|
| gpm |
Support for console-based mouse driver (emacs-cvs only). |
|
| gtk |
Use the GIMP Toolkit (GTK+) as windowing toolkit (menu bar etc.) |
When this toolkit is activated along with alternative ones (see
other USE flags), GTK+ is chosen. This is in sync with upstream's
wishes. |
| gzip-el |
Zip up all el files. |
The zip binary is autodetected. So even when this USE flag is
disabled but the binary is found, all el files will be compressed.
The ebuild takes of that care by confusing the configure script. |
| hesiod |
Use the Hesiod name service system. |
|
| jpeg |
Support for JPEG images. |
|
| kerberos |
Support for the Kerberos network authentication protocol. |
|
| leim |
Extended methods for input encodings. |
|
| m17n-lib |
Use the m17n-lib multilingual library for complex text layout,
e.g. for Indic scripts. |
Only available from 23 on, and if "xft" is enabled too. |
| motif |
A windowing toolkit. |
|
| nls |
This makes use of gettext, an easy way to provide translations
of strings. |
|
| png |
Support for PNG images. |
|
| sendmail |
Build with support for mail transfer agent (MTA). |
|
| sound |
Control the availability of sound support. |
|
| source |
Install the C source files and make them available in the
internal documentation system of GNU Emacs. |
|
| spell |
Control the spell checking abilities. |
Emacs 22 and higher autodetect aspell in favor of ispell, so no further
actions needed. |
| svg |
Support for SVG images. |
Only 23 versions support that. |
| tiff |
Support for tiff images. |
|
| toolkit-scroll-bars |
Instead of the internal scroll bars, the ones from the
windowing toolkit are used. |
You will lose some functionality (split windows by clicking on
the scroll bar for example). |
| X |
Let Emacs use an X session if available. Text mode can always
be forced. |
|
| Xaw3d |
A windowing toolkit. |
|
| xft |
Choose an alternative font renderer. Only available from 23 on. |
|
| xpm |
Support for xpm images. |
If disabled, all logos, icons etc. in Emacs are displayed in
grayscale. This flag is set to on in base profile's package.use. |
3.
Packages
Depending on a specific Emacs version
Note:
The documentation of the functions provided is to be found in the
eclasses itself.
|
If a package needs at least a version of GNU Emacs, you can tell
the elisp.eclass by
giving NEED_EMACS=version_number before
the inherit line. Undefined the default dependency is on virtual/emacs-21.
The site-lisp directory and package loading
The regular location for Emacs lisp packages in Gentoo
is /usr/share/emacs/site-lisp/package/. All Elisp
files (.el) and compiled Elisp files (.elc)
should go there.
Emacs packages normally need to be activated or loaded when a certain
condition is met (like c-mode for C source files).
In Gentoo every package has a site initialisation file that holds
the needed commands. The file is located in ${FILESDIR} and
starts with a two-digit number, followed by the package name
and -gentoo. The elisp-install function puts
this file in the directory
/usr/share/emacs/site-lisp/site-gentoo.d/.
When calling elisp-site-regen in an ebuild, the global site
file /usr/share/emacs/site-lisp/site-gentoo.el is
regenerated, which holds the contents of all individual site init
files in one. They are read in alphabetical order, so the numbers
determine which comes first, the lowest is to be found at the
beginning. That means: Packages depending on each other need to have rising
order for site initialisation, too.
Some time ago all those initialisations were added
to /usr/share/emacs/site-lisp/site-start.el, which is
always loaded at Emacs start-up! Today you can individually control
which user will activate all installed Elisp packages by adding a line like
(require 'site-gentoo)
to a file read by Emacs on start-up.
Historically site-init files were read from the
/usr/share/emacs/site-lisp/, which is still supported by
the eclasses, but a remerge/update will put it in the
site-gentoo.d/ subdirectory. From
app-admin/eselect-emacs-1.3-r2 on a script is installed
that checks for needed rebuilds, called emacs-updater.
Important:
A load command for site initialisations is only acceptable for
a few packages. If used, it always loads the whole package and makes
Emacs start-up really slow, so the autoload mechanism is the preferred
way. The elisp-common eclass has functions to generate
an autoload file if none is shipped is with the package but the
functionality is available in the source nonetheless. For more
information about the mechanism see the
Elisp manual. Also manual keybindings directly in the site-file
are discouraged to not disturb the user as he could have bound the
keys himself. Keep pollution low but provide sane default settings
out of the box so even a novice can start working fast.
|
Eclasses
Packages that have support for or rely on GNU Emacs can use two
eclasses to do some recurring tasks in a simple way. The
documentation of the functions are provided in the eclasses, so they
are not repeated here! Format of documentation is to allow man-page
generation from source.
| Name |
Purpose |
| elisp-common.eclass |
Provides functions to handle Elisp files. Compilation,
installation and generation of autoloads is covered here in a
general way. Packages with optional Emacs support must rely on this eclass. |
| elisp.eclass |
The functions from elisp-common.eclass are used to
construct the default functions
(src_unpack, src_compile and friends) for packages in
the app-emacs hierarchy of ebuilds. It pulls in an
appropriate version of Emacs (meaning a
version of virtual/emacs, controlled
by the NEED_EMACS variable) and
is not intended for packages with optional (via USE flag)
support for GNU Emacs. |
Emacs eselect module
Having several Emacs versions simultaneously installed on a system,
needs some caution by maintainers. Usual pitfalls are file collisions
and installations of one slot using data from another. As
described earlier, the executables are
suffixed with their corresponding version number. All data files go
to similar directories, also distinguished by a version suffix.
To be independent of the installed version, the eselect module
from app-admin/eselect-emacs guarantees
that /usr/bin/emacs always points to the Emacs you want.
All ebuilds for the editor check if the symlink is set, and change it
to the highest available in the case where it does not exist. If no
GNU Emacs is found, but XEmacs, all helper programs are symlinked to
these of XEmacs.
The module file has some comments about how the code works. For more
information how an eselect module is set up, consult the
documentation.
Provided virtuals
Some functionality is available several times in different packages.
To not force a subjective choice the maintainer made, virtuals check
if one of the alternatives is installed on the user's system.
- virtual/editor
- Just makes sure you have an editing capability available on your system.
- virtual/emacs
- This gives you the choice between several version of Emacs.
Elisp packages can choose which virtual version is the minimum they
need.
- virtual/flim
- There are several libraries that provide encoding functions for
other packages. If they are compatible
to app-emacs/flim, they should provide the virtual of
the same name.
- virtual/gnus
- The news reader gnus is shipped with Emacs (from 21 on) and also
available as a separate package. To give users a better choice,
all of these ebuilds provide a virtual. Though it is only valid
for version 5.10 or greater for Gnus, so the virtual points to
Emacs 22.
Where Emacs team is upstream
Not all packages maintained by the Emacs team are developed by people
from outside the Gentoo project (they are usually called upstream).
Most of those exceptions are for proper operation of GNU Emacs in the
Gentoo environment.
Sources of these packages are kept in the
Emacs SVN repository.
They are released and brought to the Emacs overlay or to the Portage
tree when they have proven stable.
| Package name |
Purpose |
| app-admin/eselect-emacs |
Setting the correct man page locations, Info documentation paths
and target for /usr/bin/emacs, see the separate
section. Additionally it ships the
emacs-updater script, which makes the transition from the old
location of the site-init files to the new one. |
| app-admin/eselect-ctags |
There are several implementations of the ctags binary, all with a different feature set. This eselect module lets you choose the variant you need. |
| x11-misc/emacs-desktop |
Holds the desktop file (provides file associations
for many desktop environments) and icons, needed when Emacs is
emerged with USE=X. |
| app-emacs/gentoo-syntax |
A collection of Emacs major modes that help you edit ebuilds and
other Gentoo specific files. This is developed in cooperation with
the XEmacs team, so we share the same source. |
4.
Resources
| Resource |
Comment |
|
Various authors; Gentoo Developer Handbook
|
First steps as Gentoo developer plus an Ebuild HowTo with a good
overview.
|
|
Various authors;
Gentoo Development Guide
|
Extensive reference about how development is organised in Gentoo,
plus style advises for ebuild authors.
|
|
Robert J. Chassell;
An Introduction to Programming in Emacs Lisp;
ISBN 1-882114-56-6; GNU Press
|
A primer on Elisp programming (very basic, but very good).
|
|
Richard M. Stallman;
GNU Emacs Manual; 16th edition (for version 22);
ISBN 1-882114-86-8; GNU Press
|
The official handbook of Emacs, also shipped with the editor.
This covers the usage of Emacs, not the programming or deep internals.
|
|
Various authors;
GNU Emacs Lisp Reference Manual
|
All information needed for Elisp programming, dense and extensive,
but not for beginners.
|
|
Craig A. Finseth;
The Craft of Text Editing:
Emacs for the Modern World; ISBN 0-387-97616-7; Springer-Verlag
|
Background information about user interfaces and the ergonomics of
text editing.
|
The contents of this document are licensed under the Creative Commons -
Attribution / Share Alike license.
|