Function: ConTeXt-close-xml-tag

ConTeXt-close-xml-tag is an interactive and byte-compiled function defined in context.el.

Signature

(ConTeXt-close-xml-tag)

Documentation

Create an </...> to match the last unclosed <...>. Not fool-proof.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/auctex-14.1.2/context.el
(defun ConTeXt-close-xml-tag ()
  "Create an </...> to match the last unclosed <...>.  Not fool-proof."
  (interactive "*")
  (let ((new-line-needed (bolp)) text indentation)
    (save-excursion
      (condition-case nil
          (ConTeXt-last-unended-start-xml)
        (error (error "Couldn't find unended XML tag")))
      (setq indentation (current-column))
      (re-search-forward "<\\([_A-Za-z][-:._A-Za-z0-9]*\\)")
      (setq text (buffer-substring (match-beginning 1) (match-end 1))))
    (indent-to indentation)
    (insert "</" text ">")
    (if new-line-needed (insert ?\n))))