Subject: bug#54331: 27.2; Closing frames loaded from desktop-read

From: Rehan Deen <[email-masked]>
Date: Fri, 11 Mar 2022 12:23:29 +0530

Huh, I have actually gotten used to `C-x C-c` simply closing the current
frame that I am viewing while in client-server/daemon mode. I am
prompted by the minibuffer on whether to save modified buffers --
including those not currently displayed in the frame I am closing -- but
after hitting `y` the single frame closes.

The help for `C-x C-c` says:
> C-x C-c runs the command save-buffers-kill-terminal ...
>
> Offer to save each buffer, then kill the current connection.
> If the current frame has no client, kill Emacs itself using
> ‘save-buffers-kill-emacs’.
> ...
> If emacsclient was started with a list of filenames to edit, then
> only these files will be asked to be saved.

In "standalone" mode `C-x C-c` of course kills everything (after asking
to save changes in modified buffers).

Perhaps my daemon mode behavior is not standard. I am running this in
i3wm on Manjaro Linux if that helps. How does one "usually" close a
client frame? `C-x 5 0`, mapped to some shortcut?

Eli Zaretskii writes:

>> From: Rehan Deen <[email-masked]>
>> Date: Fri, 11 Mar 2022 00:13:23 +0530
>> 
>> A very annoying issue with `desktop-save` and `desktop-read` that I'm encountering at the moment:
>> 
>> - I'm starting Emacs in `daemon-mode`, and then open a client frame via
>>   my WM shortcut for `emacsclient -c`. I do `desktop-read` and my saved desktop opens with the 10 or so frames I had saved.
>> 
>> - When I go to one of the frames with a buffer I'm no longer interested in, and do `C-x C-c`, I end up not just closing that particular frame, but **all 10 or so of the frames that were open**.
>> 
>> - The Emacs daemon is still running, and opening another client frame shows that the buffers haven't been killed, so nothing has been lost per se - it's just that the arrangement of all the frames I had is just ruined.
>> 
>> Any idea how to stop this behaviour (i.e. being able to just kill one frame from the saved configuration)? 
>
> Is this really related to desktop-read?  AFAIK, "C-x C-c" deletes all
> the frames displayed on the terminal, and I see the same behavior if I
> start a daemon, invoke emacsclient to open a frame, and then make
> several other frames from the same session.  "C-x C-c" then closes all
> the frames I made.
>
> I think this is the expected behavior.  What am I missing?