From a1c0b723a03aef245dfe1fe3b49f874da48dec48 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Thu, 16 Oct 2008 14:17:55 -0400 Subject: Removed handling of <,> as operators, for now --- src/elisp/urweb-mode.el | 20 ++++---------------- src/elisp/urweb-move.el | 32 ++++++++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 18 deletions(-) (limited to 'src') diff --git a/src/elisp/urweb-mode.el b/src/elisp/urweb-mode.el index 308bd1af..048efcad 100644 --- a/src/elisp/urweb-mode.el +++ b/src/elisp/urweb-mode.el @@ -500,22 +500,10 @@ If anyone has a good algorithm for this..." (defun urweb-tag-matching-indent () "Seek back to a matching opener tag and get its line's indent" (save-excursion - (let ((depth 0) - (done nil)) - (while (and (not done) (search-backward ">" nil t)) - (if (save-excursion (backward-char 1) (looking-at "/")) - (when (not (search-backward "<" nil t)) - (setq done t)) - (if (search-backward "<" nil t) - (if (looking-at "" ">=" "<>" "<" "<=" "=") . 4) + ((">=" "<>" "<=" "=") . 4) (("+" "-" "^") . 6) (("/" "*" "%") . 7) (("NOT") 9))) @@ -223,6 +223,22 @@ This assumes that we are `looking-at' the OP." (t sym))))))) +(defun urweb-tag-matcher () + "Seek back to a matching opener tag" + (let ((depth 0) + (done nil)) + (while (and (not done) (search-backward ">" nil t)) + (if (save-excursion (backward-char 1) (looking-at "/")) + (when (not (search-backward "<" nil t)) + (setq done t)) + (if (search-backward "<" nil t) + (if (looking-at "")) + (backward-char 6) + (urweb-tag-matcher) + (backward-char 1) + (urweb-backward-sexp prec)) ((not op) (let ((point (point))) (ignore-errors (let ((forward-sexp-function nil)) (backward-sexp 1))) @@ -256,6 +278,11 @@ PREC is the precedence currently looked for." ;; this reproduces the usual backward-sexp, but it might be bogus ;; in this case since !@$% is a perfectly fine symbol (t t))))) ;(or (string-match "\\sw" op) (urweb-backward-sexp prec)) +;; (when (save-excursion (backward-char 5) (looking-at "")) +;; (backward-char 5) +;; (urweb-tag-matcher) +;; (backward-char) +;; (urweb-backward-sexp prec))) (defun urweb-forward-sexp (prec) "Moves one sexp forward if possible, or one char else. @@ -307,6 +334,7 @@ Returns T if the move indeed moved through one sexp and NIL if not." (goto-char point) (error "Containing expression ends prematurely"))))))) + (defun urweb-user-forward-sexp (&optional count) "Like `forward-sexp' but tailored to the Ur/Web syntax." (interactive "p") @@ -323,7 +351,7 @@ Returns T if the move indeed moved through one sexp and NIL if not." ;;(defun urweb-forward-thing () ;; (if (= ?w (char-syntax (char-after))) (forward-word 1) (forward-char 1))) -(defun urweb-backward-arg () (urweb-backward-sexp 1000)) +(defun urweb-backward-arg () (interactive) (urweb-backward-sexp 1000)) (defun urweb-forward-arg () (urweb-forward-sexp 1000)) -- cgit v1.2.3