47

How is the source code of GNU Emacs organized? What are the main modules and their functionality? Where can I find an official, up-to-date description of the architecture and its source code?

Amelio Vazquez-Reina
  • 5,157
  • 4
  • 32
  • 47

1 Answers1

48

Being an official GNU project it adheres closely to the GNU coding standards and directory layout. That said, if you are exploring the source tree I would start, as with most projects, with the README file in the root directory.

From that file onwards, there are several sub-directories:

`src'       holds the C code for Emacs (the Emacs Lisp interpreter and
            its primitives, the redisplay code, and some basic editing
            functions).
`lisp'      holds the Emacs Lisp code for Emacs (almost everything else).
`leim'      holds the library of Emacs input methods, Lisp code and
            auxiliary data files required to type international characters
            which can't be directly produced by your keyboard.
`lib-src'   holds the source code for some utility programs for use by or
            with Emacs, like movemail and etags.
`etc'       holds miscellaneous architecture-independent data files
            Emacs uses, like the tutorial text and the Zippy, the Pinhead
            quote database. The contents of the `lisp', `leim', `info',
            `man', `lispref', and `lispintro' subdirectories are
            architecture-independent too.
`info'      holds the Info documentation tree for Emacs.
`doc/emacs' holds the source code for the Emacs Manual.  If you modify the
            manual sources, you will need the `makeinfo' program to produce
            an updated manual. `makeinfo' is part of the GNU Texinfo
            package; you need version 4.6 or later of Texinfo.
`doc/lispref'   holds the source code for the Emacs Lisp reference manual.
`doc/lispintro' holds the source code for the Introduction to Programming
                in Emacs Lisp manual.
`msdos'     holds configuration files for compiling Emacs under MS-DOS.
`nt'        holds various command files and documentation files that pertain
            to building and running Emacs on Windows 9X/ME/NT/2000/XP.
`test'      holds tests for various aspects of Emacs's functionality.
reza.safiyat
  • 184
  • 3
  • 14
stsquad
  • 4,626
  • 28
  • 45
  • 7
    Also, see the Hacker Guide on the wiki http://www.emacswiki.org/emacs/HackerGuide – knarf Sep 26 '14 at 13:24
  • 1
    @knarf: well that at least explains some of the heinous macro abuse I see whenever I look at the C code ;-) – stsquad Sep 26 '14 at 13:30
  • 1
    Thanks, is there a link to the latest version of the README file (presumably the HEAD ref of the master branch, or the the tip associated with the latest stable release) that we could include in this answer? – Amelio Vazquez-Reina Sep 27 '14 at 18:50
  • 2
    @user815423426: now the git migration is complete I've linked to that page. – stsquad Nov 25 '14 at 16:53
  • 1
    Emacs can still compile user MSDOS!? – c-o-d Nov 26 '14 at 02:34
  • @EdgarAroutiounian I imagine it's evolved into generic Windows support :) I'm hardly a reliable source, but I would think MS-DOS support has been dropped :) – Sean Allred Nov 26 '14 at 02:47
  • No, the `msdos` directory seems to be DJGPP support. http://www.delorie.com/djgpp/ There is a separate `nt` directory from which today's w32 support springs from. Fun fact: I first learned about the GPL through delorie.com... :) – daveloyall Dec 18 '14 at 23:14