Function: sgml-close-tag
sgml-close-tag is an interactive and byte-compiled function defined in
sgml-mode.el.gz.
Signature
(sgml-close-tag)
Documentation
Close current element.
Depending on context, inserts a matching close-tag, or closes the current start-tag or the current comment or the current cdata, ...
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/textmodes/sgml-mode.el.gz
;; Editing shortcuts
(defun sgml-close-tag ()
"Close current element.
Depending on context, inserts a matching close-tag, or closes
the current start-tag or the current comment or the current cdata, ..."
(interactive)
(pcase (car (sgml-lexical-context))
('comment (insert " -->"))
('cdata (insert "]]>"))
('pi (insert " ?>"))
('jsp (insert " %>"))
('tag (insert " />"))
('text
(let ((context (save-excursion (sgml-get-context))))
(if context
(progn
(insert "</" (sgml-tag-name (car (last context))) ">")
(indent-according-to-mode)))))
(_
(error "Nothing to close"))))