Skip to content
Snippets Groups Projects
Commit 3f7e6a0b authored by llaffont's avatar llaffont
Browse files

Amélioration initialisation du mode + ajout custom filter intéractif

parent 1d9443d1
No related merge requests found
;; (require 'opac3)
;; (setq 'opac3-phpunit-config "~/path/to/phpunit.xml")
(require 'php+-mode)
(php+-mode-setup)
(require 'phpunit)
;;(require 'geben)
;;; 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()
(setq tab-width 2)
(setq indent-tabs-mode t)
(setq flymake-mode t)
(custom-set-variables
'(geben-pause-at-entry-line nil))
(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)
)
(autoload 'geben "geben" "PHP Debugger on Emacs" t)
(add-hook 'php+-mode-hook 'opac3-php-mode)
(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)
;; (beginning-of-line)
;; (kill-line)
;; (kill-line)
(save-buffer)
)
......@@ -43,12 +73,12 @@
(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)
;; (beginning-of-line)
;; (insert "xdebug_break();")
;; (indent-according-to-mode)
;; (align-newline-and-indent)
;; (previous-line)
;; (beginning-of-line)
(save-buffer)
)
)
......@@ -80,6 +110,15 @@
)
(defun opac3-run-phpunit-filtered-custom(custom-filter debug)
"Prompt for a filter and run phpunit with it"
(interactive (list (read-string "Enter PHPUnit fiter: ")
(y-or-n-p "Debug ?: ")))
(opac3-compile-phpunit custom-filter debug)
)
(defun opac3-debug-phpunit-function()
"Run phpunit on this function with debugger activated"
(interactive)
......@@ -93,12 +132,6 @@
(opac3-compile-phpunit)
)
(setq compilation-error-regexp-alist
(cons
'("^\\(/.*\\):\\([0-9]+\\)$" 1 2)
'("^.* \\(/.*\\):\\([0-9]+\\)" 1 2)
))
(define-minor-mode opac3-mode
"Toggle AFI-OPAC mode."
......@@ -106,9 +139,9 @@
: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)
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment