 (ac-define-source "ojs-methods"
     '((candidates . ojs-methods-ac-candidates)
       (document . ojs-methods-ac-document)
+      (action . ojs-methods-ac-action)
       (symbol . "m")
       (requires . -1)))
+
+(defun ojs-methods-ac-action ()
+  (message (ojs-methods-ac-document candidate)))
 
 (defun ojs-methods-ac-document (symbol)
   (or 

;;;;; it stores the documentation in the symbol 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun ojs-find-candidates-from-regexp (regexp doc)
  (let ((point (point))
	(prefix "")
	(limit 10)
	(i 0)
	candidate
	candidates
	)
    (save-excursion
      ;; Search backward
      (goto-char point)
      (while (and (or (not (integerp limit)) (< i limit))
		  (re-search-backward regexp nil t))
	(setq candidate (match-string-no-properties 1))
	(unless (member candidate candidates)
	  (when (and doc candidate)
	    (put (intern candidate) :document (match-string-no-properties 0)))
	  (push candidate candidates)
	  (incf i)))
      ;; Search forward
      (goto-char (+ point (length prefix)))
      (while (and (or (not (integerp limit)) (< i limit))
		  (re-search-forward regexp nil t))
	(setq candidate (match-string-no-properties 1))
	(unless (member candidate candidates)
	  (when (and doc candidate)
	    (put (intern candidate) :document (match-string-no-properties 0)))
	  (push candidate candidates)
	  (incf i)))
      ;;(message "%s" candidates)
      (nreverse candidates))))

;;;;; configuration of the hook

(ac-define-source "ojs-kernel"
  '((candidates . ojs-kernel-ac-candidates)
    (document . ojs-kernel-ac-document)
    (action . ojs-kernel-ac-action)
    (symbol . "k")
    (requires . -1)))

(defun ojs-kernel-ac-action ()
  (message (ojs-kernel-ac-document candidate)))

(defvar *ojs-kernel-candidates-cache* nil)
(defvar *ojs-kernel-documents-cache* nil)
