Skip to content

Commit 5ac9531

Browse files
committed
Added default to run flymake in place.
1 parent 430b045 commit 5ac9531

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

drupal/flymake-phpcs.el

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,29 @@
3232
(define-obsolete-variable-alias 'drupal/flymake-phpcs-dont-show-trailing-whitespace 'drupal/phpcs-dont-show-trailing-whitespace)
3333
(require 'drupal/phpcs)
3434

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+
3558
(defun drupal/flymake-phpcs-enable ()
3659
"Enable drupal-mode support for flymake-phpcs."(interactive)
3760
(when (and (apply 'derived-mode-p (append drupal-php-modes drupal-css-modes drupal-js-modes drupal-info-modes))
@@ -41,6 +64,11 @@
4164
;; supported above.
4265
(set (make-local-variable 'flymake-phpcs-standard) drupal/phpcs-standard)
4366

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+
4472
;; Flymake-phpcs will also highlight trailing whitespace as an
4573
;; error so no need to highlight it twice.
4674
(drupal/phpcs-dont-show-trailing-whitespace)

0 commit comments

Comments
 (0)