繁体   English   中英

使emacs永远不会打开新的框架

[英]Make emacs never open up a new frame

您如何将emacs设置为永不创建任何新框架。 如果我想要框架,我将从emacs内部进行。

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

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

我该怎么做?

在Fedora 19和Gnome 3.8.4上使用emacs 24.3.1

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

  export EDITOR=emacsclient

在例如你的~/.bashrc

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

这就是我所做的。 我有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))

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM