Emacs Client: difference between C-x k and C-x #

一个人想着一个人 提交于 2019-12-02 10:59:40

问题


When running emacs in daemon with a client and I hit C-x k, it says: Emacs buffer still has clients. Are you sure you want to quit?

But when using C-x #, it exits immediately.

I don't understand the difference. Why doesn't C-x k just behave normally in the first place, if its in a client?

I found this snippet that's supposed to make C-x k behave properly but I don't understand the difference.

Furthermore, when an emacs client starts up, it starts with the previous buffer for a few seconds then opens up the new buffer. Isn't the point of emacs server to speed up the initial start up time? Why does it do this / how can I fix it? On initial load, it starts with scratch for a few seconds.


回答1:


I can't write a better explanation of C-x# than Emacs already gives you. Just type C-hkC-x#

I assume that C-xk warns you because you're not using the mechanism for telling the client explicitly that you're done, and as you might be trying to kill the buffer from any Emacs frame (and unless you're running Emacs as a daemon, there are going to be non-client frames), it makes sure you're aware that the buffer is associated with a client somewhere.

The query itself comes from server-kill-buffer-query-function which is added to kill-buffer-query-functions, and probably has no way of telling where the kill was issued from. It has the following comments:

;; Ask before killing a server buffer.
;; It was suggested to release its client instead,
;; but I think that is dangerous--the client would proceed
;; using whatever is on disk in that file. -- rms.



回答2:


Basically C-x k kills a buffer and C-x # notifies the emacs server that you are done editing and that the client may exit. Kind of like killing a process with kill or exiting it correctly.



来源:https://stackoverflow.com/questions/21317065/emacs-client-difference-between-c-x-k-and-c-x

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!