branch: elpa/aidermacs
commit 9e00fea9479593e74ee8de88515cd2f561814bd0
Merge: 1b4357383b 302a10f03c
Author: Kang Tu <tni...@gmail.com>
Commit: GitHub <nore...@github.com>

    Merge pull request #48 from tninja/kang_bug_fix
    
    fix(command): handle file paths containing spaces
---
 aider.el            | 8 ++++++--
 tests/test dir/a.kt | 1 +
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/aider.el b/aider.el
index fb5866a351..db95ce5835 100644
--- a/aider.el
+++ b/aider.el
@@ -292,8 +292,12 @@ COMMAND should be a string representing the command to 
send."
   ;; Ensure the current buffer is associated with a file
   (if (not buffer-file-name)
       (message "Current buffer is not associated with a file.")
-    (let ((command (format "%s %s" command-prefix
-                           (file-local-name (expand-file-name 
buffer-file-name)))))
+    (let* ((local-name (file-local-name
+                       (expand-file-name buffer-file-name)))
+           (formatted-path (if (string-match-p " " local-name)
+                             (format "\"%s\"" local-name)
+                           local-name))
+           (command (format "%s %s" command-prefix formatted-path)))
       ;; Use the shared helper function to send the command
       (aider--send-command command))))
 
diff --git a/tests/test dir/a.kt b/tests/test dir/a.kt
new file mode 100644
index 0000000000..9ce06a81ea
--- /dev/null
+++ b/tests/test dir/a.kt       
@@ -0,0 +1 @@
+# dummy

Reply via email to