Barry's Emacs is distributed with a number of packages, subsystems and libraries. These are Mock Lisp programs that extend Emacs to provide specific functions not built in to Emacs itself.
The packages, subsystems and libraries of code distributed with Emacs are stored in the database library emacs_library:emacslib
A subsystem is an Emacs function which is an interactive program in its own right: it reads commands in a language of its own, and displays the results.
A subsystem must be loaded before it can be used. Many subsystems are automtically loaded the first time you execute them. Emacs loads a subsystem by first searching the directories in the emacs_path logical name search-list. If the package is not found in the Emacs path, it is searched for in the MLisp-library database search-list.
You enter a subsystem by typing an Emacs command which invokes the subsystem. Once entered, the subsystem runs until a specific command to exit the subsystem is typed.
The commands understood by a subsystem are not like normal Emacs commands, because their purpose is something other than editing text. In Emacs, most commands are control or escape sequences because printing characters insert themselves. In most subsystems, there is no insertion of text, so non-control characters can act as commands.
While you are inside a subsystem, the mode line usually gives the name of the subsystem, as well as other information optionally supplied by the subsystem.
Emacs packages are subsystems that can be invoked from the DCL command line as well as from inside Emacs.
To run a package from the DCL command line, use the /PACKAGE qualifier on the Emacs DCL command:
$ EMACS/PACKAGE=PACKAGE-NAME
Emacs loads packages by loading a file named PACKAGE-NAME.MLP (the .MLP filetype stands for Mock Lisp Package). Emacs searches for the package file by first looking in the directories in the EMACS_PATH logical name search-list. If the package is not found in the Emacs path, it is searched for in the in the MLisp-library database search-list. When the package has been found, it is loaded, and Emacs starts execution of the package by executing the routine package-name-com which is defined in the .MLP file.
When the package is running, you do not usually have access to the normal editing commands, as the package will define its own command language.
While you are running a package, the mode line usually gives the name of the package, as well as other information optionally supplied by the package.
Emacs libraries are Mock Lisp programs that define useful functions. They are not interactive programs in their own right like subsystems and packages; they are more like subroutines in a high-level programming language which provide the user (or Emacs itself) with features not built in to Emacs.
The functions defined by a library are not accessible until the appropriate library has been loaded. Libraries can be loaded explicitly by the user, or they may be loaded automatically.execute-mlisp-fileMLisp-library
To load a library while Emacs is running, use ESC-x execute-mlisp-file. Emacs looks for the library using the emacs_path logical name. If the library is not found in the Emacs path, it is searched for in the in the MLisp-library database search-list. Once Emacs has located the library, it is loaded. All the functions defined in the library are then available for use.
Some libraries are loaded automatically in the course of executing certain functions. You will not normally notice this. This facility is known as autoloading autoloading. Autoloading is used to make library functions available without you having to know how to load the library; autoloading also saves space in Emacs by loading libraries only when you need them.
In addition to making functions accessible to ESC-x, the library may bind some functions to key sequences. This is done by the library loading another file called LIBRARY-NAME.key, where LIBRARY-NAME is the name of the library being loaded. This separation of functions from key bindings allows you to define your own bindings for functions in the library that will override the default bindings. To do this, make a private copy of the .KEY file, edit it to make your own bindings, then put the modified file in your EMACS_PATH or in in your emacslib database file. When Emacs loads the .key file, your private copy will be loaded if it exists, rather than the default system copy.