branch: scratch/editorconfig-cc
commit 77a8af8ba4cd93da97d6a7a05b4a5cabf20d9bbf
Author: 10sr <8.slas...@gmail.com>
Commit: Stefan Monnier <monn...@iro.umontreal.ca>

    Fix editorconfig execution for remote hosts via tramp (#249)
---
 editorconfig.el | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/editorconfig.el b/editorconfig.el
index 8e82c3af7c..d09329d504 100644
--- a/editorconfig.el
+++ b/editorconfig.el
@@ -443,9 +443,28 @@ If you just want to check `major-mode', use 
`derived-mode-p'."
   "Execute EditorConfig core with FILENAME and return output."
   (if filename
       (with-temp-buffer
-        (setq default-directory "/")
+        (let ((remote (file-remote-p filename))
+              (remote-localname (file-remote-p filename
+                                               'localname)))
+          (display-warning '(editorconfig 
editorconfig--execute-editorconfig-exec)
+                           (format "filename: %S | remote: %S | 
remote-localname: %S"
+                                   filename
+                                   remote
+                                   remote-localname)
+                           :debug)
+          (if remote
+              (progn
+                (cd (concat remote "/"))
+                (setq filename remote-localname))
+            (cd "/")))
+        (display-warning '(editorconfig 
editorconfig--execute-editorconfig-exec)
+                         (format "default-directory: %S | filename: %S"
+                                 default-directory
+                                 filename
+                                 )
+                         :debug)
         (if (eq 0
-                (call-process editorconfig-exec-path nil t nil filename))
+                (process-file editorconfig-exec-path nil t nil filename))
             (buffer-string)
           (editorconfig-error (buffer-string))))
     ""))

Reply via email to