comint-prompt-read-only is a variable defined in `comint.el'.
Its value is

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 [remap kill-region] 'comint-kill-region)
(define-key comint-mode-map [remap 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'.

You can customize this variable.

This variable was introduced, or its default value was changed, in version 22.1 of Emacs.