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#51993: 29.0.50; [PATCH] Killing emacsclient terminal with `server-stop-automatically' doesn't prompt to save files Date: Thu, 20 Oct 2022 22:51:42 -0700 Message-ID: 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> 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="3504"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, 51993@debbugs.gnu.org, gregory@heytings.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Oct 21 07:56:21 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 1oll12-0000eG-8l for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 21 Oct 2022 07:56:20 +0200 Original-Received: from localhost ([::1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oll0z-0008JM-Ev for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 21 Oct 2022 01:56:18 -0400 Original-Received: from [::1] (helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1olkx8-0000uu-OT for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 21 Oct 2022 01:52:18 -0400 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 1olkww-0000rl-6m for bug-gnu-emacs@gnu.org; Fri, 21 Oct 2022 01:52:08 -0400 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 1olkws-000601-Oe for bug-gnu-emacs@gnu.org; Fri, 21 Oct 2022 01:52:05 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1olkws-00032z-8N for bug-gnu-emacs@gnu.org; Fri, 21 Oct 2022 01:52: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: Fri, 21 Oct 2022 05:52: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.166633151311698 (code B ref 51993); Fri, 21 Oct 2022 05:52:02 +0000 Original-Received: (at 51993) by debbugs.gnu.org; 21 Oct 2022 05:51:53 +0000 Original-Received: from localhost ([127.0.0.1]:36661 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1olkwi-00032c-PK for submit@debbugs.gnu.org; Fri, 21 Oct 2022 01:51:53 -0400 Original-Received: from mail-pl1-f182.google.com ([209.85.214.182]:37713) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1olkwg-00032O-Aa for 51993@debbugs.gnu.org; Fri, 21 Oct 2022 01:51:51 -0400 Original-Received: by mail-pl1-f182.google.com with SMTP id d24so1421538pls.4 for <51993@debbugs.gnu.org>; Thu, 20 Oct 2022 22:51:50 -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=RzLRczBcCsydB8MIdljJXIs4fiTg2CJcwEP/AzLTkPk=; b=glx6VA8SvucWE8UIiw27muzSmTL8b+3UpZlXKjVDGgGtjpLSUTsSiRS2qBj3xpYJVA bcx+qXvS5GJhaWafoupN3OkAsmZDjg94Cj25TzIg8VSiuSzBAD3hohbuO4FstRm2MvJq QdGeYpS/ZFAFJP9ilQcHQquiy4kxmIryRVn6giDTW9qt8qetdto02kXY9SFA1FYzBvtx WEtHr6OqQDbjkBFGFg0cr9AGM5A9wkSKiYH4v8OnWHjyL7pTnMCXfkgh+TjMSlPEFbNM zMYrX21flQAAHbfxT3z53tmE2dXMopsGolLMMA5+5+/A5jzYC2Cc2/i3vBH6asjLbkMt 61OA== 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=RzLRczBcCsydB8MIdljJXIs4fiTg2CJcwEP/AzLTkPk=; b=TycI+j12MHTddYrI5dXY8j3dHDnsQk3IbsLxnc1jSJ9PHU5oyjnaPAR+WxjOfH9sj1 fKULF2RCMyMaPxYg3vPqZWnl/87go39Rc0V79YEyLOebFjRaqTWsNUkY+Lq8IEmoB8Fi phr9Gblm14KaUAySGrz0xiOtzWsUzH0vqJ+kItmhv825o1LLWvcGLdneCHZ7rnFjbX2F A3UwSq0rMTPWWk+LE59wG7tDX8QZcHXhFIn6rupPPXcjzlbU3JR0evTga0as8XBT4xA7 tc7lUfnqd8pTMt05hafxJ3/QtZQO37gNqbEpU/+y9naFJ72dIif5YFhXeYECKPf6xcFR v3lQ== X-Gm-Message-State: ACrzQf3olni/EcQ2s4Kq4isr+sp29qZQvtlyKwzQfwLmv0plwOcdXR0d 8e1J0l20BfATF8H/dedgldi25O/rXX0= X-Google-Smtp-Source: AMsMyM69fs2JfcFssqQYs3mM4ZmskEJtZFQQBo9B7fCUmQfjK2smaHysslbrcMz/lUznub9JnhaL9w== X-Received: by 2002:a17:902:a60d:b0:186:61f6:d7f4 with SMTP id u13-20020a170902a60d00b0018661f6d7f4mr7124126plq.75.1666331504261; Thu, 20 Oct 2022 22:51:44 -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 on7-20020a17090b1d0700b002005fcd2cb4sm917630pjb.2.2022.10.20.22.51.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 20 Oct 2022 22:51:43 -0700 (PDT) Content-Language: en-US In-Reply-To: <83y1tbxbbt.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:245959 Archived-At: On 10/19/2022 11:23 PM, Eli Zaretskii wrote: >> Date: Wed, 19 Oct 2022 20:14:38 -0700 >> Cc: larsi@gnus.org, 51993@debbugs.gnu.org, gregory@heytings.org >> From: Jim Porter >> >> a) if this is not the last client, behave the same as Emacs 28: >> prompt to save files specified when starting "emacsclient", and then >> delete that client. >> >> b) if this *is* the last client, prompt the user to save everything >> (as with 'save-buffers-kill-emacs'), and then delete the client + kill >> the Emacs daemon. > > You mean, in b), instead of just deleting the frame and leaving the > daemon run, you want to shut down Emacs in its entirety, as if the > user invoked kill-emacs? I'm okay with that as an optional behavior, > although I myself won't use it, as it's too dangerous. Almost. I'd like it to be as if the user invoked 'save-buffers-kill-emacs'; that is, before killing Emacs, prompt the user about everything[1] that might be lost by killing Emacs. This already exists as an option -- (server-stop-automatically 'delete-frame)[2], but I also find the current behavior too dangerous. My original message outlines one of the problems with the current implementation: it changes the behavior of (a) in my description above. > $ emacs -Q --daemon > $ emacsclient -a "" -c foo.txt > $ emacsclient -a "" -c bar.txt > > ;; In the first client frame: > foobar ;; Insert some text > C-x C-c > ;; Emacs prompts "Save file /path/to/foo.txt?..." > > Now try the above, but call `(server-stop-automatically 'delete-frame)' first (or replace `delete-frame' with `kill-terminal'; it doesn't matter). In this case, Emacs doesn't prompt to save the file. As mentioned earlier in this bug, I'm open to providing a patch to support options beyond the one I suggested (quoted at the beginning of this message), but I want to be sure we agree on what the options should look like so that I'm not breaking Gregory's (or anyone else's) preferred behavior here. (Of course, all of this would remain opt-in. I don't want to change the default behavior here, since it would break years of established precedent.) [1] Well, everything that Emacs usually asks about in a non-daemon configuration, anyway. [2] It's not hooked up to Customize, though I don't think that would be too hard to do.