comparison src/elisp/urweb-mode.el @ 2140:2b0f6b7ebf4f

Add urweb-mode command to close current XML tag Bound to "C-c /" by default to match nxml-mode's nxml-finish-element command.
author Julian Squires <julian@cipht.net>
date Mon, 04 May 2015 16:15:01 -0400
parents 3dc020fb2aa1
children 3288e3c9948b
comparison
equal deleted inserted replaced
2139:8c81cd351c1a 2140:2b0f6b7ebf4f
399 399
400 ;; Compatibility. FIXME: we should use `-' in Emacs-CVS. 400 ;; Compatibility. FIXME: we should use `-' in Emacs-CVS.
401 (unless (boundp 'skeleton-positions) (set (make-local-variable '@) nil)) 401 (unless (boundp 'skeleton-positions) (set (make-local-variable '@) nil))
402 402
403 (local-set-key (kbd "C-c C-c") 'compile) 403 (local-set-key (kbd "C-c C-c") 'compile)
404 (local-set-key (kbd "C-c /") 'urweb-close-matching-tag)
404 405
405 (urweb-mode-variables)) 406 (urweb-mode-variables))
406 407
407 (defun urweb-mode-variables () 408 (defun urweb-mode-variables ()
408 (set-syntax-table urweb-mode-syntax-table) 409 (set-syntax-table urweb-mode-syntax-table)
539 (end-of-line) 540 (end-of-line)
540 (search-backward "</" nil t) 541 (search-backward "</" nil t)
541 (urweb-tag-matcher) 542 (urweb-tag-matcher)
542 (beginning-of-line) 543 (beginning-of-line)
543 (current-indentation))) 544 (current-indentation)))
545
546 (defun urweb-close-matching-tag ()
547 "Insert a closing XML tag for whatever tag is open at the point."
548 (interactive)
549 (assert (urweb-in-xml))
550 (save-excursion
551 (urweb-tag-matcher)
552 (re-search-forward "<\\([^ ={/>]+\\)" nil t))
553 (let ((tag (match-string-no-properties 1)))
554 (insert "</" tag ">")))
544 555
545 (defconst urweb-sql-main-starters 556 (defconst urweb-sql-main-starters
546 '("SQL" "SELECT" "INSERT" "UPDATE" "DELETE" "FROM" "SELECT1" "WHERE")) 557 '("SQL" "SELECT" "INSERT" "UPDATE" "DELETE" "FROM" "SELECT1" "WHERE"))
547 558
548 (defconst urweb-sql-starters 559 (defconst urweb-sql-starters