In OSX, pressing C-x C-c
closes all Emacs windows instead of only the selected one. This isn't the bahavior I've come to esxpect from using Emacs on Windows, Ubuntu,or CentOS. What's up?
1 Answer
C-x C-c
is for Kill Emacs (save-buffers-kill-terminal).
Maybe on other systems you are using emacsclient
, then
C-x C-c
behaves specially if you are using Emacs as a server. If you type it from a client frame, it closes the client connection.
Or maybe you run multiple instances of Emacs?
To close only one frame use C-x 5 0
or s-w
.
This command delete current frame or kill Emacs if there are only one frame:
(defun close-frame-or-kill-emacs ()
"Delete frame or kill Emacs if there are only one frame."
(interactive)
(if (> (length (frame-list)) 1)
(delete-frame)
(save-buffers-kill-terminal)))
-
Darn, that's really annoying.
C-x 5 0
ands-w
won't close the last frame either. On other systems I just use the defaultemacs
oremacs.exe
, however it comes.– AidoJun 3, 2019 at 20:43 -
2@Aido, in the absence of the client/server feature,
C-x C-c
has always been for quitting the Emacs instance -- which means closing all of its frames. If you are not usingemacsclient
then the only explanation which makes any sense is that, rather than using multiple frames of a single Emacs instance, you are running multiple instances of Emacs (in which caseC-x C-c
would close only the one you were using at that time).– philsJun 4, 2019 at 0:01 -
@phils Yeah, it looks like that. I've got a script from my dad that randomizes the background color of each instance, and on OSX they're all the same until you close and reopen every window.– AidoJun 4, 2019 at 5:20
-
1@Aido Added
close-frame-or-kill-emacs
command to answer. Bind it tos-w
so it will "close" the last frame. Jun 4, 2019 at 8:19 -
C-x C-c
exits Emacs, i.e. it closes all open frames. It works the same on all operating systems. If you just want to close the current frame, useC-x 5 0
.