Waiting for comint-mode buffer

北战南征 提交于 2019-12-10 10:11:35

问题


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


回答1:


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

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



回答2:


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.



来源:https://stackoverflow.com/questions/11824976/waiting-for-comint-mode-buffer

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!