我想在 comint 启动的进程完成后读取缓冲区的输出。
(comint-redirect-send-command-to-process
command-string ;; tested to work in the commint buffer
output-buffer-name ;; random text
buffer-process ;; (get-buffer-process (current-buffer))
nil ;; don't echo input back
t) ;; don't show output buffer immediatly
此 sexp 在运行 comint 进程的缓冲区中进行评估。output-buffer-name
一旦过程完成,我想阅读所有文本。
我已尝试应用发布到此问题的解决方案:在 emacs lisp中通过在进程启动命令下方添加此解决方案:
(defun on-status-change (process status)
(message "status done"))
(set-process-sentinel buffer-process 'on-status-change)
此消息不会出现在 中*Messages*
。
输出缓冲区文本中没有提示,但我可以编写一个函数,t
根据完整的输出文本在输出完成时返回。
如何对缓冲区完成/更改做出反应,或者如何强制 comint 同步运行此功能。
源代码comint-redirect-send-command-to-process
在第 3717 行