branch: elpa/aidermacs
commit d33f0671c08f396715a7dc331cfd6a768757eafa
Author: tninja <tni...@gmail.com>
Commit: tninja <tni...@gmail.com>

    fix(command): handle file paths containing spaces
    
    refactor: Improve file path handling and variable naming in 
aider-add-or-read-current-file
---
 aider.el | 8 ++++++--
 1 file changed, 6 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))))
 

Reply via email to