使 emacs 在新缓冲区(非帧)中打开文件并被激活/出现在前面的别名? [英] Alias to make emacs open a file in a new buffer (NOT frame) and be activated/come to front?

查看:22
本文介绍了使 emacs 在新缓冲区(非帧)中打开文件并被激活/出现在前面的别名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前拥有的是

alias em="open -a /Applications/Emacs.app "$@" && osascript -e 'tell application "Emacs.app" to activate'"

但是我被难住了.

使用该代码,em file.txt 将被激活,但不会打开文件.我得到'22:23:语法错误:预期行尾但发现未知标记.(-2741)'

With that code, em file.txt will activate, but won't open the file. And I get '22:23: syntax error: Expected end of line but found unknown token. (-2741)'

在做

alias em=open -a /Applications/Emacs.app "$@"

工作正常,然后它会打开文件,但显然没有将 emacs 带到前面.

Works fine and then it will open the file, but obviously not bring emacs to the front.

出于某种奇怪的原因

osascript -e 'tell application "Emacs.app" to activate'

不激活 emacs.... 我不知道发生了什么.

doesn't activate emacs.... I have no idea what is going on.

我很乐意使用别名代码或 .emacs 代码解决此问题

I am happy to fix this either with alias code, or with .emacs code

查看其他尝试的评论.

推荐答案

问题可能是你需要像这样转义引号吗?

Could the problem be that you need to escape you quotes, like this?

alias em="open -a /Applications/Emacs.app \"$@\" && osascript -e 'tell application \"Emacs.app\" to activate'"

这篇关于使 emacs 在新缓冲区(非帧)中打开文件并被激活/出现在前面的别名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆