我想用chemacs方便地切换多套不同的配置,所以需要从命令行启动Emacs.app。
就我希望比如说在 终端输入 emacs --with-profile doom
就打开GUI的doom emacs ; 在终端输入 emacs --with-profile spacemacs
就打开GUI的spacemacs,诸如此类。
我用的emacs版本是railwaycat的emacsmacport,根据文档通过brew的方法安装,并软连接到Emacs.app。
brew tap railwaycat/emacsmacport
brew install emacs-mac
ln -s /usr/local/opt/emacs-mac/Emacs.app /Applications
然而命令行输入emacs默认启动的是tty版本,并不能启动GUI,我就很郁闷。(在spotlight里输入emacs也跳不出Emacs.app的选项,这就不提了)
根据Emacs Mac Port 文档,Emacs.app CLI starter可以用下面这里的方法
里面是一个perl文件,据说
Paste into a file named
emacs
(or whatever you want the command to be) in a directory in your path (ahead of the location of the existing emacs command). Thenchmod +x /path/to/emacs
.
我有点没看懂, 这个文件是要干个啥啊 什么叫做"in a directory in your path (ahead of the location of the existing emacs command"啊? 这个是一步什么操作啊? 还有其他方法可以从CLI启动GUI Emacs吗?
真心请教各位。
补充一下 brew 安装 emacs-mac 成功后的message吧:
This is YAMAMOTO Mitsuharu's "Mac port" addition to
GNU Emacs 27. This provides a native GUI support for Mac OS X
10.6 - 11. After installing, see README-mac and NEWS-mac
in /usr/local/opt/emacs-mac for the port details.
Emacs.app was installed to:
/usr/local/opt/emacs-mac
To link the application to default Homebrew App location:
ln -s /usr/local/opt/emacs-mac/Emacs.app /Applications
Other ways please refer:
https://github.com/railwaycat/homebrew-emacsmacport/wiki/Alternative-way-of-place-Emacs.app-to-Applications-directory
If you are using Doom Emacs, be sure to run doom sync:
~/.emacs.d/doom sync
For an Emacs.app CLI starter, see:
https://gist.github.com/4043945
==> **Summary**