summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Julian Squires <julian@cipht.net>2015-05-04 16:15:01 -0400
committerGravatar Julian Squires <julian@cipht.net>2015-05-04 16:15:01 -0400
commit8969d144bab08025a38d989301545f92dac615d5 (patch)
tree351e76c09318ba59d77976db239799edea7a6daa /src
parent36e93feed9439cd64a03954b267596f71f596a46 (diff)
Add urweb-mode command to close current XML tag
Bound to "C-c /" by default to match nxml-mode's nxml-finish-element command.
Diffstat (limited to 'src')
-rw-r--r--src/elisp/urweb-mode.el11
1 files changed, 11 insertions, 0 deletions
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 "</" tag ">")))
+
(defconst urweb-sql-main-starters
'("SQL" "SELECT" "INSERT" "UPDATE" "DELETE" "FROM" "SELECT1" "WHERE"))