add xquery-mode
[emacs-init.git] / auto-install / xquery-mode.el
index edec052..2d796d9 100644 (file)
@@ -23,7 +23,7 @@
 ;; Boston, MA 02111-1307, USA.
 
 ;;; Commentary:
-;;; 
+;;;
 
 (require 'nxml-mode)
 
   '("xquery" "version" "encoding" "at" "module" "namespace" "child" "descendant" "parent" "attribute" "self" "descendant-or-self" "ancestor" "following-sibling" "preceding-sibling" "following" "preceding" "ancestor-or-self" "declare" "function" "option" "ordering" "ordered" "unordered" "default" "order" "external" "or" "and" "div" "idiv" "mod" "in"  "construction" "satisfies" "return" "then" "else" "boundary-space" "base-uri" "preserve" "strip" "copy-namespaces" "no-preserve" "inherit" "no-inherit" "to" "where" "collation" "intersect" "union" "except" "as" "case" "instance" "of" "castable" "item" "element" "schema-element" "schema-attribute" "processing-instruction" "comment" "text" "empty" "import" "schema" "is" "eq" "ne" "gt" "ge" "lt" "le" "some" "every" "for" "let" "cast" "treat" "validate" "document-node" "document" "node" "if" "typeswitch" "by" "stable" "ascending" "descending" "greatest" "least" "variable") ;keywords
   '(("\\(\\$\\w+\\)" 1 font-lock-variable-name-face) ;; \\(\\s_\\|\\w\\)
     ("\\(\\w*:?\\w+\\)\\s *(" 1 font-lock-function-name-face)
-    ("\\(<\\)\\(/?\\)\\(\\w*\\)\\(:?\\)\\(\\w+\\).*?\\(/?\\)\\(>\\)" 
-     (1 'nxml-tag-delimiter-face) 
+    ("\\(<\\)\\(/?\\)\\(\\w*\\)\\(:?\\)\\(\\w+\\).*?\\(/?\\)\\(>\\)"
+     (1 'nxml-tag-delimiter-face)
      (2 'nxml-tag-slash-face)
-     (3 'nxml-element-prefix-face) 
+     (3 'nxml-element-prefix-face)
      (4 'nxml-element-colon-face)
      (5 'nxml-element-local-name-face)
      (6 'nxml-tag-slash-face)
-     (7 'nxml-tag-delimiter-face) 
+     (7 'nxml-tag-delimiter-face)
      )
-    ("\\(\\w*\\)\\(:?\\)\\(\\w+\\)=\\([\"']\\)\\(.*?\\)\\([\"']\\)" 
-     (1 'nxml-attribute-prefix-face) 
+    ("\\(\\w*\\)\\(:?\\)\\(\\w+\\)=\\([\"']\\)\\(.*?\\)\\([\"']\\)"
+     (1 'nxml-attribute-prefix-face)
      (2 'nxml-attribute-colon-face)
-     (3 'nxml-attribute-local-name-face) 
+     (3 'nxml-attribute-local-name-face)
      (4 'nxml-attribute-value-delimiter-face)
      (5 'nxml-attribute-value-face)
      (6 'nxml-attribute-value-delimiter-face))
-    ("\\(/\\)\\(\\w*\\)\\(:?\\)\\(\\w+\\)" 
+    ("\\(/\\)\\(\\w*\\)\\(:?\\)\\(\\w+\\)"
      (1 font-lock-constant-face)
-     (2 font-lock-constant-face) 
+     (2 font-lock-constant-face)
      (3 font-lock-constant-face)
      (4 font-lock-constant-face)
      )
-    ("as\\s +\\(\\w*:?\\w+\\)" 
+    ("as\\s +\\(\\w*:?\\w+\\)"
      (1 font-lock-type-face)
      )
     ) ;font-lock-list
@@ -83,7 +83,7 @@ This function is not very smart, it tries to use
 the direction you are going, and uses the regular `forward-sexp'
 otherwise. "
   (if (> arg 0)
-      (progn                                 
+      (progn
         (if (looking-at "[ \t]*<")
             (nxml-forward-balanced-item arg)
           (let ((forward-sexp-function nil)) (forward-sexp arg))))
@@ -105,7 +105,7 @@ otherwise. "
   (modify-syntax-entry ?\< "(>1" (syntax-table))
   (modify-syntax-entry ?\> ")<4" (syntax-table))
   ;; xquery comments are like (: :)
-  (modify-syntax-entry ?\( "()1" (syntax-table)) 
+  (modify-syntax-entry ?\( "()1" (syntax-table))
   (modify-syntax-entry ?\) ")(4" (syntax-table))
 ;;   (modify-syntax-entry ?\: ".23" (syntax-table))
   )
@@ -116,10 +116,10 @@ otherwise. "
   "Indent current line as xquery code."
   (interactive)
    (let ((savep (> (current-column) (current-indentation)))
-        (indent (condition-case err (max (xquery-calculate-indentation) 0)
-                  (error (message "%S" err)))))
+         (indent (condition-case err (max (xquery-calculate-indentation) 0)
+                   (error (message "%S" err)))))
      (if savep
-        (save-excursion (indent-line-to indent))
+         (save-excursion (indent-line-to indent))
        (indent-line-to indent))))
 
 (defvar xquery-start-block-regexp "[ \t]*\\((\|{\\|for\\|let\\|where\\|return\\|if\\|else\\|typeswitch\\|declare[ \t]+function\\|.*[({]$\\)"
@@ -157,7 +157,7 @@ otherwise. "
         (nxml-compute-indent)
         ))
 
-     ;; for close braces or else statements indent to the same level as the opening { 
+     ;; for close braces or else statements indent to the same level as the opening {
      ((looking-at "}")
       (if xquery-indent-debug
           (message "xquery-indent-debug: }"))
@@ -182,7 +182,7 @@ otherwise. "
       (if xquery-indent-debug
           (message "xquery-indent-debug: )"))
       (save-excursion
-        (backward-up-list) 
+        (backward-up-list)
         (if (looking-back "\\w+\\s *")
             (backward-word))
         (current-column)
@@ -193,7 +193,7 @@ otherwise. "
         (when
             (and
              (looking-at xquery-flwr-block-regexp)
-             (progn 
+             (progn
                (xquery-previous-non-empty-line)
                (beginning-of-line)
                (looking-at xquery-flwr-block-regexp)))
@@ -214,7 +214,7 @@ otherwise. "
       )
 
      ;; for everything else indent relative to the outer list
-     (t       
+     (t
       (if xquery-indent-debug
           (message "xquery-indent-debug: everyting else"))
       (save-excursion (xquery-previous-non-empty-line) (current-indentation)))