From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.bugs Subject: bug#58404: 29.0.50; [PATCH] When killing Emacs from the last client, don't warn about the session having clients Date: Mon, 10 Oct 2022 01:08:17 -0700 Message-ID: <02eb7516-bccc-16ab-84f2-4688849bfba8@gmail.com> References: <20194da7-2318-46db-7536-bbd9e3ddf945@gmail.com> <83k058i4y2.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2043"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 58404@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Oct 10 10:20:55 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 1oho1v-0000ML-D7 for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 10 Oct 2022 10:20:55 +0200 Original-Received: from localhost ([::1]:52388 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oho1u-0006dt-5H for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 10 Oct 2022 04:20:54 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47374) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ohnqQ-0004Ox-VL for bug-gnu-emacs@gnu.org; Mon, 10 Oct 2022 04:09:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46758) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ohnqQ-0007NA-Kd for bug-gnu-emacs@gnu.org; Mon, 10 Oct 2022 04:09:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ohnqQ-0006Ea-GP for bug-gnu-emacs@gnu.org; Mon, 10 Oct 2022 04:09:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jim Porter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 10 Oct 2022 08:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58404 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 58404-submit@debbugs.gnu.org id=B58404.166538930723885 (code B ref 58404); Mon, 10 Oct 2022 08:09:02 +0000 Original-Received: (at 58404) by debbugs.gnu.org; 10 Oct 2022 08:08:27 +0000 Original-Received: from localhost ([127.0.0.1]:45825 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ohnpq-0006D8-KH for submit@debbugs.gnu.org; Mon, 10 Oct 2022 04:08:27 -0400 Original-Received: from mail-pf1-f178.google.com ([209.85.210.178]:45024) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ohnpo-0006Cw-1A for 58404@debbugs.gnu.org; Mon, 10 Oct 2022 04:08:24 -0400 Original-Received: by mail-pf1-f178.google.com with SMTP id i3so586611pfc.11 for <58404@debbugs.gnu.org>; Mon, 10 Oct 2022 01:08:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=5ATvTHsRlgcJ9bDjDfyVqxfmFBdYhoLEHRnb8qAAPFg=; b=Om8mQHKKMV22T6BHGRIfRHhLF1hMguQQG+v5gggPNZqIv8/lYVecVGieJaU56iSoDC AAjt7Fyq5smLN0HpyM7dbqsoa2jbBKXSYXUbKZQqCJnFY6/6oQsb3XUkj+l+nVTp3Ytr ixETQSd/b2+03LuSglAVv5vLCVwHiOXc4ON79tLHc5BKKtqHLhUR6Q8dDGwtfEmpLmdB 91uKk9XPA7Fpi9b4FpSasuhZe7dSC1wGRS7s2W8yCnrBw+cNhUKKBjoug9fLyI9EEVql azX2d8cXEWiA+tHfSn7Gcv/se7F94DHyaK8eFDnlTub+HjAFVeO1mJjX8BLPaK8TXjE1 IXzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=5ATvTHsRlgcJ9bDjDfyVqxfmFBdYhoLEHRnb8qAAPFg=; b=l+EXl0aKQWKrDXu/FC1KexWMGmXDfa5/ecstzsQuU77Nk9qzzIoSjngy/xAuotJ/pb 15thvOb+qI/+pETHpqjh1MXcTv3474S6/Zp7Y07Afg+91y0E1Mz+OvpXwcUYOTvMXZaW 1VgLy1jdcn4FAZZEvtwq7f1Zti5mbeW6Rs/hZCzubgSTu3fAbRWpi62Jn//s5UwPa6tX lEN5+zF9xPzJTJKXDyybO5ZbFongi3JOXrg5q8O8iMi8NtEXcE+T5XKGwQPS/1c6Q38h CG3nfhJm8I/zBprjc6drtUYGup7fFxSek5979As6O02dsaomMGICk1/mqt+1lKrpHdvu hnpQ== X-Gm-Message-State: ACrzQf3mRYr0Ut3Ut0kEYIMRcK9vmrTteeuojxjKFZzw1rSMCLcin8p8 aQnPKfxW6ewuGbCtbkluidQ= X-Google-Smtp-Source: AMsMyM4My2jQw/sqpyvbZzouGz02cunMShpTgxSlTj+ZzR4OUKuc/oew56MJPf5DzdMTvGNJQ0OF9A== X-Received: by 2002:a65:4689:0:b0:458:764a:221b with SMTP id h9-20020a654689000000b00458764a221bmr16017895pgr.296.1665389297993; Mon, 10 Oct 2022 01:08:17 -0700 (PDT) Original-Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id kx14-20020a17090b228e00b0020d24a9ad1fsm2686687pjb.52.2022.10.10.01.08.16 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 10 Oct 2022 01:08:17 -0700 (PDT) Content-Language: en-US In-Reply-To: <83k058i4y2.fsf@gnu.org> 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" Xref: news.gmane.io gmane.emacs.bugs:244987 Archived-At: On 10/9/2022 11:11 PM, Eli Zaretskii wrote: > IMO, this is an unnecessary annoyance. We don't by default ask the > user any questions today, when they want to kill an Emacs session. But Emacs *does* prompt the user today. If you call 'save-buffers-kill-emacs' from an emacsclient frame, it will (almost) always ask you, "This Emacs session has clients; exit anyway?" My patch just gets rid of that annoyance when we can be sure it's unnecessary (i.e. it won't ask if there are no other emacsclients and no other frames not owned by a client). The patch does also change the prompt to be more-precise when there is an open frame not owned by a client[1]. However, it doesn't add any new prompts where there were none before; it only removes a prompt in one case. > What is the use case where this command could be invoked by mistake > and will risk losing edits or other valuable work? I didn't write this code initially, but here's my understanding of why the prompt is useful. If you use "emacs --daemon", 'C-x C-c' ('save-buffers-kill-terminal') will only close the current emacsclient, not shut down the daemon entirely. If you'd like to shut down the daemon too, you can call 'save-buffers-kill-emacs' instead. Maybe you'd even bind that to a key combo or do it automatically in some cases. So given the above, imagine you're at the office. You start the Emacs daemon and connect a GUI emacsclient instance[2]. Then you do a bunch of work until it's time to go home, but you leave your emacsclient running to pick up where you left off the next day. When you get home, you remember that you wanted to edit something quickly, so you SSH into you work computer and start a second emacsclient instance. By now, you forgot about your first emacsclient instance you made while at work. If you call 'save-buffers-kill-emacs' from your SSH emacsclient, it's nice that it can remind you that you have another emacsclient instance still running: since you don't see the GUI frames for the other client, it would be easy to forget about them and kill the session entirely. Then when you go into work the next day, the buffers you had open yesterday would be gone. In this case, you likely haven't lost changes to any files, since you saved before killing the session, but you'd lose non-file buffers, window configuration, etc. (Of course, this assumes you're not using desktop.el.) As for the code I added to check for non-client frames, the story is pretty much the same, although that code is there to handle situations where users start Emacs normally (i.e. by running "emacs") and then start the Emacs server via '(server-start)'. When connecting to that Emacs session remotely, it would be useful to get a prompt for the same reasons above. The only difference is that the GUI frames on your work system are "non-client" frames, so the code checks for them in a different way. [1] Excluding the initial frame for "emacs --daemon", that is. [2] This could be as simple as clicking the "Emacs (client)" icon on your desktop.