Function: nxml-outline-display-rest
nxml-outline-display-rest is a byte-compiled function defined in
nxml-outln.el.gz.
Signature
(nxml-outline-display-rest OUTLINE-STATE START-TAG-INDENT TAG-QNAMES)
Documentation
Display up to and including the end of the current element.
OUTLINE-STATE can be nil, t, hide-children. START-TAG-INDENT is the indent of the start-tag of the current element, or nil if no containing element has a non-nil OUTLINE-STATE. TAG-QNAMES is a list of the qnames of the open elements. Point is after the title content. Leave point after the closing end-tag. Return t if we had a non-transparent child section.
Source Code
;; Defined in /usr/src/emacs/lisp/nxml/nxml-outln.el.gz
(defun nxml-outline-display-rest (outline-state start-tag-indent tag-qnames)
"Display up to and including the end of the current element.
OUTLINE-STATE can be nil, t, hide-children. START-TAG-INDENT is the
indent of the start-tag of the current element, or nil if no
containing element has a non-nil OUTLINE-STATE. TAG-QNAMES is a list
of the qnames of the open elements. Point is after the title content.
Leave point after the closing end-tag. Return t if we had a
non-transparent child section."
(let ((last-pos (point))
(transparent-depth 0)
;; don't want ellipsis before root element
(had-children (not tag-qnames)))
(while
(cond ((not (nxml-section-tag-forward))
(if (null tag-qnames)
nil
(nxml-outline-error "Missing end-tag %s"
(car tag-qnames))))
;; section end-tag
((nxml-token-end-tag-p)
(when nxml-outline-display-section-tag-function
(funcall nxml-outline-display-section-tag-function
nil
xmltok-start))
(let ((qname (xmltok-end-tag-qname)))
(unless tag-qnames
(nxml-outline-error "Extra end-tag %s" qname))
(unless (string= (car tag-qnames) qname)
(nxml-outline-error "Mismatched end-tag; expected %s, got %s"
(car tag-qnames)
qname)))
(cond ((> transparent-depth 0)
(setq transparent-depth (1- transparent-depth))
(setq tag-qnames (cdr tag-qnames))
t)
((not outline-state)
(nxml-outline-set-overlay nil last-pos (point))
nil)
((or (not had-children)
(eq outline-state 'hide-children))
(nxml-outline-display-single-line-end-tag last-pos)
nil)
(t
(nxml-outline-display-multi-line-end-tag last-pos
start-tag-indent)
nil)))
;; section start-tag
(t
(let* ((qname (xmltok-start-tag-qname))
(section-start-pos xmltok-start)
(heading-start-pos
(and (or nxml-outline-display-section-tag-function
(not (eq outline-state 'had-children))
(not had-children))
(nxml-token-starts-line-p)
(nxml-heading-start-position))))
(when nxml-outline-display-section-tag-function
(funcall nxml-outline-display-section-tag-function
t
section-start-pos
heading-start-pos))
(setq tag-qnames (cons qname tag-qnames))
(if (or (not heading-start-pos)
(and (eq outline-state 'hide-children)
(setq had-children t)))
(setq transparent-depth (1+ transparent-depth))
(nxml-display-section last-pos
section-start-pos
heading-start-pos
start-tag-indent
outline-state
had-children
tag-qnames)
(setq had-children t)
(setq tag-qnames (cdr tag-qnames))
(setq last-pos (point))))
t)))
had-children))