开发者

How can I write a hook to activate when any emacs frame is raised/focused?

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?


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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜