Macaulay2 » Documentation
Packages » Macaulay2Doc > getting started > using Macaulay2 with emacs > setting up the Macaulay2 emacs interface
next | previous | forward | backward | up | index | toc

setting up the Macaulay2 emacs interface

If you are a newcomer to emacs, you should spend a few minutes going through the emacs tutorial. Start up emacs with the command emacs and then start up the emacs tutorial with the keystrokes C-h t. (The notation C-h indicates that you should type Control-H, by holding down the control key, and pressing H.) The emacs tutorial will introduce you to the basic keystrokes useful with emacs. After running through that you will want to examine the online emacs manual that can be read with info mode; you may enter or re-enter that mode with the keystrokes C-h i.

The Macaulay2 emacs interface consists of several files in the directory share/emacs/site-lisp/Macaulay2/ in the Macaulay2 distribution tree. If you're lucky, then your system administrator has installed Macaulay2 so that directory ends up in the same place where emacs looks for its files, as listed by the emacs variable loadpath. If not, then in order for emacs to be able to find these files, place the following lines in the .emacs file in your home directory, creating the file if necessary. Alternatively, and much simpler, run M2, and let the setupEmacs function do it for you.

    ;; .emacs file in your home directory
    (load "M2-init")

    ; comment out the following line with an initial semicolon 
    ; if you want to use your f12 key for something else
    ; or change f12 to (for example) f8
    (global-set-key [ f12 ] 'M2)

After saving your .emacs file, try running emacs. Start Macaulay2 by pressing the f12 function key. On MacOS X systems, f12 is usurped by either DashBoard, SpotLight, or something else, so either you must change the f12 to some other key, e.g., f8, in the .emacs file, or you should disable the systems use of the f12 key.

If Macaulay2 doesn't start up (in a buffer named *M2*), check that you typed in the above lines correctly into .emacs. If they look okay, then see teaching emacs how to find M2-init.el, teaching emacs how to find M2, and teaching your shell how to find M2.