如何编写一个钩子来在任何 emacs 框架抬起/聚焦时激活?

发布于 2024-09-24 19:24:45 字数 229 浏览 0 评论 0原文

在 Win32 下,当按 Alt 键时,每个 emacs 框架都会显示为不同的窗口,这是有道理的。但是,当我选择主编辑窗口时,我还希望速度栏框架随之自动升起。

编写一个函数来引发所有帧(甚至所有当前不可见的帧)相对简单,但我无法弄清楚要使用的钩子,或者实际上是否有一个可以使用的钩子。

因此,如果我单击或使用 alt-tab 切换到任何 emacs 框架,则应运行一个挂钩来调用引发所有框架的函数。有什么帮助吗?

Under Win32, each emacs frame shows up as a different window when Alt-tabbing, which makes sense. However, when I select my main editing window, I'd also like my speedbar frame to auto-raise along with it.

Writing a function to raise all frames (or even all currently NOT visible frames) is relatively trivial, but I can't figure out hook to use, or indeed if there's even a hook that's possible to use at all.

So, if I click or alt-tab to any of my emacs frames, a hook should be run to call my function that raises ALL frames. Any help?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

梦太阳 2024-10-01 19:24:45

GNU emacs 似乎没有任何这样的功能。

Xemacs 有 select-frame-hook 和 map-frame-hook。还有变量 auto-raise-frame,但是 GNU emacs 中没有。

请参阅http://www.xemacs.org/Documentation/beta/html如果您想改进 emacs,请 /lispref_40.html#SEC526 获取一些想法。

It doesn't seem that GNU emacs has any such functionality.

Xemacs has select-frame-hook and map-frame-hook. There is also the variable auto-raise-frame, but, not in GNU emacs.

See http://www.xemacs.org/Documentation/beta/html/lispref_40.html#SEC526 for some ideas if you feel like improving emacs.

愛上了 2024-10-01 19:24:45

我在 GNU Emacs 中能找到的最接近的是 switch-frame 事件,但它仅在聚焦不同的 Emacs 框架时生成,而不是在切换到非 Emacs 窗口然后返回到相同窗口时生成框架。

这是一个足够好的窗口管理器应该做的事情,需要 Emacs 的一些配合(例如使用窗口标题来确定速度栏框架是什么)。

在 Windows 下,您应该能够使用 AutoHotKeyWinWaitActive 命令。

The closest I can find in GNU Emacs is the switch-frame event, but it's only generated when a different Emacs frame is focused, not when you switch to a non-Emacs window and then back to the same frame.

This is the sort of things that a good enough window manager should do, with a bit of cooperation from Emacs (for example using window titles to figure out what the speedbar frame is).

Under Windows, you should be able to use AutoHotKey's WinWaitActive command.

定格我的天空 2024-10-01 19:24:45

我找到了一个你可以使用的钩子。

server-visit-hook is a variable defined in `server.el'.
Original value was nil

Documentation:
Hook run when visiting a file for the Emacs server.

You can customize this variable.

当你用 Emacs server 或 emacsclient 找到一个文件时,
该钩子将被调用。你可以使用这个钩子来做一些需要的事情。

I found a hook you can use with.

server-visit-hook is a variable defined in `server.el'.
Original value was nil

Documentation:
Hook run when visiting a file for the Emacs server.

You can customize this variable.

When you find a file with Emacs server or emacsclient,
this hook will invoked. you can use this hook to do something need.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文