branch: elpa/drupal-mode
commit 25dc7333d95bd05f48f732a18b9baf49520203f9
Author: Arne Jørgensen <[email protected]>
Commit: Arne Jørgensen <[email protected]>

    Added flymake-phpcs support.
---
 drupal-mode.el          |  1 +
 drupal/flymake-phpcs.el | 30 ++++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/drupal-mode.el b/drupal-mode.el
index 2e87826aa0..fb2e70e0ff 100644
--- a/drupal-mode.el
+++ b/drupal-mode.el
@@ -331,6 +331,7 @@ mode-hook, i.e.
 (eval-after-load 'etags '(require 'drupal/etags))
 (eval-after-load 'gtags '(require 'drupal/gtags))
 (eval-after-load 'ispell '(require 'drupal/ispell))
+(eval-after-load 'flymake-phpcs '(require 'drupal/flymake-phpcs))
 
 
 
diff --git a/drupal/flymake-phpcs.el b/drupal/flymake-phpcs.el
new file mode 100644
index 0000000000..a0eec709bb
--- /dev/null
+++ b/drupal/flymake-phpcs.el
@@ -0,0 +1,30 @@
+;;; drupal/flymake-phpcs.el --- Drupal-mode support for flymake-phpcs
+
+;;; Commentary:
+
+;; Enable drupal-mode support for flymake-phpcs.
+
+;;; Code:
+
+(defun drupal/flymake-phpcs-enable ()
+  "Enable drupal-mode support for flymake-phpcs."
+  (when (and (executable-find flymake-phpcs-command)
+            (ignore-errors
+              (string-match
+               "Drupal"
+               (with-output-to-string
+                 (with-current-buffer standard-output
+                   (call-process (executable-find flymake-phpcs-command) nil 
(list t nil) nil "-i"))))))
+    (set (make-local-variable 'flymake-phpcs-standard) "Drupal")
+    ;; We have probably set `flymake-phpcs-standard' after a syntax
+    ;; check was initiated - so kill it and start syntax check again.
+    (flymake-stop-all-syntax-checks)
+    (flymake-start-syntax-check)))
+
+(add-hook 'drupal-mode-hook 'drupal/flymake-phpcs-enable)
+
+
+
+(provide 'drupal/flymake-phpcs)
+
+;;; drupal/flymake-phpcs.el ends here

Reply via email to