如何正常关闭emacs守护程序? [英] How to gracefully shutdown emacs daemon?

查看:115
本文介绍了如何正常关闭emacs守护程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

登录Ubuntu时,我使用Ubuntu的Startup程序启动了Emacs(版本23)守护程序.然后,每当需要编辑某些内容时,我就启动Emacs客户端.当然,当我从Ubuntu注销时,它表示Emacs仍在运行.我需要在某处附加脚本,以告诉Gnome在注销/关闭时关闭emacs.

On login to Ubuntu, I start an Emacs (version 23) daemon using Ubuntu's Startup programs. I then start Emacs clients whenever I need to edit something. When I logoff from Ubuntu, it says Emacs is still running, of course. I need to attach a script somewhere to tell Gnome to shutdown emacs when I logoff/shutdown.

1)脚本应该是什么样? "kill-emacs"似乎无效.

1) What should the script look like? "kill-emacs" doesn't seem to work.

2)我应该将该脚本放在哪里?启动程序(系统"->会话"菜单)面板中没有任何看起来有用的东西.我更喜欢在用户帐户中起作用的内容,而不是破解PostSession脚本或其他具有root访问权限的内容.

2) Where should I put this script? There's nothing in the startup programs (System->Sessions menu) panel that looks useful. I'd prefer something that works in the user's account, rather than hacking the PostSession script or something else with root access.

推荐答案

This linuxquestions.org page has a Python script that can be run during login that listens for the 'save yourself' event that Gnome emits during shutdown. You could modify that to do the:

emacsclient -e '(save-buffers-kill-emacs)'

官方文档: https://www.emacswiki.org/emacs/EmacsAsDaemon#toc8

这篇关于如何正常关闭emacs守护程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆