Emacs 23、emacsclient 参数?

发布于 2024-07-30 08:35:27 字数 705 浏览 5 评论 0原文

我最近安装了 Emacs 23(在 OS X Leopard 上)并尝试了 emacs 服务器。 我尝试了两种方法:(1) 将 (server-start) 放入我的 .emacs 文件中,(2) 在终端运行 emacs --daemon (在单独的试验中;不是同时)。 在任何一种情况下,当我已经打开一个 emacs 框架并尝试使用 emacsclient -t、-tty 或 -nw 在 OS X 终端中打开一个单独的文件时,该文件始终在现有框架中打开,而不是在终端中打开,如下所示描述:

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

http://emacs-fu.blogspot.com/2009/02/emacs-daemon.html

但是,emacsclient -c 按预期工作。 您对可能发生的情况有什么想法吗?

非常感谢! -史蒂芬

I recently installed Emacs 23 (on OS X Leopard) and trying out the emacs server. I have tried both ways: (1) putting (server-start) in my .emacs file, and (2) running emacs --daemon at the terminal (in separate trials; not at the same time). In either case, when I have an emacs frame already open and try to open a separate file in the OS X terminal using emacsclient -t, -tty, or -nw, the file always opens in an existing frame rather than in the terminal as described:

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

http://emacs-fu.blogspot.com/2009/02/emacs-daemon.html

However, emacsclient -c works as expected. Do you have any ideas what may be happening?

Thanks much! -Stephen

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

忆伤 2024-08-06 08:35:27

您确定您使用的是正确的“emacsclient”二进制文件吗? 您需要 /Applications/Emacs.app/Contents/MacOS/bin/emacsclient,默认情况下它不会在您的路径中。 如果您只是从命令行调用一个裸露的 emacsclient,您将从 Apple 附带的 Emacs 22.1 中获得 emacsclient

如果您运行 emacsclient --version 并得到以下信息:

$ emacsclient --version
emacsclient 22.1

您没有得到正确的版本。

Are you sure you're using the right 'emacsclient' binary? You'll want /Applications/Emacs.app/Contents/MacOS/bin/emacsclient, and by default it will NOT be in your path. If you just invoke a bare emacsclient from the command line, you'll get the emacsclient from the Emacs 22.1 that Apple ships.

If you run emacsclient --version and get this:

$ emacsclient --version
emacsclient 22.1

You're not getting the right one.

贪了杯 2024-08-06 08:35:27

感谢大家的建议和回复 - 我认为我的解决方案是将以下内容添加到我的 .bash_profile 中:

## --- emacs ---
alias emacs='/Applications/Emacs.app/Contents/MacOS/Emacs'

## --- emacs client ---
## adapted from http://philipweaver.blogspot.com/2009/08/emacs-23.html

# start a windowed frame
alias ec="/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -n -c -a /Applications/Emacs.app/Contents/MacOS/Emacs"

# start a terminal frame
alias em="/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -t -a /Applications/Emacs.app/Contents/MacOS/Emacs -nw"

# do not start a new frame
alias ea="/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -n -a /Applications/Emacs.app/Contents/MacOS/Emacs"

的建议,用 Emacs Client.app 图标替换 Emacs.app

我尝试使用 emacs --daemon 并按照http://www.cubiclemuses.com/cm/articles/ 2009/07/30/emacs-23-for-os-x/

但是 (1) 守护进程似乎没有加载我的许多 .emacs 自定义设置以及 (2) 当我退出 Emacs Client 时它会退出Emacs 完全并生成错误...

所以我的解决方案是使用上面定义的 bash 别名; 将行 (server-start) 添加到我的 .emacs 文件,并将 Emacs.app 图标添加到我的 OS X 停靠栏,以便我可以使用该图标或别名之一来启动 emacs 并打开新文件在运行实例中,我还可以使用上面的别名或 Emacs 中的 Cx Cf(或 Cx b)。

Thanks all for your suggestions and responses - I think my solution is to add the following to my .bash_profile:

## --- emacs ---
alias emacs='/Applications/Emacs.app/Contents/MacOS/Emacs'

## --- emacs client ---
## adapted from http://philipweaver.blogspot.com/2009/08/emacs-23.html

# start a windowed frame
alias ec="/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -n -c -a /Applications/Emacs.app/Contents/MacOS/Emacs"

# start a terminal frame
alias em="/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -t -a /Applications/Emacs.app/Contents/MacOS/Emacs -nw"

# do not start a new frame
alias ea="/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -n -a /Applications/Emacs.app/Contents/MacOS/Emacs"

I tried using emacs --daemon and replacing the Emacs.app with Emacs Client.app icon as suggested by

http://www.cubiclemuses.com/cm/articles/2009/07/30/emacs-23-for-os-x/

but (1) the daemon did not seem to load many of my .emacs customizations and (2) when I would quit Emacs Client it would quit Emacs altogether and generate errors...

So my solution is to use the bash aliases as defined above; add the line, (server-start), to my .emacs file, and add the Emacs.app icon to my OS X dock so that I can use either the icon or one of the aliases to launch emacs, and to open new files in the running instance I can also use the aliases above or C-x C-f (or C-x b) in Emacs.

冷血 2024-08-06 08:35:27

如果您安装了二进制 Emacs.app,则应使用包内的可执行文件。 例如:

$ /Applications/Emacs.app/Contents/MacOS/Emacs -nw

包内还有一个 bin 目录:

$ cd /Applications/Emacs.app/Contents/MacOS/bin
$ ls -la
total 1488
drwxr-xr-x@ 19 ayman   admin     646 Aug 16 02:33 .
drwxr-xr-x@  5 ayman   admin     170 Aug 16 02:33 ..
-rwxr-xr-x@  1 ayman   admin   39704 Aug 16 02:33 b2m
-rwxr-xr-x@  1 ayman   admin  236412 Aug 16 02:33 ctags
lrwxr-xr-x   1 ayman   admin      18 Aug 24 12:54 cvtmail -> ../libexec/cvtmail
lrwxr-xr-x   1 ayman   admin      21 Aug 24 12:54 digest-doc -> ../libexec/digest-doc
-rwxr-xr-x@  1 ayman   admin  122124 Aug 16 02:33 ebrowse
-rwxr-xr-x@  1 ayman   admin   72188 Aug 16 02:33 emacsclient
-rwxr-xr-x@  1 ayman   admin  232344 Aug 16 02:33 etags
lrwxr-xr-x   1 ayman   admin      19 Aug 24 12:54 fakemail -> ../libexec/fakemail
-rwxr-xr-x@  1 ayman   admin    7288 Aug 16 02:26 grep-changelog
lrwxr-xr-x   1 ayman   admin      15 Aug 24 12:54 hexl -> ../libexec/hexl
lrwxr-xr-x   1 ayman   admin      19 Aug 24 12:54 movemail -> ../libexec/movemail
lrwxr-xr-x   1 ayman   admin      18 Aug 24 12:54 profile -> ../libexec/profile
-rwxr-xr-x@  1 ayman   admin    3977 Aug 16 02:26 rcs-checkin
lrwxr-xr-x   1 ayman   admin      18 Aug 24 12:54 rcs2log -> ../libexec/rcs2log
lrwxr-xr-x   1 ayman   admin      21 Aug 24 12:54 sorted-doc -> ../libexec/sorted-doc
lrwxr-xr-x   1 ayman   admin      28 Aug 24 12:54 update-game-score -> ../libexec/update-game-score
lrwxr-xr-x   1 ayman   admin      17 Aug 24 12:54 vcdiff -> ../libexec/vcdiff
$ 

如果您正在执行所有命令行操作,则可以使用 MacPort 更新终端版本:

$ sudo port install emacs-app

这会推送 emacs-app @23.0.0_NS截至本文发布时,为 -9.0rc3_1。

If you installed the binary Emacs.app, you should use the executable inside the package. For example:

$ /Applications/Emacs.app/Contents/MacOS/Emacs -nw

There's also a bin directory inside the package:

$ cd /Applications/Emacs.app/Contents/MacOS/bin
$ ls -la
total 1488
drwxr-xr-x@ 19 ayman   admin     646 Aug 16 02:33 .
drwxr-xr-x@  5 ayman   admin     170 Aug 16 02:33 ..
-rwxr-xr-x@  1 ayman   admin   39704 Aug 16 02:33 b2m
-rwxr-xr-x@  1 ayman   admin  236412 Aug 16 02:33 ctags
lrwxr-xr-x   1 ayman   admin      18 Aug 24 12:54 cvtmail -> ../libexec/cvtmail
lrwxr-xr-x   1 ayman   admin      21 Aug 24 12:54 digest-doc -> ../libexec/digest-doc
-rwxr-xr-x@  1 ayman   admin  122124 Aug 16 02:33 ebrowse
-rwxr-xr-x@  1 ayman   admin   72188 Aug 16 02:33 emacsclient
-rwxr-xr-x@  1 ayman   admin  232344 Aug 16 02:33 etags
lrwxr-xr-x   1 ayman   admin      19 Aug 24 12:54 fakemail -> ../libexec/fakemail
-rwxr-xr-x@  1 ayman   admin    7288 Aug 16 02:26 grep-changelog
lrwxr-xr-x   1 ayman   admin      15 Aug 24 12:54 hexl -> ../libexec/hexl
lrwxr-xr-x   1 ayman   admin      19 Aug 24 12:54 movemail -> ../libexec/movemail
lrwxr-xr-x   1 ayman   admin      18 Aug 24 12:54 profile -> ../libexec/profile
-rwxr-xr-x@  1 ayman   admin    3977 Aug 16 02:26 rcs-checkin
lrwxr-xr-x   1 ayman   admin      18 Aug 24 12:54 rcs2log -> ../libexec/rcs2log
lrwxr-xr-x   1 ayman   admin      21 Aug 24 12:54 sorted-doc -> ../libexec/sorted-doc
lrwxr-xr-x   1 ayman   admin      28 Aug 24 12:54 update-game-score -> ../libexec/update-game-score
lrwxr-xr-x   1 ayman   admin      17 Aug 24 12:54 vcdiff -> ../libexec/vcdiff
$ 

If you're doing all command line, you can just update your terminal version using MacPort:

$ sudo port install emacs-app

which pushes emacs-app @23.0.0_NS-9.0rc3_1 as of the time of this posting.

夜清冷一曲。 2024-08-06 08:35:27

我不经常在 OS X 上使用 emacs,但我习惯在启动/窗口管理器启动时启动 emacs --daemon,让进程在后台运行。 这不是一个选择吗?

我在我的 *shrc 文件中使用以下别名:

EDITOR='emacsclient -t'
alias e='emacsclient -n'
alias ew='emacsclient -c -n'
alias et='emacsclient -t'

尽管我必须承认,我主要从窗口管理器中的绑定生成 emacs 框架(您可能会考虑 QuickKeys 或 Quicksliver 之类的东西),该触发: emacsclient -c -n< /code> 或 emacs -n -e '(make-remember-frame)' 触发新的 org-remember 框架...

希望这会有所帮助。

I don't regularly use emacs on OS X, but I've taken to just starting emacs --daemon on boot/window manager launch, keeping the process running in the background. Is this not an option?

I use the following alias' in my *shrc files:

EDITOR='emacsclient -t'
alias e='emacsclient -n'
alias ew='emacsclient -c -n'
alias et='emacsclient -t'

Though I must admit that I mostly spawn emacs frames from bindings in my window manager (you might consider something like QuickKeys or Quicksliver) that trigger: emacsclient -c -n or emacs -n -e '(make-remember-frame)' which triggers a new org-remember frame...

Hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文