Alias to make emacs open a file in a new buffer (NOT frame) and be activated/come to front?

喜欢而已 提交于 2019-12-05 15:58:00

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'"
jeff

Try this:

(setq ns-pop-up-frames nil)

Works fine for me.

Found it here

I have the following in my .bashrc sourced by my .profile:

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

And in my .emacs custom area:

(custom-set-variables
 ;; yadda yadda
 ;;...
 '(ns-pop-up-frames nil))

Or if you don't like to M-x customize-variable your way into it, as Jeff said:

(setq ns-pop-up-frames nil)

I didn't need any AppleScript to do this; although I noticed you were missing the end tell? Anyway, works like a charm for me, pops Emacs open, or uses the existing window if there is one, and it's on top, and the Terminal remains ready for more input.

You can use:

emacsclient -nt somefile

in your terminal, which would open specified file(s) in new buffer using your existing frame rather than a new client frame.

http://www.gnu.org/software/emacs/manual/html_node/emacs/emacsclient-Options.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!