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