gpt4 book ai didi

Emacs 口齿不清 : make newly-created buffer visible before the function returns?

转载 作者:太空宇宙 更新时间:2023-11-03 18:37:19 24 4
gpt4 key购买 nike

在 emacs Lisp 中的以下函数中,

(defun show-life ()
(interactive)
(switch-to-buffer "*Life-Window*") ; show how life goes on while living
(live)) ; it takes 70 years to finish and return!

我想创建缓冲区“Life-Window”,并在直播进行时连续显示 (live) 生成的生活事件。

不幸的是,缓冲区只有在(实时)返回后(当它结束时!)才可见

我也试过 pop-to-buffer,行为是一样的。

最佳答案

在调用 'live 之前添加对 'sit-for 的调用,例如

(defun show-life ()
(interactive)
(switch-to-buffer "*Life-Window*") ; show how life goes on while living
(sit-for 0) ; perform redisplay
(live)) ; it takes 70 years to finish and return!

而且,如果您想查看'live 的结果,它也应该定期调用'sit-for

'sit-for 的文档字符串是:

sit-for is a compiled Lisp function in `subr.el'. (sit-for seconds &optional nodisp)

Perform redisplay, then wait for seconds seconds or until input is available. seconds may be a floating-point value. (On operating systems that do not support waiting for fractions of a second, floating-point values are rounded down to the nearest integer.)

If optional arg nodisp is t, don't redisplay, just wait for input. Redisplay does not happen if input is available before it starts.

Value is t if waited the full time with no input arriving, and nil otherwise.

关于Emacs 口齿不清 : make newly-created buffer visible before the function returns?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1021523/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com