From 8969d144bab08025a38d989301545f92dac615d5 Mon Sep 17 00:00:00 2001 From: Julian Squires Date: Mon, 4 May 2015 16:15:01 -0400 Subject: Add urweb-mode command to close current XML tag Bound to "C-c /" by default to match nxml-mode's nxml-finish-element command. --- src/elisp/urweb-mode.el | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/elisp/urweb-mode.el b/src/elisp/urweb-mode.el index fb9d18b5..2963434d 100644 --- a/src/elisp/urweb-mode.el +++ b/src/elisp/urweb-mode.el @@ -401,6 +401,7 @@ This mode runs `urweb-mode-hook' just before exiting. (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 @@ If anyone has a good algorithm for this..." (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")) -- cgit v1.2.3