emacsclient 窗口焦点
运行 emacsclient 后如何持续控制窗口焦点?
目前,焦点取决于我是否已经有一个正在运行的 emacs 服务器。当 emacsclient 调用替代编辑器时,焦点将转移到新的 emacs 窗口。当 emacsclient 连接到现有的 emacs 服务器时,焦点不会转移(即它保留在我的 putty 客户端上)。
我希望始终关注 emacs 窗口,因为我通常在打开文件后转到 emacs。
任何帮助将不胜感激!
注释
版本信息
emacs: 21.4.1
emacsclient: 21.4
client os: Windows XP Service Pack 3
x server: Exceed 11.0.0.0
我的.bash_profile的相关部分
# a wrapper is needed to sandwich multiple command line arguments in bash
# 2>/dev/null hides
# "emacsclient: can't find socket; have you started the server?"
emacs_wrapper () {
if [ 0 -eq $# ]
then
emacsclient -n -a emacs ~/notes.txt 2>/dev/null &
else
emacsclient -n -a emacs $* &
fi
}
alias x="emacs_wrapper"
另外,在我的.emacs的末尾我有
(server-start)
我当前的解决方法是一个简单的自动热键脚本,它专注于我的第一个Exceed窗口
^+x::
If WinExist("ahk_class EXCEEDW:MWCLIENT0")
WinActivate
return
作为旁注,似乎我重定向到 /dev/null 混淆了语法荧光笔:(
How do I consistently control window focus after running emacsclient?
Currently, focus depends on if I already have an emacs server running. When emacsclient invokes an alternative editor, focus is shifted to the new emacs window. When emacsclient connects to an existing emacs server, focus is not shifted (ie. it stays on my putty client).
I would like to consistently focus on the emacs window, since I usually go to emacs after opening a file.
Any help would be greatly appreciated!
Notes
Version Info
emacs: 21.4.1
emacsclient: 21.4
client os: Windows XP Service Pack 3
x server: Exceed 11.0.0.0
Relevant section of my .bash_profile
# a wrapper is needed to sandwich multiple command line arguments in bash
# 2>/dev/null hides
# "emacsclient: can't find socket; have you started the server?"
emacs_wrapper () {
if [ 0 -eq $# ]
then
emacsclient -n -a emacs ~/notes.txt 2>/dev/null &
else
emacsclient -n -a emacs $* &
fi
}
alias x="emacs_wrapper"
Also, at the end of my .emacs I have
(server-start)
My current workaround is a simple autohotkey script, which focuses on my first Exceed window
^+x::
If WinExist("ahk_class EXCEEDW:MWCLIENT0")
WinActivate
return
As a side note, it seems my redirection to /dev/null confused the syntax-highlighter :(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
怎么样:
在 emacs 23.1 上对我有用
取消焦点
(lower-frame)
可能会有用。How about:
works for me on emacs 23.1
To unfocus
(lower-frame)
might be useful.emacsclient 的“--create-frame”选项对您有用吗?您将以这种方式打开的每个文件都会得到一个新框架,但至少它会集中(我认为)。
Would the "--create-frame" option to emacsclient work for you? You'd get a new frame for each file you opened this way, but at least it would be focused (I think).
由于某种未知的原因,这个问题自行解决了。打开文件现在始终将焦点更改为具有相应文件的 emacs 框架。老实说,我不确定是什么改变了这种行为,但我很高兴。
感谢大家的意见和建议!
For some unknown reason, the issue fixed itself. Opening files now consistently changes focus to the emacs frame with the corresponding file. I'm honestly unsure what changed the behavior, but I'm happy.
Thanks to everyone for their comments and suggestions!