bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#58877: 29.0.50; [PATCH] When killing Emacs from a client frame with


From: Jim Porter
Subject: bug#58877: 29.0.50; [PATCH] When killing Emacs from a client frame with no other frames, Emacs shows a useless error prompt
Date: Sat, 29 Oct 2022 14:33:42 -0700

(Note: I originally mentioned this in bug#51993, but it's only somewhat-related to that bug. To make things easier to follow, I pulled this part out into a separate bug.)

To see this in action:

  $ emacs -Q -f server-start
  $ emacsclient -c foo.txt

  ;; From the first (non-client) frame:
  C-x 5 0  ;; delete-frame

  ;; From the second (client) frame:
  M-x kill-emacs
  ;; Emacs prompts:
Error (error Attempt to delete the sole visible or iconified frame); continue? (y or n)

Pressing "y" will properly kill Emacs, but there's no real use for the warning in this case. It happens because 'server-force-stop' (indirectly) tries to delete the last (client) frame before killing Emacs, meaning that Emacs would have zero frames for a bit.

Since 'server-force-stop's docstring says, "This function is meant to be called from `kill-emacs-hook'," it should be safe to have 'server-force-stop' avoid deleting any frames: they'll just get deleted when Emacs is actually killed.

Attached is a patch to do this. Note that I named the new argument "noframe" because that matches the existing code in server.el (see 'server-delete-client'). It's a bit of a misnomer though, and maybe "keep-frames" would be better...

Attachment: 0001-Don-t-explicitly-delete-client-frames-when-killing-E.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]