有没有当Emacs窗口被聚焦时可调的函数

有没有当Emacs窗口被聚焦时可调的函数

这时Emacs窗口被聚焦是指系统的切换窗口,而不是Emacs 原本的window

focus-in-hook ? 不确定是不是你想要的效果你可以试下

focus-in-hook函数在 27.1obsolete

after-focus-change-function is a variable defined in frame.el.gz.

Documentation
Function called after frame focus may have changed.

This function is called with no arguments when Emacs notices that
the set of focused frames may have changed.  Code wanting to do
something when frame focus changes should use add-function to
add a function to this one, and in this added function, re-scan
the set of focused frames, calling frame-focus-state to
retrieve the last known focus state of each frame.  Focus events
are delivered asynchronously, and frame input focus according to
an external system may not correspond to the notion of the Emacs
selected frame.  Multiple frames may appear to have input focus
simultaneously due to focus event delivery differences, the
presence of multiple Emacs terminals, and other factors, and code
should be robust in the face of this situation.
1 个赞

那你就看看新版的名字是啥呗(楼上已经给出了