当使用emacsW32在Windows上关闭(x)窗口时,如何保持emacs服务器的运行? [英] how do i keep emacs server running when the current window is closed (x) on windows using emacsW32?

查看:172
本文介绍了当使用emacsW32在Windows上关闭(x)窗口时,如何保持emacs服务器的运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows上使用 EmacsW32(patchched)。 Emacs以服务器模式运行,以便后续调用emacsclientw在同一个服务器会话中打开文件。



我有 Cx Cc 当前框架看不见,而不是杀死emacs服务器进程。我想点击窗口的 X (关闭)按钮也只是隐藏框架&没有像现在那样终止服务器进程。



任何想法?谢谢!

解决方案

当然,我有一个这样做的方法。可能有改进可能,但这是一个很好的开始。



首先,我设置一个变量,并建议kill-emacs函数

 (defvar bnb / really-kill-emacs nil)
(defadvice kill-emacs(around bnb / really-exit activate)

(如果bnb / really-kill-emacs
ad-do-it)
(bnb / exit))

bnb / exit函数只是使框架不可见,就像你绑定到 Cx Cc 一样。 >

然后我有一个额外的功能来正确退出emacs,如果这是必要的。这将设置变量并调用kill-emacs如下。

 (defun bnb / really-kill-emacs()
(interactive)
(setq bnb / really-kill-emacs t)
(kill-emacs))


I'm using EmacsW32 (patched) on windows. Emacs is running in server mode so that subsequent calls to emacsclientw open files in the same server session.

I have C-x C-c mapped to make the current frame invisible and not kill the emacs server process. I'd like clicking the window's X (close) button to also just hide the frame & not terminate the server process as it currently does.

Any ideas ? Thanks!

解决方案

Sure, I have a method of doing this. There may be refinements possible, but this is a good starting place.

First, I setup a variable and advise the kill-emacs function

(defvar bnb/really-kill-emacs nil)
(defadvice kill-emacs (around bnb/really-exit activate)
    "Only kill emacs if the variable is true"
    (if bnb/really-kill-emacs
        ad-do-it)
      (bnb/exit))

The bnb/exit function just makes the frame invisible like what you have bound to C-x C-c.

I then have an additional function to properly exit emacs if that is ever necessary. That will set the variable and call kill-emacs as follows.

(defun bnb/really-kill-emacs ()
    (interactive)
    (setq bnb/really-kill-emacs t)
    (kill-emacs))

这篇关于当使用emacsW32在Windows上关闭(x)窗口时,如何保持emacs服务器的运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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