本文介绍了emacsclient窗口焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在运行emacsclient之后始终控制窗口焦点?



目前,焦点取决于我是否已经有一个emacs服务器运行。当emacsclient调用替代编辑器时,焦点转移到新的emacs窗口。当emacsclient连接到现有的emacs服务器时,焦点不会移动(即它保留在我的putty客户端上)。



我想始终关注emacs窗口,因为我通常在打开文件后去emacs。



任何帮助将不胜感激!



笔记



版本信息

  emacs:21.4 .1 
emacsclient:21.4
客户端操作系统:Windows XP Service Pack 3
x服务器:Exceed 11.0.0.0

我的.bash_profile的相关部分

 #需要一个包装器来夹紧多个命令行bash中的参数
#2> / dev / null隐藏
#emacsclient:找不到套接字;你启动了服务器吗?
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结尾我有

 (服务器启动)

我目前的解决方法是一个简单的autohotkey脚本,其重点是我的第一个Exceed窗口



<$ p $如果WinExist(ahk_class EXCEEDW:MWCLIENT0)
WinActivate
return

作为旁注,似乎我重定向到/ dev / null混淆了语法 - 荧光笔:(

解决方案

由于一些未知的原因,问题解决了自己,打开文件现在一直将焦点改变为与相应文件的emacs框架,我真的不确定什么改变了行为, m / p>

感谢大家的意见和建议!


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 :(

解决方案

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!

这篇关于emacsclient窗口焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-20 22:25