PREV UP NEXT GNU Emacs Lisp Reference Manual

B.1: Building Emacs

This section explains the steps involved in building the Emacs executable. You don't have to know this material to build and install Emacs, since the makefiles do all these things automatically. This information is pertinent to Emacs maintenance.

Compilation of the C source files in the src directory produces an executable file called temacs, also called a bare impure Emacs. It contains the Emacs Lisp interpreter and I/O routines, but not the editing commands.

The command temacs -l loadup uses temacs to create the real runnable Emacs executable. These arguments direct temacs to evaluate the Lisp files specified in the file loadup.el. These files set up the normal Emacs editing environment, resulting in an Emacs that is still impure but no longer bare.

It takes a substantial time to load the standard Lisp files. Luckily, you don't have to do this each time you run Emacs; temacs can dump out an executable program called emacs that has these files preloaded. emacs starts more quickly because it does not need to load the files. This is the Emacs executable that is normally installed.

To create emacs, use the command temacs -batch -l loadup dump. The purpose of -batch here is to prevent temacs from trying to initialize any of its data on the terminal; this ensures that the tables of terminal information are empty in the dumped Emacs. The argument dump tells loadup.el to dump a new executable named emacs.

Some operating systems don't support dumping. On those systems, you must start Emacs with the temacs -l loadup command each time you use it. This takes a substantial time, but since you need to start Emacs once a day at most---or once a week if you never log out---the extra time is not too severe a problem.

You can specify additional files to preload by writing a library named site-load.el that loads them. You may need to increase the value of PURESIZE, in src/puresize.h, to make room for the additional files. (Try adding increments of 20000 until it is big enough.) However, the advantage of preloading additional files decreases as machines get faster. On modern machines, it is usually not advisable.

You can specify other Lisp expressions to execute just before dumping by putting them in a library named site-init.el. However, if they might alter the behavior that users expect from an ordinary unmodified Emacs, it is better to put them in default.el, so that users can override them if they wish. See Start-up Summary.

Before loadup.el dumps the new executable, it finds the documentation strings for primitive and preloaded functions (and variables) in the file where they are stored, by calling Snarf-documentation (see Accessing Documentation). These strings were moved out of the emacs executable to make it smaller. See Documentation Basics.

Function: dump-emacs to-file from-file
This function dumps the current state of Emacs into an executable file to-file. It takes symbols from from-file (this is normally the executable file temacs).

If you use this function in an Emacs that was already dumped, you must set command-line-processed to nil first for good results. See Command Line Arguments.

Command: emacs-version
This function returns a string describing the version of Emacs that is running. It is useful to include this string in bug reports.
(emacs-version)
  => "GNU Emacs 19.29.1 (i386-debian-linux) \
 of Tue Jun  6 1995 on balloon"

Called interactively, the function prints the same information in the echo area.

Variable: emacs-build-time
The value of this variable is the time at which Emacs was built at the local site.
emacs-build-time
     => "Tue Jun  6 14:55:57 1995"
Variable: emacs-version
The value of this variable is the version of Emacs being run. It is a string such as "19.29.1".

The following two variables did not exist before Emacs version 19.23, which reduces their usefulness at present, but we hope they will be convenient in the future.

Variable: emacs-major-version
The major version number of Emacs, as an integer. For Emacs version 19.29, the value is 19.
Variable: emacs-minor-version
The minor version number of Emacs, as an integer. For Emacs version 19.29, the value is 29.