Sometimes when in comint mode the point is anywhere in the buffer and I press Return by mistake. This sends the text at point to the underlying process, which can be really dangerous. Often this text contains many lines and, by chance or not, one of them could be a valid command.
Is there any way to tell comint not to execute anything on Return except the last input?
comint.el:comint-get-old-input-defaultseems to indicate that the behavior you observe is a bug. I suggest that you report it as such usingM-x report-emacs-bug. – sds Jul 11 at 13:56