emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/drupal-mode b34cc6fb8f 042/308: Ensured flymake-phpcs is r


From: ELPA Syncer
Subject: [nongnu] elpa/drupal-mode b34cc6fb8f 042/308: Ensured flymake-phpcs is run in php-mode buffers.
Date: Tue, 25 Jan 2022 10:59:13 -0500 (EST)

branch: elpa/drupal-mode
commit b34cc6fb8f55cb43adbcce81e05011de7a162d08
Author: Arne Jørgensen <arne@arnested.dk>
Commit: Arne Jørgensen <arne@arnested.dk>

    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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]