From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#51993: 29.0.50; [PATCH for 29.1] Killing emacsclient terminal with `server-stop-automatically' doesn't prompt to save files Date: Fri, 02 Dec 2022 16:10:10 +0200 Message-ID: <83edthgam5.fsf@gnu.org> References: <9e47c871-a2c3-d764-bec9-d87abf3efe83@gmail.com> <79a53ecc-dbfc-d088-d80d-96f349be794a@gmail.com> <834k7vw2vb.fsf@gnu.org> <87czc4tosz.fsf@gnus.org> <83lepoi58p.fsf@gnu.org> <83y1tbxbbt.fsf@gnu.org> <83h6zxwujo.fsf@gnu.org> <2738f071-c87f-72cf-226f-6e8597cb07a8@gmail.com> <83a65ouz0e.fsf@gnu.org> <83lenrghhg.fsf@gnu.org> <8e62e7aa-7050-6b35-9128-79517efa4557@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7008"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, 51993@debbugs.gnu.org, gregory@heytings.org To: Jim Porter Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 02 15:11:16 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p16l1-0001cx-0l for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 02 Dec 2022 15:11:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p16kq-0000vu-Ut; Fri, 02 Dec 2022 09:11:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p16kp-0000vc-A8 for bug-gnu-emacs@gnu.org; Fri, 02 Dec 2022 09:11:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p16ko-0003fP-Un for bug-gnu-emacs@gnu.org; Fri, 02 Dec 2022 09:11:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1p16ko-0005uE-H4 for bug-gnu-emacs@gnu.org; Fri, 02 Dec 2022 09:11:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 02 Dec 2022 14:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51993 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 51993-submit@debbugs.gnu.org id=B51993.166999024422693 (code B ref 51993); Fri, 02 Dec 2022 14:11:02 +0000 Original-Received: (at 51993) by debbugs.gnu.org; 2 Dec 2022 14:10:44 +0000 Original-Received: from localhost ([127.0.0.1]:46953 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p16kV-0005tx-HY for submit@debbugs.gnu.org; Fri, 02 Dec 2022 09:10:44 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:50516) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p16kT-0005tf-LI for 51993@debbugs.gnu.org; Fri, 02 Dec 2022 09:10:42 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p16kN-0003Wi-Mp; Fri, 02 Dec 2022 09:10:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=LNao1rSL21YUfyFVQUPJXXM9caAbVxQcM8nhh3N0OqM=; b=aOD79Cqj4aNY pP1yGfiwoZU33ihJnWl4H3vawqgzqRk4VmeSjHvzX8RfzVqqavMlM8ariyUe2nQTdTte0kf6+yIOS liiUBWdK+xrPTKieS8iPAnqyVyVI2a8GherJpXakRATBDBgTdUcHH8Pb2QJ+zbSvaCkt/ICASdihN lL1uGj9MQgc1G4YetWX+jP0E+ERXb/0qyb9oQ0qh+eBXG6Lus/VCzflhFqfNsfK8EqnO8HO2/yCCN X+wtgE7gVIFb1issx53Jkjrt8s8gKYeXBaLLo8324nKx3NvQd0dv9OHOLaPQF2UUxfDfQpux1vDjF gEN1k4ZM+FL/7FEzK7qTDw==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p16kN-0005gU-5F; Fri, 02 Dec 2022 09:10:35 -0500 In-Reply-To: <8e62e7aa-7050-6b35-9128-79517efa4557@gmail.com> (message from Jim Porter on Thu, 1 Dec 2022 17:09:24 -0800) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:249748 Archived-At: [Please in the future avoid changing the Subject when discussing bugs: it makes it harder for me and others to follow the discussion by grouping messages by Subject.] > Date: Thu, 1 Dec 2022 17:09:24 -0800 > Cc: larsi@gnus.org, 51993@debbugs.gnu.org, gregory@heytings.org > From: Jim Porter > > > We want this on the release branch, right? Then please make it the minimal > > change which fixes the immediate cause of the bug, and does nothing else: no > > refactoring, no reshuffling of the code or making it nicer or less > > complicated -- all that just makes the risk of new bugs higher and the job > > of reviewing the patch harder. > > Thanks for taking a look. I believe we'd want this on the release > branch. Here's the absolute minimum I could manage, although it doesn't > quite fix everything that my previous patch does. Thanks. Surprisingly, the previous version was easier to review and agree to in some of its parts, because it kept more of the original code, and only changed the conditions when save-some-buffers or save-buffers-kill-emacs were called. This version of the patch completely rewrites the affected code. Was that really necessary? > In particular, when > server-stop-automatically is set to 'kill-terminal' (or 'delete-frame'): > > * If you type 'C-x C-c' ('save-buffers-kill-terminal') in a nowait > client frame, and there are still other (non-daemon) frames, nothing > happens. You'd have to use 'C-x 5 0' ('delete-frame') instead. Fixing > this would basically mean doing 90% of my original patch, so it's > probably too risky. > > * If you type 'C-u C-x C-c', it doesn't silently save all the relevant > buffers. That's because 'server-save-buffers-kill-terminal' doesn't > forward the prefix arg to > 'server-stop-automatically--handle-delete-frame'. That's a separate (but > closely related) bug, so I didn't fix that either. Please tell more about why these two situations cannot be handled by similarly simple changes. What made the original patch risky from my POV is that it rewrote too much of the original code. Would it be possible to retain as much as possible of the original code, and just change the conditions for calling save-some-buffers etc., and/or add calls to it where it previously wasn't called for some reason? Please understand where I stand: use of emacsclient is very popular and very widespread, so I'd like to avoid adding regressions to it as result of enhancements we make. If I conclude that the new features installed as part of Emacs 29 development are too complicated and/or include semi-buggy aspects, I'd rather revert those new features than risk regressions in emacsclient and in the server behavior.