如果在最后一个打开框架内,Emacs Cx Cc 会覆盖 save-buffers-kill-terminal
我已设置 emacs -daemon 在登录 Gnome 时运行,并将 emacsclient 与我在 Eclipse 中使用的 .cpp 和 .py 文件相关联,以便将 emacs 用作我的在 Eclipse 中选择这些文件时的默认编辑器。这样我就可以获得一个很好的工作流程,结合了 emacs 的编辑功能和 Eclipse 的项目/构建管理和调试功能。
Anyhoo...我想阻止 Cx Cc 关闭我当前正在编辑的 Emacs 框架(如果它是在任何给定时刻唯一保持可见的 Emacs 框架)。
是否有一种方法可以查询守护进程 Emacs 进程,以找出打开了多少帧并覆盖默认的 Cx Cc 行为以不执行任何操作(如果仅剩余 1 帧),从而确保始终至少有一个可见帧始终打开?
一些实现此行为并且可以添加到我的 .emacs 中的 elisp 会很棒。
奖励积分:Ø) 我有将 vi、emacs 等映射到“emacsclient -c”的别名,所以我通常会得到 emacs 帧来来去去。进一步的增强功能是 Eclipse 将我想要编辑的文件直接发送到特定框架,例如使用 emacsclient -c 打开的第一个框架。
I have setup emacs -daemon to run on login to Gnome and associated emacsclient with .cpp and .py files that I work with in Eclipse in order that emacs is used as my default editor for these files when selected within Eclipse. This way I can get a good work flow combining the editing capabilities of emacs and the project/build management and debugging facilities of Eclipse.
Anyhoo... I want to prevent C-x C-c from closing the Emacs frame I am currently editing in if it is the only Emacs frame remaining visible at any given moment.
Is there a way of querying the daemon Emacs process in order to find out how many frames are open and override the default C-x C-c behaviour to do nothing (if only 1 frame remaining) thereby ensuring there is always at least one visible frame open at all times?
Some elisp that implements this behaviour and that can be added to my .emacs would be great.
Bonus Points :¬)
I have aliases that map vi, emacs etc... to "emacsclient -c", so I get emacs frames coming and going all the time in general. A further enhancement would be for Eclipse to send files that I want to edit directly to a specific frame e.g. the 1st frame opened with emacsclient -c.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
让 emacs 永垂不朽(无论您以何种方式启动它):
使用
ad-deactivate
来停用此技巧。Make emacs immortal (what ever the way you've started it) :
Use
ad-deactivate
to deactivate this trick.在 emacs-clients 中,
save-buffers-kill-terminal
仅调用server-save-buffers-kill-terminal
,因此您可能需要安装一个建议,以免影响非客户端框架。frame-list
函数可用于内省当前存在的帧。显然,它总是包含一个用于守护进程本身的条目,然后包含一个用于每个开放框架的条目。Within emacs-clients,
save-buffers-kill-terminal
only callsserver-save-buffers-kill-terminal
, so you might want to install an advice onto that to not affect non-client frames. Theframe-list
function cal be used to introspect the currently existing frames. It apparently always includes one entry for the daemon process itself, and then one for each open frame.