   ;; list of font-lock-keywords in the right order
 
   ;; Functions defined in buffers
-;;  (push (cons 'search-buffer-functions font-lock-function-name-face) font-locks)
-  (push (list 'search-buffer-functions 1 font-lock-function-name-face) font-locks)
+  
+  (push (list 'search-pjs-current-namespace-functions 1 font-lock-function-name-face) font-locks)
 
   ;; Kernel functions
   (push (cons 'search-pjs-kernel-functions pjs-kernel-functions-face) font-locks)

;;;; * pjs mode
;;;;  (header added automatically)
;;;;
;; constants
(defconst pjs-font-lock-constants
  (js--regexp-opt-symbol

(defconst *pjs-symbols*
  "#[[:alnum:]-_]+#")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; highlight namespace functions (current and other namespaces) 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(defvar *pjs-namespace-functions-cache* nil)

(defvar *pjs-namespace-functions-present* t)

(defun list-pjs-namespace-functions ()
  (cond (*pjs-namespace-functions-cache*
	 *pjs-namespace-functions-cache*)
	(*pjs-namespace-functions-present*
	 (setq *pjs-namespace-functions-present* (when (fi::lep-open-connection-p) (fi:eval-in-lisp "(if (fboundp 'jvs::get-all-namespace-members) t nil)")))
	 (when *pjs-namespace-functions-present*
	   (setq *pjs-namespace-functions-cache* (make-hash-table :test 'equal))
	   (dolist (ns (fi:eval-in-lisp "(jvs::get-all-namespace-members)"))
	     (puthash (car ns) (js--regexp-opt-symbol (second (cdr ns))) *pjs-namespace-functions-cache*))		  
	   *pjs-namespace-functions-cache*))
	(t
	 nil)))

(defun search-pjs-current-namespace-functions (end)
  (let* ((namespace (pjs-current-namespace))
	 (functions (list-pjs-namespace-functions))
	 (ns-functions (when functions (gethash (upcase namespace) functions))))
    (re-real-search-forward (format "\\(?:%s\\.\\)?%s" namespace ns-functions) end t)))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; highlight kernel functions 
