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 Ctrl-H, by holding down the Ctrl 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. In order to teach Emacs how to find these files, you have two options:
Start M2 in a terminal window and enter setupEmacs().
Place the following lines in the .emacs file in your home directory, creating the file if necessary, and save the file.
;; .emacs file in your home directory (load \"M2-init\") ; f12 starts M2 in Emacs ; 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) ; f11 sends commands to M2 ; use C-u f11 to temporarily edit the M2 executable (global-set-key [ f11 ] 'M2-send-to-program)
Now, try restarting Emacs and starting Macaulay2 by pressing the F12 function key. If Macaulay2 doesn't start up (in a buffer named *M2*), check your .emacs file to make sure the lines above have been saved correctly. If they look okay, then see the following pages for help.
Note: on macOS systems, F12 may be usurped by either DashBoard, SpotLight, or something else, so either you must change the f12 to some other key, e.g. f8, in your .emacs file, or you should disable the systems use of the F12 key.
The source of this document is in Macaulay2Doc/ov_editors_emacs.m2:459:0.