当前位置: 动力学知识库 > 问答 > 编程问答 >

emacs - 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

网友答案:

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

(while (progn
     (accept-process-output proc 5)
     (null python-preoutput-result)))
网友答案:

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: