Mercurial > hg > xemacs
diff xquery-mode.el @ 21:7b2c4ed36302
for new maritain
author | ht |
---|---|
date | Mon, 30 Nov 2020 16:00:15 +0000 |
parents | 75ab6d7af627 |
children |
line wrap: on
line diff
--- a/xquery-mode.el Mon Nov 30 15:42:47 2020 +0000 +++ b/xquery-mode.el Mon Nov 30 16:00:15 2020 +0000 @@ -59,8 +59,8 @@ (1 font-lock-type-face) ) ) ;font-lock-list - '(".xq\\'") ;auto-mode-list - nil ;function list + '(".xq[ml]?$") ;auto-mode-list + '(xquery-set-indent-function xquery-set-up-syntax-table) ;function list "A Major mode for editing xquery." ) @@ -73,7 +73,7 @@ (set (make-local-variable 'indent-line-function) 'xquery-indent-line) (make-local-variable 'forward-sexp-function) (setq forward-sexp-function 'xquery-forward-sexp) - (local-set-key "/" 'nxml-electric-slash) + ;;(local-set-key "/" 'nxml-electric-slash) ) (defun xquery-forward-sexp (&optional arg) @@ -102,12 +102,12 @@ (modify-syntax-entry ?\} "){" (syntax-table)) (modify-syntax-entry ?\[ "(]" (syntax-table)) (modify-syntax-entry ?\] ")]" (syntax-table)) - (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 ?\) ")(4" (syntax-table)) -;; (modify-syntax-entry ?\: ".23" (syntax-table)) + ;;(modify-syntax-entry ?\< "(>" (syntax-table)) + ;;(modify-syntax-entry ?\> ")<" (syntax-table)) + ;; xquery comments are like (: :) -- handled above at mode decl + ;;(modify-syntax-entry ?\: ".23" (syntax-table)) ) @@ -220,6 +220,39 @@ (save-excursion (xquery-previous-non-empty-line) (current-indentation))) ))) +(when (featurep 'xemacs) + (unless (functionp 'looking-back) + ;; from GNU Emacs subr.el + (defun looking-back (regexp &optional limit greedy) + "Return non-nil if text before point matches regular expression +REGEXP. + Like `looking-at' except matches before point, and is slower. + LIMIT if non-nil speeds up the search by specifying a minimum + starting position, to avoid checking matches that would start + before LIMIT. + If GREEDY is non-nil, extend the match backwards as far as possible, + stopping when a single additional previous character cannot be part + of a match for REGEXP." + (let ((start (point)) + (pos + (save-excursion + (and (re-search-backward (concat "\\(?:" regexp +"\\)\\=") limit t) + (point))))) + (if (and greedy pos) + (save-restriction + (narrow-to-region (point-min) start) + (while (and (> pos (point-min)) + (save-excursion + (goto-char pos) + (backward-char 1) + (looking-at (concat "\\(?:" regexp +"\\)\\'")))) + (setq pos (1- pos))) + (save-excursion + (goto-char pos) + (looking-at (concat "\\(?:" regexp "\\)\\'"))))) + (not (null pos)))))) (defun xquery-previous-non-empty-line () "Move to the last non-empty line."