Files containing emacs source code have names of the form
*.el. Macaulay2 comes with a file called
M2-init.el that sets up emacs for running M2 conveniently. It is important that emacs be able to find that file and the three other files that come with it, by searching in the directories listed in the emacs variable
load-path.
If you are lucky, then the Macaulay2 directory tree has been installed with the same root as the emacs directory tree. For example, if emacs and Macaulay2 are both installed in /usr, then
M2-init.el is located at
/usr/share/emacs/site-lisp/Macaulay2/M2-init.el, and emacs already knows to look in that directory for source files.
The simplest way to teach emacs how to find
M2-init.el is to let M2 do it for you. Run M2, and then, in response to Macaulay2's input prompt, enter
setup(). If that works, the next time you start emacs, it should know how to find
M2-init.el (see
setup). If that doesn't work, read onward.
To determine the precise path of the site-lisp directory emacs is looking in, so that you can install Macaulay2 properly, use the emacs describe-variable command, accessible with the key strokes
C-h v, and ask for the description of the variable
load-path.
Let's assume that you have located the Macaulay2 source code, and that
M2-init.el is located at
/foo/bar/share/emacs/site-lisp/Macaulay2/M2-init.el, and that you want to tell emacs to search that directory, too. Insert the following command into the file .emacs in your home directory.
(add-to-list 'load-path "/foo/bar/share/emacs/site-lisp/Macaulay2")
The next time you start emacs, emacs will look also in that directory for files, and it should find
M2-init.el.