I use Emacs 29.1.

When I open Emacsclient, I do it with the following command:

emacsclient -a -c --create-frame --no-wait

This is bounded to a key combination to start the Emacsclient.

To kill a Emacsclient window, this is bounded to the 'kill' command in a keybinding.

When I open Emacsclient, and visit a file foobar.txt. A buffer is created in the first client. Then I open a second client, without closing the first client.And in the second client I open the same buffer foobar.txt. Then I close the second client window. When I open a new Emacsclient window, I can see the buffer foobar.txt is still open in background. When closing the second and the first one Emacsclient, then the buffer foobar.txt will disappear.

I want to keep the buffer foobar.txt, regardless if the client windows are open or not. The buffer foobar.txt should be staying in the Emacs daemon.

When looking for a solution, I found another this thread: Kill buffer when closing emacs with emacsclient

When checking server-kill-new-buffers, this is set on t.

I set this in Emacs client window on nil: enter image description here

Then I visit the file foobar.txt again, and close the Emacsclient.

When open another Emacsclient instance, I see the buffer foobar.txt is not saved in memory.

TLDR: How can I keep the buffer sticking to Emacs daemon, when closing the only Emacsdaemon window with kill command?

  • stackoverflow.com/a/76968294/20212483 may help
    – shynur
    Nov 13, 2023 at 4:43
  • Thanks for your comment. Unfortunately, this doesn't solve my issue since I open Emacsclient in other viewports than the current emacsclient, under a keybinding which opens a new Emacsclient window.
    – ReneFroger
    Nov 13, 2023 at 12:33


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.