Closed mahrud closed 2 months ago
That used to be the behavior, prior to #38. My opinion was that M2-send-to-program
should be for sending code to the M2-comint buffer and not for modifying the code in the current buffer. FWIW, this is consistent with similar functions in ess-r-mode and octave-mode.
Ah, I didn't notice or remember that last part, but I disagree with the framing that entering a new line is "modifying the code" because you cannot produce a text file that doesn't end with a new line in emacs! So why does it matter if M2-send-to-program adds a new line that emacs would add upon saving anyway?
ps: okay, it is possible, but you'd have to change a default setting.
What makes it really bad is the inconsistency of whether you have to manually go to the next line or not, and I think this is enough of a hassle (start typing commands, send to M2, start types commands, realize you needed a new line, go back, enter, go forward, continue typing commands, ...) that I'd like to return to the previous behavior.
Yeah, I must admit that I've found the new behavior annoying several times. :) I'll work on this.
Say I have a script and I'm writing something in the last line of the file. I type something and press the key for
M2-send-to-program
before saving the file. Then M2 does not advance to the next line, so I have to manually press enter and type the next command.On the other hand, if I saved file before sending the command to M2, emacs would have produced a new line at the end, so the cursor would advance.
Should we add a new line if we're at the end of the file?