Go to about:config
火狐浏览器中的页面。添加一个新字符串:
network.protocol-handler.app.emacs
value: 解析没有协议的 url 的脚本的路径(后面是什么emacs://
),然后使用正确的参数调用 emacsclient。
您不能只放置 emacsclient 的路径,因为协议之后的所有内容都会作为一个参数传递给可执行文件,因此您的+60 foo.log
将是一个以这种方式命名的新文件。
但你很容易想象类似的事情emacs:///path/to/your/file/LINENUM
并有一个小脚本,删除最后的 / 和数字,并使用数字和文件调用 emacsclient :-)
编辑:如果你愿意,我可以在 bash 中执行此操作,但我不知道如何使用 Windows“shell”或任何名称来执行此操作。
编辑2:我错了,协议在arg字符串中传递给!
这是我刚刚为我制作的一个小 bash 脚本,顺便说一句,谢谢你的想法:-D
#!/bin/bash
ARG=${1##emacs://}
LINE=${ARG##*/}
FILE=${ARG%/*}
if wmctrl -l | grep emacs@romuald &>/dev/null; then # if there's already an emacs frame
ARG="" # then just open the file in the existing emacs frame
else
ARG="-c" # else create a new frame
fi
emacsclient $ARG -n +$LINE "$FILE"
exit $?
and my network.protocol-handler.app.emacs
在我的iceweasel(火狐)中是/home/p4bl0/bin/ffemacsclient
。效果很好!
是的,我的笔记本电脑的名字是 romuald ^^。