# HG changeset patch # User Julian Squires # Date 1430770501 14400 # Node ID 2b0f6b7ebf4ffff7bacb7fdeb09caa4ee9de9fa4 # Parent 8c81cd351c1a21c050c5fe12a8d1121eb62fc891 Add urweb-mode command to close current XML tag Bound to "C-c /" by default to match nxml-mode's nxml-finish-element command. diff -r 8c81cd351c1a -r 2b0f6b7ebf4f src/elisp/urweb-mode.el --- a/src/elisp/urweb-mode.el Fri Apr 24 16:21:55 2015 -0400 +++ b/src/elisp/urweb-mode.el Mon May 04 16:15:01 2015 -0400 @@ -401,6 +401,7 @@ (unless (boundp 'skeleton-positions) (set (make-local-variable '@) nil)) (local-set-key (kbd "C-c C-c") 'compile) + (local-set-key (kbd "C-c /") 'urweb-close-matching-tag) (urweb-mode-variables)) @@ -542,6 +543,16 @@ (beginning-of-line) (current-indentation))) +(defun urweb-close-matching-tag () + "Insert a closing XML tag for whatever tag is open at the point." + (interactive) + (assert (urweb-in-xml)) + (save-excursion + (urweb-tag-matcher) + (re-search-forward "<\\([^ ={/>]+\\)" nil t)) + (let ((tag (match-string-no-properties 1))) + (insert ""))) + (defconst urweb-sql-main-starters '("SQL" "SELECT" "INSERT" "UPDATE" "DELETE" "FROM" "SELECT1" "WHERE"))