Am I correct in assuming that you installed Macaulay2 1.22 using the PPA?
Yes, correct. Macaulay2 1.22 from the PPA on Ubuntu 20.04. And I'm using GNU Emacs 29.1.
If so, then the first step is to make sure that the emacs package is installed correctly:
sudo apt install elpa-macaulay2
This was already installed.
If that's fine but it's still not working, then my guess is it's an issue with the snap package not playing nicely with Ubuntu's emacs package ecosystem.
Hopefully, the snap package knows to look in your ~/.emacs file.
Yes, the snap package definitely reads the ~/.emacs file. The only M2-related entries in there are:
(global-set-key [ f12 ] 'M2)
(setq Info-hide-note-references 'hide)
Try adding the following to that:
(add-to-list 'load-path "/usr/share/emacs/site-lisp/elpa/macaulay2-1.22")
The path you mentioned doesn't exist on my system, I only have the following variation:
"/usr/share/emacs/site-lisp/elpa-src/macaulay2-1.22"
I tried adding your suggestion, and I also tried adding the above path that actually exists. This does not seem to have any effect.
With or without these changes, the situation is as follows. I can activate m2-mode in emacs (via M-x m2-mode), and I get the desired font coloring. I can also start a shell within emacs (M-x shell), and call M2 within that shell by simply typing "M2". The part that does not work is hitting F12 to start an interactive session. When I hit F12, I get the message
Sorry for the trouble – I now got it to work. I needed to add the following two lines to my .emacs:
(add-to-list 'load-path "/usr/share/emacs/site-lisp/elpa-src/macaulay2-1.22")
(load "M2-init")
The line with "M2-init" is mentioned in the manual at
However, this line is not/no longer created by the command
setupEmacs()
The file .emacs-Macaulay2 that setupEmacs() creates on my system contains only the lines
(global-set-key [ f12 ] 'M2)
(setq Info-hide-note-references 'hide)
(and some comments), which I had already copied to my .emacs.
Anyway, thanks a lot for pointing me to the right location of the M2-init file!