Open alphapapa opened 6 years ago
alphapapa notifications@github.com writes:
Hi John,
I'm having a problem using rg with async-start-process: BurntSushi/ripgrep#951
Ripgrep in helm works perfecly called in an async process, see in helm-grep.el how it is called.
I don't understand what you want to do here, don't know also why you want to use async-start-process???
async-start-process
should call "emacs" only and then inside the new
emacs process, compute your code.
So it is nonsense to start an emacs async to run an async-process in it,
use instead directly start-process
from your main emacs.
I tried to bind process-connection-type around async-start-process, but it has no effect because async-start-process rebinds it to nil before calling start-process. However, when I do this, it works:
(defun argh-start-process (name program finish-func &rest program-args) "Start the executable PROGRAM asynchronously. See `async-start'. PROGRAM is passed PROGRAM-ARGS, calling FINISH-FUNC with the process object when done. If FINISH-FUNC is nil, the future object will return the process object when the program is finished. Set DEFAULT-DIRECTORY to change PROGRAM's current working directory." (let ((buf (generate-new-buffer (concat "" name "*"))) ;; NOTE: Removed let-binding of process-connection-type. (proc (apply #'start-process name buf program program-args))) (with-current-buffer buf (set (make-local-variable 'async-callback) finish-func) (set-process-sentinel proc #'async-when-done) (unless (string= name "emacs") (set (make-local-variable 'async-callback-for-process) t)) proc)))
(let ((default-directory directory) (process-connection-type 'pty)) (argh-start-process "rg-scan-async" "nice" (apply-partially #'magit-todos--rg-scan-async-callback magit-status-buffer) "-n5" "rg" "--column" magit-todos-ag-search-regexp))
Is there a reason it doesn't allow the connection type to be changed? If not, could it?
Really hard to understand what you want to achieve here...
-- Thierry
Hi John,
I'm having a problem using
rg
withasync-start-process
: https://github.com/BurntSushi/ripgrep/issues/951I tried to bind
process-connection-type
aroundasync-start-process
, but it has no effect becauseasync-start-process
rebinds it tonil
before callingstart-process
. However, when I do this, it works:Is there a reason it doesn't allow the connection type to be changed? If not, could it?
Thanks.