 
 (defun search-buffer-functions (end)
   (let ((search-pattern (ojs-functions-in-buffers-regexp)))
-    (re-search-forward search-pattern end t)))
+    (re-real-search-forward search-pattern end t)))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; highlight kernel functions 

			(er--point-is-in-string-p)))
	  (setq last-point found-point)
	  (setq found-point (re-search-backward regexp limit errorp)))
	found-point))
  (re-search-backward regexp limit errorp))

(defun re-real-search-forward (regexp limit errorp)
  (if *use-real-search*
      (let ((last-point (point))
	    ;; do a first search
	    (found-point (re-search-forward regexp limit errorp)))
	;; checks that we are moving to avoid loops

				    ;; return nil when we have a scan error
				    (scan-error nil))
				  ;; try to find a lonely }, search only until the next start of function
				  (re-real-search-forward "^}$" (save-excursion (or (when (re-real-search-forward *ojs-function-start-regexp* nil t)
										 (line-beginning-position))
									       (point-max)))
						     t)
