   "The char that is the current quote delimiter"
   (nth 3 (syntax-ppss)))
 
-(defvar *use-real-search* nil)
-
+(defvar *use-real-search* t)
+
+;; like re-real-search-backward but searches text that is not
+;; inside comments or strings
 (defun re-real-search-backward (regexp limit errorp)
   (if *use-real-search*
-      (let ((last-point (point))
+      (let ((original-match-data (match-data))
+	    (case-fold-search t) ;; case insensitive search
+	    (orig-point (point))
+	    (last-point (point))
 	    ;; do a first search
-	    (found-point (re-search-backward regexp limit errorp)))
+	    (found-point (re-search-backward regexp limit errorp)))	
 	;; checks that we are moving to avoid loops
 	(while (and found-point
 		    (< (point) last-point)


;; script-level and global vars.
(defun search-global-vars (end)
  (re-search-forward (ojs-vars-in-buffer-regexp) end t))

;; searches only in non string and non comments 



;; function definition
(defconst *ojs-function-heading*
"^\\s-*function\\s-+\\(\\w+\\)"
"Regular expression matching the start of a function header.")

;; function arguments
