Running Macaulay 2 in Emacs Because some answers can be very wide, it is a good idea to run Macaulay 2 in a window which does not wrap output lines and allows the user to scroll horizontally to see the rest of the output. We provide a package for "emacs" which implements this, in 'emacs/M2.el'. It also provides for dynamic completion of symbols in the language. If you are a newcomer to emacs, 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 which can be read with 'info' mode; you may enter or re-enter that mode with the keystrokes 'C-H i'. You may also want to purchase (or print out) the emacs manual. It is cheap, comprehensive and informative. Once you have spent an hour with the emacs tutorial and manual, come back and continue from this point. If you are reading this file with emacs, then use the keystrokes 'C-x 2' to divide the buffer containing this file into two windows. Then press the 'F12' function key to start up Macaulay 2 in a buffer named '*M2*'. If this doesn't start up Macaulay 2, one reason may be that your function keys are not operable. In that case press 'C-C m' instead. (The notation 'C-C' is standard emacs notation for Control-C.) Another reason may be that you have not installed Macaulay 2 properly - the startup script ('M2' or 'M2.bat') should be on your path. A third reason may be that you are in Windows-98 and are using anti-virus software such as 'Dr. Solomon's', which can interfere with emacs when it tries to run a subprocess. You may use 'C-x o' freely to switch from one window to the other. Verify that Macaulay 2 is running by entering a command such as '2+2'. Now paste the following text into a buffer, unless you have the ASCII version of this documentation in an emacs buffer already, position the cursor on the first line of code, and press the 'F11' function key (or 'C-C s') repeatedly to present each line to Macaulay 2. i1 : R = ZZ/101[x,y,z] i2 : f = symmetricPower(2,vars R) i3 : M = cokernel f i4 : C = resolution M i5 : betti C Notice that the input prompts are not submitted to Macaulay 2. There is a way to send a region of text to Macaulay 2: simply select a region of text, making sure the mark is active (as described above) and press 'F11'. Try that on the list below; put it into an emacs buffer, move your cursor to the start of the list, press 'M-C-@' or 'M-C-space' to mark the list, and then press 'F11' to send it to Macaulay 2. (The notation 'M-C-@' means: while holding down the Meta key and the Control key press the '@' key, for which you'll also need the shift key.) {a,b,c,d,e,f, g,h,i,j,k,l, m,n} Now let's see how we can handle wide and tall Macaulay 2 output. Execute the following line of code. random(R^20,R^{6:-2}) Notice that the long lines in the Macaulay 2 window, instead of being wrapped around to the next line, simply disappear off the right side of the screen, as indicated by the dollar signs in the rightmost column. Switch to the other window and practice scrolling up and down with 'M-v' and 'C-v', and scrolling left and right with the function key 'F3' (or 'C-C <') and the function key 'F4' (or 'C-C >'). Notice how the use of 'C-E' to go to the end of the line sends the cursor to the dollar sign at the right hand side of the screen; that's where the cursor will appear whenever you go to a position off the screen to the right. Then use the 'F2' function key (or 'C-C .') to scroll the text so the cursor appears at the center of the screen. Use 'C-A' to move to the beginning of the line and then the 'F2' function key (or 'C-C .') to bring the left margin back into view. You may use the 'F5' function key or (or 'C-C ?') to toggle whether long lines are truncated or wrapped; initially they are truncated. Now go to the very end of the '*M2*' buffer with 'M->' and experiment with keyword completion. Type 'reso' and then press the 'TAB' key. Notice how the word is completed to 'resolution' for you. Delete the word with 'M-DEL', type 'res' and then press the 'TAB' key. The possible completions are displayed in a window. Switch to it with the 'F8' key, move to the desired completion, select it with the 'RETURN' key, and then return to the '*M2*' buffer with 'C-X o'. Alternatively, if you have a mouse, use the middle button to select the desired completion. Experiment with command line history in the '*M2*' buffer. Position your cursor at the end of the buffer, and then use 'M-p' and 'M-n' to move to the previous and next line of input remembered in the history. When you get to one you'd like to run again, simply press return to do so. Or edit it slightly to change it before pressing return. Assuming you have installed the "w3" emacs web browser, you may explore the documentation by positioning the cursor near a documented word such as 'List' and pressing 'C-C d'. Alternatively, when the prompt appears, you can type the key whose documentation should be found.