Function: nxml-compute-indent-from-matching-start-tag
nxml-compute-indent-from-matching-start-tag is a byte-compiled
function defined in nxml-mode.el.gz.
Signature
(nxml-compute-indent-from-matching-start-tag)
Documentation
Compute the indent for a line with an end-tag using the matching start-tag.
When the line containing point ends with an end-tag and does not start in the middle of a token, return the indent of the line containing the matching start-tag, if there is one and it occurs at the beginning of its line. Otherwise return nil.
Source Code
;; Defined in /usr/src/emacs/lisp/nxml/nxml-mode.el.gz
(defun nxml-compute-indent-from-matching-start-tag ()
"Compute the indent for a line with an end-tag using the matching start-tag.
When the line containing point ends with an end-tag and does not start
in the middle of a token, return the indent of the line containing the
matching start-tag, if there is one and it occurs at the beginning of
its line. Otherwise return nil."
(save-excursion
(back-to-indentation)
(let ((bol (point)))
(let ((inhibit-field-text-motion t))
(end-of-line))
(skip-chars-backward " \t")
(and (= (nxml-token-before) (point))
(memq xmltok-type '(end-tag partial-end-tag))
;; start of line must not be inside a token
(or (= xmltok-start bol)
(save-excursion
(goto-char bol)
(nxml-token-after)
(= xmltok-start bol))
(eq xmltok-type 'data))
(condition-case nil
(nxml-scan-element-backward
(point)
nil
(- (point)
nxml-end-tag-indent-scan-distance))
(nxml-scan-error nil))
(< xmltok-start bol)
(progn
(goto-char xmltok-start)
(skip-chars-backward " \t")
(bolp))
(current-indentation)))))