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

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

[nongnu] elpa/drupal-mode ec024f1e2a 148/308: `drupal/phpcs-dont-show-tr


From: ELPA Syncer
Subject: [nongnu] elpa/drupal-mode ec024f1e2a 148/308: `drupal/phpcs-dont-show-trailing-whitespace` common to flycheck and flymake.
Date: Tue, 25 Jan 2022 10:59:40 -0500 (EST)

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

    `drupal/phpcs-dont-show-trailing-whitespace` common to flycheck and flymake.
---
 drupal/flycheck.el      | 14 +-------------
 drupal/flymake-phpcs.el | 13 ++-----------
 drupal/phpcs.el         | 16 ++++++++++++++++
 3 files changed, 19 insertions(+), 24 deletions(-)

diff --git a/drupal/flycheck.el b/drupal/flycheck.el
index 0cc0d214e7..1aef618e9e 100644
--- a/drupal/flycheck.el
+++ b/drupal/flycheck.el
@@ -27,15 +27,6 @@
 
 (require 'drupal/phpcs)
 
-(defcustom drupal/flycheck-phpcs-dont-show-trailing-whitespace t
-  "Non-nil means don't highlight trailing whitespace when flycheck-phpcs is in 
use.
-Flycheck-phpcs will also highlight trailing whitespace as an error
-so no need to highlight it twice."
-  :type `(choice
-          (const :tag "Yes" t)
-          (const :tag "No" nil))
-  :group 'drupal)
-
 (defcustom drupal/flycheck-phpcs-js-and-css t
   "When Non-nil, override Flycheck to use PHPCS for checking CSS and 
JavaScript files instead of the checkers configured for css-mode and js-mode."
   :type `(choice
@@ -53,10 +44,7 @@ so no need to highlight it twice."
 
     ;; Flycheck will also highlight trailing whitespace as an
     ;; error so no need to highlight it twice.
-    (when drupal/flycheck-phpcs-dont-show-trailing-whitespace
-      (setq show-trailing-whitespace nil))
-    )
-)
+    (drupal/phpcs-dont-show-trailing-whitespace)))
 
 (add-hook 'drupal-mode-hook #'drupal/flycheck-hook)
 
diff --git a/drupal/flymake-phpcs.el b/drupal/flymake-phpcs.el
index 42e86f4420..671e3a172d 100644
--- a/drupal/flymake-phpcs.el
+++ b/drupal/flymake-phpcs.el
@@ -29,17 +29,9 @@
 (require 'flymake-phpcs)
 
 (define-obsolete-variable-alias 'drupal/flymake-phpcs-standard 
'drupal/phpcs-standard)
+(define-obsolete-variable-alias 
'drupal/flymake-phpcs-dont-show-trailing-whitespace 
'drupal/phpcs-dont-show-trailing-whitespace)
 (require 'drupal/phpcs)
 
-(defcustom drupal/flymake-phpcs-dont-show-trailing-whitespace t
-  "Non-nil means don't highlight trailing whitespace when flymake-phpcs is in 
use.
-Flymake-phpcs will also highlight trailing whitespace as an error
-so no need to highlight it twice."
-  :type `(choice 
-          (const :tag "Yes" t)
-          (const :tag "No" nil))
-  :group 'drupal)
-
 (defun drupal/flymake-phpcs-enable ()
   "Enable drupal-mode support for flymake-phpcs."
   (when (and (apply 'derived-mode-p (append drupal-php-modes drupal-css-modes 
drupal-js-modes))
@@ -51,8 +43,7 @@ so no need to highlight it twice."
 
     ;; Flymake-phpcs will also highlight trailing whitespace as an
     ;; error so no need to highlight it twice.
-    (when drupal/flymake-phpcs-dont-show-trailing-whitespace
-      (setq show-trailing-whitespace nil))
+    (drupal/phpcs-dont-show-trailing-whitespace)
 
     ;; This is a php-mode file so add the extension to a buffer locale
     ;; version of `flymake-allowed-file-name-masks' and make
diff --git a/drupal/phpcs.el b/drupal/phpcs.el
index 21b35db7b1..a83c2b024c 100644
--- a/drupal/phpcs.el
+++ b/drupal/phpcs.el
@@ -48,6 +48,22 @@ a standard. Adding file name requires PHP CodeSniffer version
 
 
 
+(defcustom drupal/phpcs-dont-show-trailing-whitespace t
+  "Non-nil means don't highlight trailing whitespace when Drupal Coder Sniffer 
is in use.
+Phpcs will also highlight trailing whitespace as an error so no
+need to highlight it twice."
+  :type `(choice
+          (const :tag "Yes" t)
+          (const :tag "No" nil))
+  :group 'drupal)
+
+(defun drupal/phpcs-dont-show-trailing-whitespace ()
+  "Turn of various trailing white space highlighting."
+  (when drupal/phpcs-dont-show-trailing-whitespace
+    (when (boundp 'whitespace-style)
+      (set (make-local-variable 'whitespace-style) (remove 'trailing 
whitespace-style)))
+    (setq show-trailing-whitespace nil)))
+
 (provide 'drupal/phpcs)
 
 ;;; drupal/phpcs.el ends here



reply via email to

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