Function: nxml-heading-start-position
nxml-heading-start-position is a byte-compiled function defined in
nxml-outln.el.gz.
Signature
(nxml-heading-start-position)
Documentation
Return the position of the start of the content of a heading element.
Adjust the position to be after initial leading whitespace. Return nil if no heading element is found. Requires point to be immediately after the section's start-tag.
Source Code
;; Defined in /usr/src/emacs/lisp/nxml/nxml-outln.el.gz
(defun nxml-heading-start-position ()
"Return the position of the start of the content of a heading element.
Adjust the position to be after initial leading whitespace.
Return nil if no heading element is found. Requires point to be
immediately after the section's start-tag."
(let ((depth 0)
(heading-regexp (concat "\\`\\("
nxml-heading-element-name-regexp
"\\)\\'"))
(section-regexp (concat "\\`\\("
nxml-section-element-name-regexp
"\\)\\'"))
(start (point))
found)
(save-excursion
(while (and (xmltok-forward)
(cond ((memq xmltok-type '(end-tag partial-end-tag))
(and (not (string-match section-regexp
(xmltok-end-tag-local-name)))
(> depth 0)
(setq depth (1- depth))))
;; XXX Not sure whether this is a good idea
;;((eq xmltok-type 'empty-element)
;; nil)
((not (memq xmltok-type
'(start-tag partial-start-tag)))
t)
((string-match section-regexp
(xmltok-start-tag-local-name))
nil)
((string-match heading-regexp
(xmltok-start-tag-local-name))
(skip-chars-forward " \t\r\n")
(setq found (point))
nil)
(t
(setq depth (1+ depth))
t))
(<= (- (point) start) nxml-heading-scan-distance))))
found))