display-time-mode显示时间后面的小数是什么意思?

红框中变化的小数是什么数据呢?

load level

display-time is an interactive autoloaded compiled Lisp function in
‘time.el’.

(display-time)

Enable display of time, load level, and mail flag in mode lines.
This display updates automatically every minute.
If ‘display-time-day-and-date’ is non-nil, the current day and date
are displayed as well.
This runs the normal hook ‘display-time-hook’ after each update.

[back]

1 个赞

Emacs can optionally display the time and system load in all mode lines. To enable this feature, type ‘M-x display-time’ or customize the option ‘display-time-mode’. The information added to the mode line looks like this:

 HH:MMPM L.LL

Here HH and MM are the hour and minute, followed always by ‘AM’ or ‘PM’. L.LL is the average number, collected for the last few minutes, of processes in the whole system that were either running or ready to run (i.e., were waiting for an available processor). (Some fields may be missing if your operating system cannot support them.) If you prefer time display in 24-hour format, set the variable ‘display-time-24hr-format’ to ‘t’.

谷歌翻译为:L.LL是最后几分钟收集的,整个系统中正在运行或准备运行(即等待可用处理器)的进程的平均数。

明白了,我的截图里面的“2.19”的意思是刚刚才发生的这个刷新的时间段内,系统中(估计应该是指Emacs系统)处于运行或就绪状态的进程的平均数量是2.19个。

1 个赞

load average。

使用 GUI Emacs 的话,把鼠标移到上面会有说明,C-h f display-time-mode 里也有说。

3 个赞

是的,看到啦。取平均值的时间间隔是下面语句定义的。 (setq display-time-interval 5)

我突然想到,这个间隔挂上display-time-hook,然后勾子触发“preview-latex”,就可以“实时”地在org中编辑文档,然后在pdf的现实buffer里面看见我编辑对pdf结果产生的变化了。

这个interval加上hook,等于提供了Emacs业务应用层面上的system tick, 自动步骤以这个interal为频率去自动轮询勾子里面的函数。好高级呀!

你可以直接run-with-timer

1 个赞

好的,我先记着这个方法。我在lisp上的编程太少了,所以对内部函数了解不多,哈哈。

怎么能把这个数字去掉呢?

(setq display-time-default-load-average nil)

貌似不生效,是我emacs版本的问题吗?

assignment to free variable `display-time-default-load-average'

emacs

GNU Emacs 26.3 (build 1, x86_64-apple-darwin17.7.0, NS appkit-1561.61 Version 10.13.6 (Build 17G11023)) of 2020-07-04

重新运行 M-x display-time 试试