|
32 | 32 | (define-obsolete-variable-alias 'drupal/flymake-phpcs-dont-show-trailing-whitespace 'drupal/phpcs-dont-show-trailing-whitespace) |
33 | 33 | (require 'drupal/phpcs) |
34 | 34 |
|
| 35 | +;; Only available when `flymake' is the fork from |
| 36 | +;; https://github.com/illusori/emacs-flymake. |
| 37 | +(when (boundp 'flymake-run-in-place) |
| 38 | + (defcustom drupal/flymake-run-in-place t |
| 39 | + "If nil, flymake will run on copies in `temporary-file-directory' rather |
| 40 | +than the same directory as the original file. |
| 41 | +
|
| 42 | +Drupal Coder Sniffer has some sniffs that will only work if run in place. |
| 43 | +
|
| 44 | +Defaults to `t'. Set to `default' to use whatever |
| 45 | +`flymake-run-in-place' is set to. |
| 46 | +
|
| 47 | +When editing a remote file via Tramp, this flag also has the side-effect of |
| 48 | +determining whether the syntax check is run in the same place as the original |
| 49 | +file (and thus on the remote machine), or in the same place as |
| 50 | +`temporary-file-directory' (usually the local machine)." |
| 51 | + :type `(choice |
| 52 | + (const :tag "Yes" t) |
| 53 | + (const :tag "No" nil) |
| 54 | + (const :tag "Default" default)) |
| 55 | + :link '(url-link :tag "Drupal Coder Sniffer" "https://drupal.org/project/coder") |
| 56 | + :group 'drupal)) |
| 57 | + |
35 | 58 | (defun drupal/flymake-phpcs-enable () |
36 | 59 | "Enable drupal-mode support for flymake-phpcs."(interactive) |
37 | 60 | (when (and (apply 'derived-mode-p (append drupal-php-modes drupal-css-modes drupal-js-modes drupal-info-modes)) |
|
41 | 64 | ;; supported above. |
42 | 65 | (set (make-local-variable 'flymake-phpcs-standard) drupal/phpcs-standard) |
43 | 66 |
|
| 67 | + ;; Set whether flymake runs in place. |
| 68 | + (when (and (boundp 'drupal/flymake-run-in-place) |
| 69 | + (not (eq drupal/flymake-run-in-place 'default))) |
| 70 | + (set (make-local-variable 'flymake-run-in-place) drupal/flymake-run-in-place)) |
| 71 | + |
44 | 72 | ;; Flymake-phpcs will also highlight trailing whitespace as an |
45 | 73 | ;; error so no need to highlight it twice. |
46 | 74 | (drupal/phpcs-dont-show-trailing-whitespace) |
|
0 commit comments