   :keymap
 	'(("\C-crf" . opac3-run-phpunit-filtered-function)
 		("\C-crc" . opac3-run-phpunit-filtered-file)
+		("\C-crm" . opac3-run-phpunit-filtered-custom)
 		("\C-cra" . opac3-run-phpunit)
-		("\C-crd" . opac3-debug-phpunit-function)))
-
-;;(add-to-list 'auto-mode-alist  '("\\.php[34]?\\'\\|\\.phtml\\'" . opac3-mode))
+		("\C-crd" . opac3-debug-phpunit-function))
+	:after-hook 'opac3-mode-hook)
 
 (provide 'opac3)

		(if debug (progn (geben 1) 
										 (window-configuration-to-register 'g)
										 (add-to-list 'compilation-finish-functions 'opac3-stop-geben)
										 (beginning-of-line)
										 (insert "xdebug_break();")
										 (indent-according-to-mode)
										 (align-newline-and-indent)
										 (previous-line)
										 (beginning-of-line)
										 (save-buffer)
										 )
			)

;;; opac3.el --- Minor PHP mode for programming AFI-OPAC2

;; Copyright (C) 2012 Free Software Foundation, Inc.
;;
;; Author: Laurent Laffont <llaffont@afi-sa.fr>
;; Maintainer: Laurent Laffont <llaffont@afi-sa.fr>
;; Created: 6 Aug 2012
;; Version: 0.01
;; Keywords: languages, tools

;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 2, or (at your option)
;; any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

;; Depends on: Geben, Php-mode, phpunit-mode
;;
;; Example of .emacs setup :
;;
;; (require 'php-mode)
;; (add-to-list 'auto-mode-alist  '("\\.php[34]?\\'\\|\\.phtml\\'" . php-mode))
;; (defun my-php-mode() 
;; 	(autoload 'opac3-mode "opac3" "OPAC3 mode")
;; 	(opac3-mode)
;; )
;; (add-hook 'php-mode-hook 'my-php-mode) 

(defvar opac3-phpunit-config "~/dev/afi/afi-opac3/tests/phpunit.xml" "phpunit.xml path")


(setq opac3-mode-hook '(opac3-php-mode))
(defun opac3-php-mode()
	(require 'geben)
	(require 'phpunit)
  (setq 
	 tab-width 2
   indent-tabs-mode t
	 flymake-mode t
	 compilation-error-regexp-alist  '(	("^\\(/.*\\):\\([0-9]+\\)$" 1 2)
																			("^.* \\(/.*\\):\\([0-9]+\\)" 1 2)
																			("PHP\s+[0-9]+\. [^/]* \\([^:]+\\):\\([0-9]+\\)" 1 2)
																			("in \\(/.*\\) on line \\([0-9]+\\)" 1 2) ) 
	 geben-pause-at-entry-line nil)
	)


(defun opac3-stop-geben (buffer msg)
	(geben-end 'geben-dbgp-default-port)
	(jump-to-register 'g)
	(setq compilation-finish-functions '())
	;; (beginning-of-line)
	;; (kill-line)
	;; (kill-line)
	(save-buffer)
	)

