Function: nxml-paragraph-start-pos
nxml-paragraph-start-pos is a byte-compiled function defined in
nxml-mode.el.gz.
Signature
(nxml-paragraph-start-pos HAD-DATA OFFSET)
Documentation
Return the position of the paragraph start if contained in the current token.
Return nil if the current token does not contain the paragraph start. Only characters before OFFSET from the end of the token are eligible. HAD-DATA says whether there have been non-whitespace data characters yet.
Source Code
;; Defined in /usr/src/emacs/lisp/nxml/nxml-mode.el.gz
(defun nxml-paragraph-start-pos (had-data offset)
"Return the position of the paragraph start if contained in the current token.
Return nil if the current token does not contain the paragraph start.
Only characters before OFFSET from the end of the token are eligible.
HAD-DATA says whether there have been non-whitespace data characters yet."
(cond ((not had-data)
(cond ((memq xmltok-type '(data cdata-section))
(save-excursion
(goto-char (- (point)
(max (if (eq xmltok-type 'cdata-section)
3
0)
offset)))
(and (re-search-backward "[^ \t\r\n]" xmltok-start t)
(re-search-backward "^[ \t]*$" xmltok-start t)
(match-beginning 0))))
((and (eq xmltok-type 'comment)
(nxml-token-ends-line-p)
(nxml-token-begins-line-p))
(save-excursion
(goto-char (- (point) (max 3 offset)))
(when (and (< (+ xmltok-start 4) (point))
(re-search-backward "[^ \t\r\n]"
(+ xmltok-start 4)
t))
(if (re-search-backward "^[ \t]*$" xmltok-start t)
(match-beginning 0)
(goto-char xmltok-start)
(if (looking-at "<!--[ \t]*\n")
(match-end 0)
(skip-chars-backward " \t")
(point))))))))
((memq xmltok-type '(data space cdata-section))
(save-excursion
(goto-char (- (point) offset))
(and (re-search-backward "^[ \t]*$" xmltok-start t)
(match-beginning 0))))
((and (memq xmltok-type '(start-tag
end-tag
empty-element
comment
processing-instruction
entity-ref))
(nxml-token-ends-line-p)
(nxml-token-begins-line-p))
(or (search-forward "\n" nil t)
(point-max)))
((and (eq xmltok-type 'start-tag)
(nxml-token-begins-line-p)
(not (save-excursion
(goto-char xmltok-start)
(nxml-in-mixed-content-p nil))))
(save-excursion
(goto-char xmltok-start)
(skip-chars-backward " \t")
;; include any blank line before
(or (and (eq (char-before) ?\n)
(save-excursion
(goto-char (1- (point)))
(skip-chars-backward " \t")
(and (bolp) (point))))
(point))))))