如何使用一个emacs实例作为默认文本编辑器? [Linux的] [英] How to use one instance of emacs as the default text editor? [Linux]
问题描述
我想要实现
- emacs的一个实例
- 如果我关闭emacs,它不应该真的关闭它,只是隐藏它
如果我打开nautilus的任何文本文件,它应该打开当前的emacs实例
我目前的
- 我的init(启动服务器)在我的init
- 我离开emacs打开
- 我有emacsclient作为默认texteditor
我设置emacs23启动时启动
- I set emacs23 to start at startup
- I have (start-server) in my init
- I leave emacs open
- I have emacsclient as the default texteditor
我尝试实现我想要的时候遇到的问题
- 如果我退出emacs并尝试重新启动,emacs会出现以下错误
文件错误:无法绑定服务器套接字,地址已在使用
File error: Cannot bind server socket, address already in use
我尝试的东西
更新:我再次尝试使用stackoverflow链接,现在大部分工作正常。
但是,我想要做的是重新加载init文件,以便我可以更改我的init文件,而无需重新启动计算机。任何想法?
Update: I tried again with the stackoverflow link, and now most of it is working. However, something I would like to be able to do is to reload the init file, so that I can make changes to my init file without restarting the computer. Any ideas?
此外,如果服务器正在运行,并且我有emacs假关闭(请参阅emacs fu链接),如何启动它,而不加载文件?例如,等效于运行emacs23是什么,因为这不起作用(见上面写的错误)
Also, if the server is running and I have emacs false-closed (see emacs fu link), how can i start it again without loading a file? eg what would the equivalent of running emacs23 be, as this doesn't work (see error written above)
推荐答案
- 从
.emacs
中删除 - 使用
emacsclient$ @-a
启动emacs是否正在运行 - remove
(start-server)
from.emacs
- use
emacsclient "$@" -a ""
to start emacs whether it is running or not
(start-server)
如果将 emacsclient$ @-a
保存为脚本,例如在编辑器
文件中,然后编辑器-c
创建一个新框架, editor -t
在终端中打开新框架,在现有框架中编辑器FILE
访问 FILE
。它启动emacs服务器,如果它不运行。
If you save emacsclient "$@" -a ""
as a script e.g. in editor
file then editor -c
creates a new frame, editor -t
opens new frame in the terminal, and editor FILE
visits FILE
in an existing frame. It starts emacs server if it is not running.
这篇关于如何使用一个emacs实例作为默认文本编辑器? [Linux的]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!