1

您将如何设置 emacs 以使其从不创建任何新框架。如果我想要框架,我会在 emacs 内部进行。

烦人的是,每当我从 emacs 外部的文件管理器中单击文件时,都会打开一个全新的 emacs 实例,并且伴随着所有长的加载时间。

打开一堆文件,每个文件都需要大约 5 秒才能最终加载,这不是很方便。所以我想要做的是:每当我在文件管理器上单击一个文件时,我希望该文件在一个已经作为新缓冲区运行的 emacs 实例中打开。

我该怎么做?

在带有 Gnome 3.8.4 的 Fedora 19 上使用 emacs 24.3.1

4

2 回答 2

3

你想启动一个实例(它应该在你的 中emacs启动一个服务器),然后使用. 你可能应该(server-start)~/.emacsemacsclient

  export EDITOR=emacsclient

例如在你的~/.bashrc

请参阅调用 emacsclient(在 Emacs 文档中)和EmacsClient(在 Emacs Wiki 中)。

于 2013-09-15T08:08:31.283 回答
2

这就是我所做的。我有 Ubuntu,但我很确定 Gnome 也使用 /usr/share/applications/.

这是我的/usr/local/share/applications/emacsclient.desktop

[Desktop Entry]
Name=Emacsclient
GenericName=Text Editor
Comment=View and edit files
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
Exec=/usr/local/bin/emacsclient %F
Icon=emacs
Type=Application
Terminal=false
Categories=Development;TextEditor;
StartupWMClass=Emacs

这是我的/usr/local/share/applications/emacs.desktop(为了完整起见):

[Desktop Entry]
Name=Emacs
GenericName=Text Editor
Comment=Edit text
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
Exec=emacs %F
Icon=emacs
Type=Application
Terminal=false
Categories=Development;TextEditor;
StartupWMClass=Emacs

在不重新启动的情况下更新这些快捷方式的命令是:

sudo update-desktop-database

现在您应该Emacsclient在文件管理器“打开方式”对话框中有一个条目。建立关联,只需单击鼠标,文件将在 emacs 中打开。只要确保在你的~/.emacs

(require 'server)
(or (server-running-p) (server-start))
于 2013-09-15T08:36:21.240 回答