branch: elpa/flymake-collection commit bb089d1ccf33e638aa2e2c868327e53d6bd6001d Author: Mohsin Kaleem <mohk...@kisara.moe> Commit: Mohsin Kaleem <mohk...@kisara.moe>
(checkers): Don't presume current buffer is checking buffer Now calls to functions like buffer-file-name or default-directory first try to access those values in flymake-rest-source instead of assuming the current buffer is flymake-rest-source. --- checkers/flymake-rest-clang.el | 6 ++++-- checkers/flymake-rest-eslint.el | 2 +- checkers/flymake-rest-gcc.el | 6 ++++-- checkers/flymake-rest-luacheck.el | 2 +- checkers/flymake-rest-rubocop.el | 8 ++++++-- 5 files changed, 16 insertions(+), 8 deletions(-) diff --git a/checkers/flymake-rest-clang.el b/checkers/flymake-rest-clang.el index 304985b702..b80880c8df 100644 --- a/checkers/flymake-rest-clang.el +++ b/checkers/flymake-rest-clang.el @@ -51,9 +51,11 @@ See URL `http://clang.llvm.org/'." "-fno-color-diagnostics" ; Do not include color codes in output "-fno-caret-diagnostics" ; Do not visually indicate the source "-fno-diagnostics-show-option" ; Do not show the corresponding - "-iquote" ,(if-let ((file (buffer-file-name))) + "-iquote" ,(if-let ((file (buffer-file-name flymake-rest-source))) (file-name-directory file) - default-directory) + (or (buffer-local-value 'default-directory + flymake-rest-source) + default-directory)) ,@(cl-loop for it in flymake-rest-clang-include-path collect (concat "-I" it)) ,@flymake-rest-clang-args diff --git a/checkers/flymake-rest-eslint.el b/checkers/flymake-rest-eslint.el index a7dd3c34b6..f284690523 100644 --- a/checkers/flymake-rest-eslint.el +++ b/checkers/flymake-rest-eslint.el @@ -43,7 +43,7 @@ See URL `https://eslint.org/'." `(,eslint-exec "--format=json" "--stdin" - ,@(when-let ((file (buffer-file-name))) + ,@(when-let ((file (buffer-file-name flymake-rest-source))) (list "--stdin-filename" file))) :error-parser (flymake-rest-parse-enumerate diff --git a/checkers/flymake-rest-gcc.el b/checkers/flymake-rest-gcc.el index 783bb9e26b..bf728f3a4e 100644 --- a/checkers/flymake-rest-gcc.el +++ b/checkers/flymake-rest-gcc.el @@ -51,9 +51,11 @@ Requires GCC 4.4 or newer. See URL `https://gcc.gnu.org/'." :write-type 'pipe :command `(,gcc-exec "-fshow-column" - "-iquote" ,(if-let ((file (buffer-file-name))) + "-iquote" ,(if-let ((file (buffer-file-name flymake-rest-source))) (file-name-directory file) - default-directory) + (or (buffer-local-value 'default-directory + flymake-rest-source) + default-directory)) ,@(cl-loop for it in flymake-rest-gcc-include-path collect (concat "-I" it)) ,@flymake-rest-gcc-args diff --git a/checkers/flymake-rest-luacheck.el b/checkers/flymake-rest-luacheck.el index e2591ab587..24062b6c49 100644 --- a/checkers/flymake-rest-luacheck.el +++ b/checkers/flymake-rest-luacheck.el @@ -65,7 +65,7 @@ See URL `https://github.com/mpeterv/luacheck'." (mapconcat #'identity flymake-rest-luacheck-standards "+"))) ,@(when flymake-luacheck-rc (list "--config" flymake-luacheck-rc)) - ,@(when-let ((file (buffer-file-name))) + ,@(when-let ((file (buffer-file-name flymake-rest-source))) (list "--filename" file)) "-") :error-parser diff --git a/checkers/flymake-rest-rubocop.el b/checkers/flymake-rest-rubocop.el index 9a1c22e9f2..0cf09a3c82 100644 --- a/checkers/flymake-rest-rubocop.el +++ b/checkers/flymake-rest-rubocop.el @@ -41,13 +41,17 @@ See URL `https://github.com/rubocop/rubocop'." :title "rubocop" :pre-let ((rubocop-exec (executable-find "rubocop")) - (file-name (or (buffer-file-name) + (file-name (or (buffer-file-name flymake-rest-source) "-"))) :pre-check (unless rubocop-exec (error "Cannot find rubocop executable")) :write-type 'pipe :command `(,@(or (and flymake-rest-rubocop-use-bundler - (locate-dominating-file (buffer-file-name) "Gemfile") + (locate-dominating-file (or (buffer-file-name flymake-rest-source) + (buffer-local-value 'default-directory + flymake-rest-source) + default-directory) + "Gemfile") (if-let ((bundler-exec (executable-find "bundler"))) (list bundler-exec "exec" "rubocop") (flymake-log :warning "In bundler controlled project but bundler not installed")))