Function: rng-set-state-after
rng-set-state-after is a byte-compiled function defined in
rng-nxml.el.gz.
Signature
(rng-set-state-after &optional POS)
Documentation
Set the state for after parsing the first token with endpoint >= POS.
This does not change the xmltok state or point. However, it does
set xmltok-dtd. Returns the position of the end of the token.
Source Code
;; Defined in /usr/src/emacs/lisp/nxml/rng-nxml.el.gz
(defun rng-set-state-after (&optional pos)
"Set the state for after parsing the first token with endpoint >= POS.
This does not change the xmltok state or point. However, it does
set `xmltok-dtd'. Returns the position of the end of the token."
(unless pos (setq pos (point)))
(when (< rng-validate-up-to-date-end pos)
(message "Parsing...")
(while (and (rng-do-some-validation)
(< rng-validate-up-to-date-end pos))
;; Display percentage validated.
(force-mode-line-update)
(sit-for 0))
(message "Parsing...done"))
(save-excursion
(save-restriction
(widen)
(nxml-with-invisible-motion
(if (= pos (point-min))
(rng-set-initial-state)
(let ((state (get-text-property (1- pos) 'rng-state)))
(cond (state
(rng-restore-state state)
(goto-char pos))
(t
(let ((start (previous-single-property-change pos
'rng-state)))
(cond (start
(rng-restore-state (get-text-property (1- start)
'rng-state))
(goto-char start))
(t (rng-set-initial-state))))))))
(xmltok-save
(if (= (point) 1)
(xmltok-forward-prolog)
(setq xmltok-dtd rng-dtd))
(cond ((and (< pos (point))
;; This handles the case where the prolog ends
;; with a < without any following name-start
;; character. This will be treated by the parser
;; as part of the prolog, but we want to treat
;; it as the start of the instance.
(eq (char-after pos) ?<)
(<= (point)
(save-excursion
(goto-char (1+ pos))
(skip-chars-forward " \t\r\n")
(point))))
pos)
((< (point) pos)
(let ((rng-dt-namespace-context-getter
'(nxml-ns-get-context))
(rng-parsing-for-state t))
(rng-forward pos))
(point))
(t pos)))))))