tjarvstrand
tjarvstrand

Reputation: 1038

Waiting for comint-mode buffer

I'm trying to open a background buffer with a comint erlang-shell, and once it's up, run a call a function in emacs (using distel to send it's binaries to the erlang node).

ie:

...
(let ((args (append (list "-sname" node-name "-pa") path)))
    (get-buffer-create buffer-name)
    (apply #'make-comint-in-buffer node-name buffer-name "erl" nil args)
  (erl-check-backend (make-node-name node-name))
...

The problem is that when I call distel, the node is not yet up (epmd has no registered names) so it fails. I'm guessing this is because the inferior process has not had the chance to run yet. Is there any way to wait until the comint-buffer has finished its setup?

I tried accept-process-output on the buffer-process of the buffer sent in as argument to the function above, but that just hung.

Any help appreciated :)

Thomas

Upvotes: 3

Views: 589

Answers (2)

Andreas Röhler
Andreas Röhler

Reputation: 4804

in python.el authored by Dave Love the following was used:

(while (progn
     (accept-process-output proc 5)
     (null python-preoutput-result)))

Upvotes: 1

Andreas Röhler
Andreas Röhler

Reputation: 4804

in python-mode.el the check for an running process is done that way

(or (get-buffer-process (py-buffer-name-prepare pyshellname))
      (get-buffer-process 
          (py-shell nil dedicated pyshellname 
               switch sepchar py-buffer-name t)))))

i.e. if a Python shell doesn't exist, its start will return the process-symbol.

Upvotes: 1

Related Questions