Skip to content

Commit 25dc733

Browse files
committed
Added flymake-phpcs support.
1 parent ca93db3 commit 25dc733

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

drupal-mode.el

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ mode-hook, i.e.
331331
(eval-after-load 'etags '(require 'drupal/etags))
332332
(eval-after-load 'gtags '(require 'drupal/gtags))
333333
(eval-after-load 'ispell '(require 'drupal/ispell))
334+
(eval-after-load 'flymake-phpcs '(require 'drupal/flymake-phpcs))
334335

335336

336337

drupal/flymake-phpcs.el

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
;;; drupal/flymake-phpcs.el --- Drupal-mode support for flymake-phpcs
2+
3+
;;; Commentary:
4+
5+
;; Enable drupal-mode support for flymake-phpcs.
6+
7+
;;; Code:
8+
9+
(defun drupal/flymake-phpcs-enable ()
10+
"Enable drupal-mode support for flymake-phpcs."
11+
(when (and (executable-find flymake-phpcs-command)
12+
(ignore-errors
13+
(string-match
14+
"Drupal"
15+
(with-output-to-string
16+
(with-current-buffer standard-output
17+
(call-process (executable-find flymake-phpcs-command) nil (list t nil) nil "-i"))))))
18+
(set (make-local-variable 'flymake-phpcs-standard) "Drupal")
19+
;; We have probably set `flymake-phpcs-standard' after a syntax
20+
;; check was initiated - so kill it and start syntax check again.
21+
(flymake-stop-all-syntax-checks)
22+
(flymake-start-syntax-check)))
23+
24+
(add-hook 'drupal-mode-hook 'drupal/flymake-phpcs-enable)
25+
26+
27+
28+
(provide 'drupal/flymake-phpcs)
29+
30+
;;; drupal/flymake-phpcs.el ends here

0 commit comments

Comments
 (0)