Setting up Macaulay 2 on emacs

24 Views Asked by At

I am trying to set up emacs to communicate with Macaulay 2 on my Mac. I am besically following the instruction in the following link.

https://macaulay2.com/doc/Macaulay2/share/doc/Macaulay2/Macaulay2Doc/html/_using_sp__Macaulay2_spwith_spemacs.html

So far, I could successfully download Macaulay2 and run the command setup() on Macaulay2. The problem is the following: when I open a file *.m2 from emacs, I can run Macaulay 2 by pressing the F12 key. I want to send a code on my emacs to Macaulay 2 line by line but I fail. As far as I understand, I think I set it up correctly. In my home directry, I have a file .emacs-Macaulay2 whose content is the following:

;; -*-emacs-lisp-*-




;; add "/opt/homebrew/share/emacs/site-lisp/macaulay2" to load-path if it isn't there
(add-to-list 'load-path "/opt/homebrew/share/emacs/site-lisp/macaulay2")




;; add "/opt/homebrew/share/info" to Info-default-directory-list if it isn't there
(add-to-list 'Info-default-directory-list "/opt/homebrew/share/info")





;; add "/opt/homebrew/bin" to PATH if it isn't there
(if (not (string-match "/opt/homebrew/bin" (getenv "PATH")))
     (setenv "PATH" "/opt/homebrew/bin:$PATH" t))




;; this version will give an error if M2-init.el is not found:
(load "M2-init")




;; this version will not give an error if M2-init.el is not found:
;; (load "M2-init" t)
;; You may comment out the following line with an initial semicolon if you 
;; want to use your f12 key for something else.  However, this action
;; will be undone the next time you run setup() or setupEmacs().
(global-set-key [ f12 ] 'M2)
(global-set-key [ f11 ] 'M2-send-to-program)




;; Prevent Emacs from inserting a superfluous "See" or "see" in front
;; of the hyperlinks when reading documentation in Info mode.
(setq Info-hide-note-references 'hide)

I can find M2-init.el in /opt/homebrew/share/emacs/site-lisp/macaulay2 and it calls other files such as M2.el, M2-mode.el and so on. In M2.el, I can find both the function "M2" and the function "M2-send-to-program" defined.

Question: why can't I use F11 key to run the function "M2-send-to-program"?

0

There are 0 best solutions below