Mercurial > urweb
comparison src/elisp/urweb-move.el @ 369:226c977faa9c
Crud indented properly, except for <xml>...</xml> outside parens and sig/struct
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 16 Oct 2008 14:40:28 -0400 |
parents | b6be16792584 |
children | 4f75cc2e1373 |
comparison
equal
deleted
inserted
replaced
368:b6be16792584 | 369:226c977faa9c |
---|---|
73 (urweb-preproc-alist | 73 (urweb-preproc-alist |
74 '((("UNION" "INTERSECT" "EXCEPT") . 0) | 74 '((("UNION" "INTERSECT" "EXCEPT") . 0) |
75 (("AND" "OR") . 1) | 75 (("AND" "OR") . 1) |
76 ((">=" "<>" "<=" "=") . 4) | 76 ((">=" "<>" "<=" "=") . 4) |
77 (("+" "-" "^") . 6) | 77 (("+" "-" "^") . 6) |
78 (("/" "*" "%") . 7) | 78 (("*" "%") . 7) |
79 (("NOT") 9))) | 79 (("NOT") 9))) |
80 "Alist of Ur/Web infix operators and their precedence.") | 80 "Alist of Ur/Web infix operators and their precedence.") |
81 | 81 |
82 (defconst urweb-syntax-prec | 82 (defconst urweb-syntax-prec |
83 (urweb-preproc-alist | 83 (urweb-preproc-alist |
248 (urweb-backward-spaces) | 248 (urweb-backward-spaces) |
249 (let* ((op (urweb-backward-sym)) | 249 (let* ((op (urweb-backward-sym)) |
250 (op-prec (urweb-op-prec op 'back)) | 250 (op-prec (urweb-op-prec op 'back)) |
251 match) | 251 match) |
252 (cond | 252 (cond |
253 ((save-excursion (backward-char 5) | |
254 (looking-at "</xml>")) | |
255 (backward-char 6) | |
256 (urweb-tag-matcher) | |
257 (backward-char 1) | |
258 (urweb-backward-sexp prec)) | |
259 ((not op) | 253 ((not op) |
260 (let ((point (point))) | 254 (let ((point (point))) |
261 (ignore-errors (let ((forward-sexp-function nil)) (backward-sexp 1))) | 255 (ignore-errors (let ((forward-sexp-function nil)) (backward-sexp 1))) |
262 (if (/= point (point)) t (ignore-errors (backward-char 1)) nil))) | 256 (if (/= point (point)) t (ignore-errors (backward-char 1)) nil))) |
263 ;; stop as soon as precedence is smaller than `prec' | 257 ;; stop as soon as precedence is smaller than `prec' |
276 ((string-match urweb-sexp-head-symbols-re op) nil) | 270 ((string-match urweb-sexp-head-symbols-re op) nil) |
277 ;; if the op was not alphanum, then we still have to do the backward-sexp | 271 ;; if the op was not alphanum, then we still have to do the backward-sexp |
278 ;; this reproduces the usual backward-sexp, but it might be bogus | 272 ;; this reproduces the usual backward-sexp, but it might be bogus |
279 ;; in this case since !@$% is a perfectly fine symbol | 273 ;; in this case since !@$% is a perfectly fine symbol |
280 (t t))))) ;(or (string-match "\\sw" op) (urweb-backward-sexp prec)) | 274 (t t))))) ;(or (string-match "\\sw" op) (urweb-backward-sexp prec)) |
281 ;; (when (save-excursion (backward-char 5) (looking-at "</xml>")) | |
282 ;; (backward-char 5) | |
283 ;; (urweb-tag-matcher) | |
284 ;; (backward-char) | |
285 ;; (urweb-backward-sexp prec))) | |
286 | 275 |
287 (defun urweb-forward-sexp (prec) | 276 (defun urweb-forward-sexp (prec) |
288 "Moves one sexp forward if possible, or one char else. | 277 "Moves one sexp forward if possible, or one char else. |
289 Returns T if the move indeed moved through one sexp and NIL if not." | 278 Returns T if the move indeed moved through one sexp and NIL if not." |
290 (let ((parse-sexp-lookup-properties t) | 279 (let ((parse-sexp-lookup-properties t) |