branch: elpa/drupal-mode
commit b34cc6fb8f55cb43adbcce81e05011de7a162d08
Author: Arne Jørgensen <[email protected]>
Commit: Arne Jørgensen <[email protected]>
Ensured flymake-phpcs is run in php-mode buffers.
Made sure flymake-phpcs will run in a Drupal mode php-mode buffer no
matter what extension it has and how `flymake-allowed-file-name-masks'
is defined.
Maybe a bit silly to do this buffer locally but this ensures:
* We don't have to maintain a list of allowed masks for Drupal
php-buffers here.
* We won't mess up other buffers with same extension (think a very
generic extension like .theme and a non-Drupal file).
---
drupal/flymake-phpcs.el | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drupal/flymake-phpcs.el b/drupal/flymake-phpcs.el
index 6eaee99b2d..a8ac52af74 100644
--- a/drupal/flymake-phpcs.el
+++ b/drupal/flymake-phpcs.el
@@ -16,7 +16,17 @@
(with-output-to-string
(with-current-buffer standard-output
(call-process (executable-find flymake-phpcs-command) nil
(list t nil) nil "-i"))))))
+ ;; Set the coding standard to "Drupal" (we checked that it is
+ ;; supported above.
(set (make-local-variable 'flymake-phpcs-standard) "Drupal")
+
+ ;; This is a php-mode file so add the extension to a buffer locale
+ ;; version of `flymake-allowed-file-name-masks' and make
+ ;; flymake-phpcs initialize.
+ (make-local-variable 'flymake-allowed-file-name-masks)
+ (add-to-list 'flymake-allowed-file-name-masks
+ `(,(concat "\\." (file-name-extension (buffer-file-name))
"\\'") flymake-phpcs-init))
+
;; 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)