branch: master
commit 870112e282d180f1061b6dd640eb5ab874bcb370
Author: Oleh Krehel <[email protected]>
Commit: Oleh Krehel <[email protected]>

    counsel.el (counsel-ag-function): Use sync on remote
    
    Apparently, `start-process-shell-command' does not work transparently
    with remote `default-directory', like `shell-command-to-string' does.
    
    Fixes #669
---
 counsel.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/counsel.el b/counsel.el
index d41c3c5..1708753 100644
--- a/counsel.el
+++ b/counsel.el
@@ -1606,8 +1606,10 @@ If non-nil, EXTRA-AG-ARGS string is appended to 
`counsel-ag-base-command'."
                             (concat extra-ag-args
                                     " -- "
                                     (shell-quote-argument regex)))))
-        (counsel--async-command ag-cmd))
-      nil)))
+        (if (file-remote-p default-directory)
+            (split-string (shell-command-to-string ag-cmd) "\n" t)
+          (counsel--async-command ag-cmd)
+          nil)))))
 
 ;;;###autoload
 (defun counsel-ag (&optional initial-input initial-directory extra-ag-args 
ag-prompt)

Reply via email to