Mercurial > urweb
comparison src/elisp/urweb-mode.el @ 2241:2b1af5dc6dee
Merge.
author | Ziv Scully <ziv@mit.edu> |
---|---|
date | Sun, 19 Jul 2015 19:05:16 -0700 |
parents | 3288e3c9948b |
children | 3ffef52d549c |
comparison
equal
deleted
inserted
replaced
2240:88cc0f44c940 | 2241:2b1af5dc6dee |
---|---|
177 (re-search-backward "\\(\\([-{}]\\)\\|<\\(/?xml\\)?\\)" | 177 (re-search-backward "\\(\\([-{}]\\)\\|<\\(/?xml\\)?\\)" |
178 bound t)) | 178 bound t)) |
179 (let ((xml-tag (length (or (match-string 3) ""))) | 179 (let ((xml-tag (length (or (match-string 3) ""))) |
180 (ch (match-string 2))) | 180 (ch (match-string 2))) |
181 (cond | 181 (cond |
182 ((equal ch ?\{) | 182 ((equal ch "{") |
183 (if (> depth 0) | 183 (if (> depth 0) |
184 (decf depth) | 184 (decf depth) |
185 (setq finished t))) | 185 (setq finished t))) |
186 ((equal ch ?\}) | 186 ((equal ch "}") |
187 (incf depth)) | 187 (incf depth)) |
188 ((= xml-tag 3) | 188 ((= xml-tag 3) |
189 (if (> depth 0) | 189 (if (> depth 0) |
190 (decf depth) | 190 (decf depth) |
191 (progn | 191 (progn |
192 (setq answer t) | 192 (setq answer t) |
193 (setq finished t)))) | 193 (setq finished t)))) |
194 ((= xml-tag 4) | 194 ((= xml-tag 4) |
195 (incf depth)) | 195 (incf depth)) |
196 | 196 |
197 ((equal ch ?-) | 197 ((equal ch "-") |
198 (if (looking-at "->") | 198 (if (looking-at "->") |
199 (setq finished (= depth 0)))) | 199 (setq finished (= depth 0)))) |
200 | 200 |
201 ((and (= depth 0) | 201 ((and (= depth 0) |
202 (not (looking-at "<xml")) ;; ignore <xml/> | 202 (not (looking-at "<xml")) ;; ignore <xml/> |
203 (eq font-lock-tag-face | 203 (let ((face (get-text-property (point) 'face))) |
204 (get-text-property (point) 'face))) | 204 (funcall (if (listp face) #'member #'equal) 'font-lock-tag-face face))) |
205 ;; previous code was highlighted as tag, seems we are in xml | 205 ;; previous code was highlighted as tag, seems we are in xml |
206 (progn | 206 (progn |
207 (setq answer t) | 207 (setq answer t) |
208 (setq finished t))) | 208 (setq finished t))) |
209 | 209 |
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 |