Function: comint-line-beginning-position
comint-line-beginning-position is a byte-compiled function defined in
comint.el.gz.
Signature
(comint-line-beginning-position)
Documentation
Return the buffer position of the beginning of the line, after any prompt.
If comint-use-prompt-regexp is non-nil, then the prompt skip is done by
skipping text matching the regular expression comint-prompt-regexp,
a buffer local variable.
Source Code
;; Defined in /usr/src/emacs/lisp/comint.el.gz
(defun comint-line-beginning-position ()
"Return the buffer position of the beginning of the line, after any prompt.
If `comint-use-prompt-regexp' is non-nil, then the prompt skip is done by
skipping text matching the regular expression `comint-prompt-regexp',
a buffer local variable."
(if comint-use-prompt-regexp
;; Use comint-prompt-regexp
(save-excursion
(beginning-of-line)
(comint-skip-prompt)
(point))
;; Use input fields. Note that, unlike the behavior of
;; `line-beginning-position' inside a field, this function will
;; return the position of the end of a prompt, even if the point is
;; already inside the prompt. In order to do this, it assumes that
;; if there are two fields on a line, then the first one is the
;; prompt, and the second one is an input field, and is front-sticky
;; (as input fields should be).
(constrain-to-field (if (eq (field-at-pos (point)) 'output)
(line-beginning-position)
(field-beginning))
(line-end-position))))