File tree Expand file tree Collapse file tree 3 files changed +19
-24
lines changed
Expand file tree Collapse file tree 3 files changed +19
-24
lines changed Original file line number Diff line number Diff line change 2727
2828(require 'drupal/phpcs )
2929
30- (defcustom drupal/flycheck-phpcs-dont-show-trailing-whitespace t
31- " Non-nil means don't highlight trailing whitespace when flycheck-phpcs is in use.
32- Flycheck-phpcs will also highlight trailing whitespace as an error
33- so no need to highlight it twice."
34- :type `(choice
35- (const :tag " Yes" t )
36- (const :tag " No" nil ))
37- :group 'drupal )
38-
3930(defcustom drupal/flycheck-phpcs-js-and-css t
4031 " 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."
4132 :type `(choice
@@ -53,10 +44,7 @@ so no need to highlight it twice."
5344
5445 ; ; Flycheck will also highlight trailing whitespace as an
5546 ; ; error so no need to highlight it twice.
56- (when drupal/flycheck-phpcs-dont-show-trailing-whitespace
57- (setq show-trailing-whitespace nil ))
58- )
59- )
47+ (drupal/phpcs-dont-show-trailing-whitespace)))
6048
6149(add-hook 'drupal-mode-hook #'drupal/flycheck-hook )
6250
Original file line number Diff line number Diff line change 2929(require 'flymake-phpcs )
3030
3131(define-obsolete-variable-alias 'drupal/flymake-phpcs-standard 'drupal/phpcs-standard )
32+ (define-obsolete-variable-alias 'drupal/flymake-phpcs-dont-show-trailing-whitespace 'drupal/phpcs-dont-show-trailing-whitespace )
3233(require 'drupal/phpcs )
3334
34- (defcustom drupal/flymake-phpcs-dont-show-trailing-whitespace t
35- " Non-nil means don't highlight trailing whitespace when flymake-phpcs is in use.
36- Flymake-phpcs will also highlight trailing whitespace as an error
37- so no need to highlight it twice."
38- :type `(choice
39- (const :tag " Yes" t )
40- (const :tag " No" nil ))
41- :group 'drupal )
42-
4335(defun drupal/flymake-phpcs-enable ()
4436 " Enable drupal-mode support for flymake-phpcs."
4537 (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."
5143
5244 ; ; Flymake-phpcs will also highlight trailing whitespace as an
5345 ; ; error so no need to highlight it twice.
54- (when drupal/flymake-phpcs-dont-show-trailing-whitespace
55- (setq show-trailing-whitespace nil ))
46+ (drupal/phpcs-dont-show-trailing-whitespace)
5647
5748 ; ; This is a php-mode file so add the extension to a buffer locale
5849 ; ; version of `flymake-allowed-file-name-masks' and make
Original file line number Diff line number Diff line change @@ -48,6 +48,22 @@ a standard. Adding file name requires PHP CodeSniffer version
4848
4949
5050
51+ (defcustom drupal/phpcs-dont-show-trailing-whitespace t
52+ " Non-nil means don't highlight trailing whitespace when Drupal Coder Sniffer is in use.
53+ Phpcs will also highlight trailing whitespace as an error so no
54+ need to highlight it twice."
55+ :type `(choice
56+ (const :tag " Yes" t )
57+ (const :tag " No" nil ))
58+ :group 'drupal )
59+
60+ (defun drupal/phpcs-dont-show-trailing-whitespace ()
61+ " Turn of various trailing white space highlighting."
62+ (when drupal/phpcs-dont-show-trailing-whitespace
63+ (when (boundp 'whitespace-style )
64+ (set (make-local-variable 'whitespace-style ) (remove 'trailing whitespace-style)))
65+ (setq show-trailing-whitespace nil )))
66+
5167(provide 'drupal/phpcs )
5268
5369; ;; drupal/phpcs.el ends here
You can’t perform that action at this time.
0 commit comments