GNU bug report logs - #58877
29.0.50; [PATCH] When killing Emacs from a client frame with no other frames, Emacs shows a useless error prompt

Previous Next

Package: emacs;

Reported by: Jim Porter <jporterbugs <at> gmail.com>

Date: Sat, 29 Oct 2022 21:34:02 UTC

Severity: normal

Tags: patch

Found in version 29.0.50

Done: Jim Porter <jporterbugs <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Jim Porter <jporterbugs <at> gmail.com>
Subject: bug#58877: closed (Re: bug#58877: 29.0.50; [PATCH] When killing
 Emacs from a client frame with no other frames, Emacs shows a useless
 error prompt)
Date: Fri, 25 Nov 2022 01:37:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#58877: 29.0.50; [PATCH] When killing Emacs from a client frame with no other frames, Emacs shows a useless error prompt

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 58877 <at> debbugs.gnu.org.

-- 
58877: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=58877
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Jim Porter <jporterbugs <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 58877-done <at> debbugs.gnu.org
Subject: Re: bug#58877: 29.0.50; [PATCH] When killing Emacs from a client
 frame with no other frames, Emacs shows a useless error prompt
Date: Thu, 24 Nov 2022 17:36:11 -0800
On 11/24/2022 3:51 AM, Eli Zaretskii wrote:
>> Date: Mon, 21 Nov 2022 21:06:31 -0800
>> From: Jim Porter <jporterbugs <at> gmail.com>
>> Cc: 58877 <at> debbugs.gnu.org
>>
>> Since server.el could probably use more tests anyway, I added a few ERT
>> tests covering the most common use cases (see the first patch), and then
>> added another test for the second patch. The test in the second patch is
>> pretty indirect, but that's because it's testing something that normally
>> happens when killing Emacs; it'd be hard to kill the current Emacs
>> instance and still be able to check test results!
> 
> This is fine with me, but please fix the typo before installing:

Whoops! Good catch, thanks.

Merged as 28c444f72a9843ce335032db1fa0f484dfeb4833 with the typo fixed. 
Closing this now.


[Message part 3 (message/rfc822, inline)]
From: Jim Porter <jporterbugs <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 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
[Message part 4 (text/plain, inline)]
(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...
[0001-Don-t-explicitly-delete-client-frames-when-killing-E.patch (text/plain, attachment)]

This bug report was last modified 2 years and 171 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.