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

问题描述

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

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

我已从。

我会接受符合以下所有条件的回答:

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


  1. emacs窗口在我的终端窗口前打开。

  2. 键入emacs一个GUI Emacs窗口。

  3. 当foo.txt存在时,键入emacs foo.txt将使用foo.txt启动一个GUI Emacs窗口
  4. 键入emacs foo.txt会启动一个带有名为foo.txt的空文本缓冲区的GUI Emacs窗口, 。在该缓冲区中执行^ X ^ S将在我开始Emacs的目录中保存foo.txt。
  1. The emacs window opens in front of my terminal window.
  2. Typing "emacs" launches a GUI Emacs window. Finding files in that window will default to looking in the directory from where I started Emacs.
  3. Typing "emacs foo.txt" when foo.txt exists launches a GUI Emacs window with foo.txt loaded.
  4. Typing "emacs foo.txt" when foo.txt does not exist launches a GUI Emacs window with an empty text buffer named "foo.txt". Doing ^X^S in that buffer will save foo.txt in the directory from where I started Emacs.


推荐答案

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

#!/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)

网站现在具有,这是顶部代码段的来源。有更多的信息,关于运行 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-14 22:11