本文介绍了如何在 OSX 中从命令行启动 GUI Emacs?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 OSX 中从命令行启动 GUI Emacs?

How do I launch GUI Emacs from the command line in OSX?

我已经从 http://emacsformacosx.com/ 下载并安装了 Emacs.

I have downloaded and installed Emacs from http://emacsformacosx.com/.

我会接受满足以下所有条件的答案:

I'll accept an answer fulfilling all of the following criteria:

  1. emacs 窗口在我的终端窗口前面打开.
  2. 输入emacs"会启动一个 GUI Emacs 窗口.在该窗口中查找文件将默认在我启动 Emacs 的目录中查找.
  3. 当 foo.txt 存在时输入emacs foo.txt"会启动一个加载了 foo.txt 的 GUI Emacs 窗口.
  4. 在 foo.txt 不存在时输入emacs foo.txt"会启动一个 GUI Emacs 窗口,其中包含一个名为foo.txt"的空文本缓冲区.在该缓冲区中执行 ^X^S 会将 foo.txt 保存在我启动 Emacs 的目录中.

推荐答案

调用以下脚本emacs"并将其放在你的 PATH 某处:

Call the following script "emacs" and put it in your PATH somewhere:

#!/bin/sh
/Applications/Emacs.app/Contents/MacOS/Emacs "$@"

涵盖 #2、#3 和 #4.

That covers #2, #3, and #4.

对于 #1,把它放在你的 .emacs 文件中:

For #1, put this somewhere in your .emacs file:

(x-focus-frame nil)

emacsformacosx.com 站点现在有一个操作方法页面,这是顶部片段的来源.那里有更多关于运行 emacsclient 和将 Emacs 连接到 git mergetool 的信息.

The emacsformacosx.com site now has a How-To page, which is where the top snippet came from. There's more info there about running emacsclient and hooking Emacs up to git mergetool.

这篇关于如何在 OSX 中从命令行启动 GUI Emacs?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 08:37
查看更多