This patch proposes a new feature in comint mode. Currently, setting comint-prompt-read-only to some non-nil value makes the prompt read-only, but this only makes the prompt read-only. I don't find it useful to insert text into the middle of a historical buffer, so I added a new variable comint-history-read-only. If set to non-nil, this variable makes the entire history read-only. -Zachary Kanfer