Variable: comint-prompt-read-only

If non-nil, the comint prompt is read only.
The read only region includes the newline before the prompt.
This does not affect existing prompts.
Certain derived modes may override this option.

If you set this option to t, then the safe way to temporarily
override the read-only-ness of comint prompts is to call
`comint-kill-whole-line' or `comint-kill-region' with no
narrowing in effect. This way you will be certain that none of
the remaining prompts will be accidentally messed up. You may
wish to put something like the following in your init file:

(add-hook 'comint-mode-hook
(lambda ()
(define-key comint-mode-map "\C-w" 'comint-kill-region)
(define-key comint-mode-map [C-S-backspace]
'comint-kill-whole-line)))

If you sometimes use comint-mode on text-only terminals or with `emacs -nw', you might wish to use another binding for `comint-kill-whole-line'.