Macaulay2 / M2-emacs

Macaulay2 emacs files
GNU General Public License v3.0
5 stars 3 forks source link

Restore F11 behavior of copying code from the demo buffer in M2-comint-mode #57

Closed d-torrance closed 7 months ago

d-torrance commented 7 months ago

It turns out that I broke the Macaulay2 demo feature described in the running Macaulay2 in emacs documentation node much earlier than I thought. Way back in #42, I deleted the line that set the current buffer as the demo buffer. So it's been broken since the release of 1.22. Oops!

This PR restores the behavior as described in the documentation and from what I've observed running Macaulay2 1.19.1 in Ubuntu 22.04. However, it's implemented a bit differently.

Previously, this code was just one case inside a much larger M2-send-to-program function, which was bound to F11 in both M2-mode and M2-comint-mode. But since #54, M2-send-to-program is only meant to be called from M2-mode.

Instead, we add a new function that is bound to F11 in M2-comint-mode, namely M2-send-input-or-get-input-from-demo-buffer, which copies a line from the demo buffer if the current line is blank and does the same thing as pressing Return if it isn't.

d-torrance commented 7 months ago

I just added one related commit. Rather than using a specific large font for the new frame created by M2-demo, we use the 24pt version of the default font.