GNU bug report logs - #58909
29.0.50; [WIP PATCH] Deleting the last frame of an emacsclient doesn't ask to save

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Jim Porter <jporterbugs@HIDDEN>; Keywords: patch; dated Sun, 30 Oct 2022 22:30:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 58909 <at> debbugs.gnu.org:


Received: (at 58909) by debbugs.gnu.org; 2 Nov 2022 18:17:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 02 14:17:07 2022
Received: from localhost ([127.0.0.1]:47157 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oqIIV-0005tg-Dl
	for submit <at> debbugs.gnu.org; Wed, 02 Nov 2022 14:17:07 -0400
Received: from mail-pl1-f171.google.com ([209.85.214.171]:34721)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jporterbugs@HIDDEN>) id 1oqIIU-0005t9-Bm
 for 58909 <at> debbugs.gnu.org; Wed, 02 Nov 2022 14:17:06 -0400
Received: by mail-pl1-f171.google.com with SMTP id v17so14326054plo.1
 for <58909 <at> debbugs.gnu.org>; Wed, 02 Nov 2022 11:17:06 -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=tpfwQvHI9HGkbcmKzDCWNhdjjwCE5SeHppSFvADlrlQ=;
 b=G6QY88kSP+7S5k/Vev8wvfVwjOjCQ9sYLQkk4Sqx2grPIRP+BW63f3YQykYVO0SyJy
 hLhlDT5QBvsBHh8w5ACLmdWaYoThfcqaXqvChSOP7JjTkg8c788ErkSvVMDelZNvChB+
 /qkqWdoOQ6CUFf6l2wnalL6RoPe1RnDtr/hCiWnpaE0U5JOhfY+ukEW75cRWSKYOTC4d
 DCTDrxIayRvqpULMBdbVbW8igph4Pu9ECsOCmRbL/gPp+H1PUq/aWn/AJsMXXFwxJAMh
 MIV0nLHvS9mLHN3IoCT5/ukOwRLp8nkuE4AnN1ug5amtWI/KSbodFZUbu82anRKE44G1
 Q5gA==
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=tpfwQvHI9HGkbcmKzDCWNhdjjwCE5SeHppSFvADlrlQ=;
 b=shUQnPMe1ZgCUfO980RHEsjmfB+7XKsjjda+07w18N80V+90Dni53m40nTJ9u6Xfly
 ElFdgCCmgOPbRe6/JNqUINToo3roHaFT/96+4okjGUBMNdVgjObrVRuC4BPOeJzyQJOU
 +Lv4pXITnCZrXlU+wdXJmNoudBIdNwUsBVJe2LPyIJXy0DJyYfE1KJeRafcyDtgeMW1x
 P6pob50GPW8Q0I1FiT0opKx5TK2hG+RJI9QzXJZ3gxfVezOUwqA5YD2w+1Crg3fbb7hS
 NmLRRUIga66C7WwceJ+v+XKvOExEp4NAL5tQ5S7Q7mI2reDTPTDqfNMZOfvWWbkYuY3S
 dsNg==
X-Gm-Message-State: ACrzQf1VUZ9uzh/HK7iZTqXQ8yJ8rcPXvFX8wQjX6ISOS0xJCSlxz/2n
 MDYp9ybjLZim8EgVPLYeq944olHORFU=
X-Google-Smtp-Source: AMsMyM6tTyuQHdK7MgMJH9EYpprfVbkncfzrJ2rAOYF6nWaSNM62isPO6c2SSiP3876EBbRWehx0RQ==
X-Received: by 2002:a17:90a:f198:b0:212:c3cf:b8f4 with SMTP id
 bv24-20020a17090af19800b00212c3cfb8f4mr27392318pjb.49.1667413020463; 
 Wed, 02 Nov 2022 11:17:00 -0700 (PDT)
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
 11-20020a63134b000000b0043ae1797e2bsm7770378pgt.63.2022.11.02.11.16.59
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Wed, 02 Nov 2022 11:16:59 -0700 (PDT)
Message-ID: <39e03350-2783-fa90-5d66-26e47abe100d@HIDDEN>
Date: Wed, 2 Nov 2022 11:17:00 -0700
MIME-Version: 1.0
Subject: Re: bug#58909: 29.0.50; [WIP PATCH] Deleting the last frame of an
 emacsclient doesn't ask to save
Content-Language: en-US
To: Eli Zaretskii <eliz@HIDDEN>
References: <9a70f868-ca50-52fc-af3e-23813af104f2@HIDDEN>
 <83zgdcduxm.fsf@HIDDEN> <53238b5b-3e0a-3dfe-eeba-f37cafa81f50@HIDDEN>
 <838rkveq3n.fsf@HIDDEN> <7de45884-b4c9-4a4c-777c-5db17b3bacca@HIDDEN>
 <835yfzeobt.fsf@HIDDEN> <7694fcf2-8982-9099-5eb8-39835d049847@HIDDEN>
 <83y1svch5u.fsf@HIDDEN> <b5172c2a-9cb1-7e37-6c9c-e14eeff8eb20@HIDDEN>
 <0dc07894-dfa1-01f6-87c4-9e02bfcaf0dc@HIDDEN> <83bkppblh7.fsf@HIDDEN>
 <e5300400-c953-09e3-b7a2-b43898fc14f1@HIDDEN> <83a6599t7m.fsf@HIDDEN>
From: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <83a6599t7m.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 58909
Cc: 58909 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

First, I just wanted to say thanks for your patience with this. I think 
this discussion has gone on a lot longer than either of us intended. I 
want to emphasize that while I'm not flexible in how my Emacs 
configuration works, I *am* flexible in what actually gets committed to 
Emacs proper. If you think my changes belong in Emacs, then I'll do the 
necessary work to get them in a merge-able state; if not, I can just 
apply them to my local configuration. Thanks again.

On 11/2/2022 10:11 AM, Eli Zaretskii wrote:
>> Date: Wed, 2 Nov 2022 09:36:52 -0700
>> Cc: 58909 <at> debbugs.gnu.org
>> From: Jim Porter <jporterbugs@HIDDEN>
>>
>> Hm, ok. That means I'd need to make sure 'C-x 5 0' calls something other
>> than 'delete-frame', so that I could add a prompt to it that can prevent
>> deletion of the frame.
> 
> Why?  delete-frame eventually calls a function from server.el, doesn't
> it?  We've been through that already.  Why cannot you do this inside
> that server.el function?
> 
> If that's because you want to support the C-g case, then don't: that
> is a separate problem.

Yeah, this subthread about 'delete-frame' was just to support the C-g 
case. Aside from that, I think doing this inside 'server-delete-client' 
would be fine. However, at least for this bug, adding a hook that runs 
in 'server-delete-client' doesn't add anything that 
'delete-frame-functions' doesn't already allow. ('server-delete-client' 
is called from a hook in 'delete-frame-functions' in this case anyway.)

> Waaaay too complicated for such a simple problem.  Please, let's just
> prompt the user from server-delete-client (and do that under some
> opt-in option), and be done with that.

If you mean adding a defcustom, I thought we'd agreed not to do that 
(see the beginning of your message here[1]). I'm fine with that; if I 
have to write a hook to fix the issue I saw in the original message, I 
don't mind. (Of course, I'm happy to upstream my code if there's 
interest, but if not, that's ok too.) Instead, my goal was just to 
provide the bare minimum of changes to Emacs to enable a user to modify 
this to their liking without relying too heavily on 'advice-add'. :)

Would it make sense (possibly in a separate bug) to at least make sure 
that the 'server-mode' minor mode is always active when the server is 
running? The server.el code sometimes uses 'server-mode' and sometimes 
uses 'server-start', with the end result being that the minor mode may 
or may not be active depending on the way the server was started. That 
seems like a bug all on its own. If just this part were fixed, it would 
go 95% of the way to make it easy for me to make Emacs work just the way 
I like, and without having to make any major changes to Emacs itself. 
This change could be as simple as renaming 'server-start' to 
'server--start', and then have a new 'server-start' that activates the 
minor mode.

[1] https://lists.gnu.org/archive/html/bug-gnu-emacs/2022-10/msg02642.html




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#58909; Package emacs. Full text available.

Message received at 58909 <at> debbugs.gnu.org:


Received: (at 58909) by debbugs.gnu.org; 2 Nov 2022 17:12:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 02 13:12:15 2022
Received: from localhost ([127.0.0.1]:47097 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oqHHj-0004Ga-A3
	for submit <at> debbugs.gnu.org; Wed, 02 Nov 2022 13:12:15 -0400
Received: from eggs.gnu.org ([209.51.188.92]:46014)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1oqHHh-0004GM-8l
 for 58909 <at> debbugs.gnu.org; Wed, 02 Nov 2022 13:12:13 -0400
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 <eliz@HIDDEN>)
 id 1oqHHb-0007UT-9p; Wed, 02 Nov 2022 13:12:07 -0400
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=VyLQ5Yovt0Lz6Vl2eqWW9sevLuwIRmSpGCd/BQyFCEU=; b=J3fmgpNZV/eK
 jMbD1AD6sdFIaodOcTnAJLiH263QxcQA9mtAnKpKkblE7w+Ex52YYOCOJzA3xpCjJtEUG25vmAWhu
 dS5HuCCHOzXON9tCr17JnIkBUKesZtk/k6bbqk6XCQ9bJzHK1nOqIQKcIHzlZEpGL6rNqdBRmex/5
 F46fvEpAVukeueJN8yZDyrOfc52/WhfoFouqNI/eUqPk+FDivyU2zoXFQdW8Ai7BybtHvxDQRcOEB
 X+FPQLN/7yHqy6kgPBmG3dU2NKpmGlKoggDmpuh5IbV3ZKrsq6GpKjxhqjkTYrW79V7Kl5Gy7Ltqy
 H8E9gXY8w6hB5d0xWgsJ4g==;
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 <eliz@HIDDEN>)
 id 1oqHHa-0007Pt-P6; Wed, 02 Nov 2022 13:12:07 -0400
Date: Wed, 02 Nov 2022 19:11:57 +0200
Message-Id: <83a6599t7m.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <e5300400-c953-09e3-b7a2-b43898fc14f1@HIDDEN> (message from
 Jim Porter on Wed, 2 Nov 2022 09:36:52 -0700)
Subject: Re: bug#58909: 29.0.50; [WIP PATCH] Deleting the last frame of an
 emacsclient doesn't ask to save
References: <9a70f868-ca50-52fc-af3e-23813af104f2@HIDDEN>
 <83zgdcduxm.fsf@HIDDEN> <53238b5b-3e0a-3dfe-eeba-f37cafa81f50@HIDDEN>
 <838rkveq3n.fsf@HIDDEN> <7de45884-b4c9-4a4c-777c-5db17b3bacca@HIDDEN>
 <835yfzeobt.fsf@HIDDEN> <7694fcf2-8982-9099-5eb8-39835d049847@HIDDEN>
 <83y1svch5u.fsf@HIDDEN> <b5172c2a-9cb1-7e37-6c9c-e14eeff8eb20@HIDDEN>
 <0dc07894-dfa1-01f6-87c4-9e02bfcaf0dc@HIDDEN> <83bkppblh7.fsf@HIDDEN>
 <e5300400-c953-09e3-b7a2-b43898fc14f1@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 58909
Cc: 58909 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Wed, 2 Nov 2022 09:36:52 -0700
> Cc: 58909 <at> debbugs.gnu.org
> From: Jim Porter <jporterbugs@HIDDEN>
> 
> > Sorry, but I still don't like this.  We currently call this hook via
> > safe_call because we don't want to let the hook prevent the deletion
> > of the frame.
> > 
> > I prefer to solve this in server.el, not in lower-level primitives.
> 
> Hm, ok. That means I'd need to make sure 'C-x 5 0' calls something other 
> than 'delete-frame', so that I could add a prompt to it that can prevent 
> deletion of the frame.

Why?  delete-frame eventually calls a function from server.el, doesn't
it?  We've been through that already.  Why cannot you do this inside
that server.el function?

If that's because you want to support the C-g case, then don't: that
is a separate problem.  You wanted to give the user the opportunity to
save the buffers, and that doesn't require any support for C-g.
Besides, if the user types C-g when presented with the save-buffers
prompt, how do you know that the user intends to abort deletion of the
frame, and not break out of the saving operation?

And finally, even if the user does want to prevent the deletion of the
frame, and fails in doing that, how is that a catastrophe?  Emacs is
still running and the unsaved buffers are still in the session.

I really don't see why we need to jump through any hoops for such a
simple situation.

> 1. If 'delete-frame' is a lower-level primitive, should 'C-x 5 0' call 
> it directly, or should there be a higher-level function for it to call? 
> If we had some higher-level function, then user-level commands could 
> call that, but low-level code could still use 'delete-frame'. This 
> user-level command would then be able to run some hook that can prevent 
> deletion of the frame.
> 
> 2. Since server.el has a minor mode (unsurprisingly named 
> 'server-mode'), maybe one option is to do command remapping. If we remap 
> 'delete-frame' to some new 'server-delete-frame' when 'server-mode' is 
> active, then this should work. See attached for a quick sketch of how 
> this would look.
> 
> What do you think about one of these?

Waaaay too complicated for such a simple problem.  Please, let's just
prompt the user from server-delete-client (and do that under some
opt-in option), and be done with that.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#58909; Package emacs. Full text available.

Message received at 58909 <at> debbugs.gnu.org:


Received: (at 58909) by debbugs.gnu.org; 2 Nov 2022 16:37:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 02 12:37:11 2022
Received: from localhost ([127.0.0.1]:47059 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oqGjn-0003NF-1Q
	for submit <at> debbugs.gnu.org; Wed, 02 Nov 2022 12:37:11 -0400
Received: from mail-pf1-f180.google.com ([209.85.210.180]:42526)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jporterbugs@HIDDEN>) id 1oqGjb-0003Mb-4P
 for 58909 <at> debbugs.gnu.org; Wed, 02 Nov 2022 12:37:10 -0400
Received: by mail-pf1-f180.google.com with SMTP id b185so16887426pfb.9
 for <58909 <at> debbugs.gnu.org>; Wed, 02 Nov 2022 09:36:59 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=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=OdGdMGsxUq4SsLsIYqyLT8dKQaaPZOE7kXidScdWJmk=;
 b=FriPQCSHLaOwEZ3AHMAeCbRbDBuLB+DfNs6R5TuyB8vpN/RSy0J3RlgFkTsypKRP47
 qZfGei5N0bLZCUCuRoHS25KIvYVXjotdMCfq0zF6HO4cDgSexFFVrNht1eOOOyWCCqF6
 vzRFzzlIhb5S2YVkArX4SNzpmXhiGWypA7BFiDixRrYY9VVXNAw6fPo/MGEDipGRH3+6
 mcc6suFZmve3gugyFJHe6SZpEtHbcbDpgTCXhNZCXHRLcOS6VI3zCEuuM5z8CkF1mBJU
 c9VFhv2u3r0hDHknbyFsZUatSxIPN0LAiYjTv91+1R309+X2dTYgTc35pTZcQuPrbNlG
 FTLw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=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=OdGdMGsxUq4SsLsIYqyLT8dKQaaPZOE7kXidScdWJmk=;
 b=diX0tIQvKOuAJE8swMlhIlPmwj26MKEBHanNEuM06w/DRN2bX+eH2+XKQ42Fs4Z4Lt
 d8/LIB8zEpJVQMnxH3p18X+fRadlnpFHBLTyDIw1K5HHcy/jrgWKcOYz9XUKj4eVhq5Y
 HSXCCH8JniE5rRilf9gWk/jSMIHMKQp2D/oXbBxSlSocIUOE5SY9vxPTw/RoobGXcDrI
 4SiwtDaVeUPCICxIrcd/u8yCEl+3gux+u3aiYHRg3OaqWq1rqzmHYoFa/94+m8/vnQV6
 BIXI79oRhd/ELe+X4ihvYPIY8BYrI4pm7fLNIEK+5/8a/qPi3tcRcn0XO21CrSaTWNwO
 NaLg==
X-Gm-Message-State: ACrzQf17xh5Kbt4E4rNwh8C43obbEOBNvbyLprBwcADOnqL2PxKKHaGJ
 H/EGCnYZ3a5kBYgEG8UIxUqUJRMARCs=
X-Google-Smtp-Source: AMsMyM62mkdZCnPBafWPmM3UeTAnG7cDrmuEvD/anzQ7A4OYmhY1mbZuAc1C5hDr5K89IgKyREroeA==
X-Received: by 2002:a63:ff5a:0:b0:42c:61f:b81 with SMTP id
 s26-20020a63ff5a000000b0042c061f0b81mr22490091pgk.254.1667407012924; 
 Wed, 02 Nov 2022 09:36:52 -0700 (PDT)
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
 z184-20020a6233c1000000b0056c47a5c34dsm8667502pfz.122.2022.11.02.09.36.50
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Wed, 02 Nov 2022 09:36:51 -0700 (PDT)
Content-Type: multipart/mixed; boundary="------------qlARUBNhtTsCxdvPZv0SDD6R"
Message-ID: <e5300400-c953-09e3-b7a2-b43898fc14f1@HIDDEN>
Date: Wed, 2 Nov 2022 09:36:52 -0700
MIME-Version: 1.0
Subject: Re: bug#58909: 29.0.50; [WIP PATCH] Deleting the last frame of an
 emacsclient doesn't ask to save
Content-Language: en-US
To: Eli Zaretskii <eliz@HIDDEN>
References: <9a70f868-ca50-52fc-af3e-23813af104f2@HIDDEN>
 <83zgdcduxm.fsf@HIDDEN> <53238b5b-3e0a-3dfe-eeba-f37cafa81f50@HIDDEN>
 <838rkveq3n.fsf@HIDDEN> <7de45884-b4c9-4a4c-777c-5db17b3bacca@HIDDEN>
 <835yfzeobt.fsf@HIDDEN> <7694fcf2-8982-9099-5eb8-39835d049847@HIDDEN>
 <83y1svch5u.fsf@HIDDEN> <b5172c2a-9cb1-7e37-6c9c-e14eeff8eb20@HIDDEN>
 <0dc07894-dfa1-01f6-87c4-9e02bfcaf0dc@HIDDEN> <83bkppblh7.fsf@HIDDEN>
From: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <83bkppblh7.fsf@HIDDEN>
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 58909
Cc: 58909 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

This is a multi-part message in MIME format.
--------------qlARUBNhtTsCxdvPZv0SDD6R
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

On 11/2/2022 5:16 AM, Eli Zaretskii wrote:
>> Date: Tue, 1 Nov 2022 15:39:29 -0700
>> From: Jim Porter <jporterbugs@HIDDEN>
>> Cc: 58909 <at> debbugs.gnu.org
>>
>> Attached is a (hopefully) safer version of my change to 'delete-frame'.
>> In this patch, a hook can only cancel frame deletion if FORCE is
>> non-nil. This way, if there were ever some bug with a hook, you (or some
>> code) can still force-delete the frame.
> 
> Sorry, but I still don't like this.  We currently call this hook via
> safe_call because we don't want to let the hook prevent the deletion
> of the frame.
> 
> I prefer to solve this in server.el, not in lower-level primitives.

Hm, ok. That means I'd need to make sure 'C-x 5 0' calls something other 
than 'delete-frame', so that I could add a prompt to it that can prevent 
deletion of the frame.

Two questions then:

1. If 'delete-frame' is a lower-level primitive, should 'C-x 5 0' call 
it directly, or should there be a higher-level function for it to call? 
If we had some higher-level function, then user-level commands could 
call that, but low-level code could still use 'delete-frame'. This 
user-level command would then be able to run some hook that can prevent 
deletion of the frame.

2. Since server.el has a minor mode (unsurprisingly named 
'server-mode'), maybe one option is to do command remapping. If we remap 
'delete-frame' to some new 'server-delete-frame' when 'server-mode' is 
active, then this should work. See attached for a quick sketch of how 
this would look.

What do you think about one of these?
--------------qlARUBNhtTsCxdvPZv0SDD6R
Content-Type: text/plain; charset=UTF-8;
 name="0001-WIP-Try-using-a-keymap-for-server-mode.patch"
Content-Disposition: attachment;
 filename="0001-WIP-Try-using-a-keymap-for-server-mode.patch"
Content-Transfer-Encoding: base64

RnJvbSAyY2U5OTRkZTEyNGI3NjA5MDg5OTIzMDkwMjAxY2JiNzdmYTAzNWJjIE1vbiBTZXAg
MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBKaW0gUG9ydGVyIDxqcG9ydGVyYnVnc0BnbWFpbC5j
b20+CkRhdGU6IFdlZCwgMiBOb3YgMjAyMiAwOToyMjo0MyAtMDcwMApTdWJqZWN0OiBbUEFU
Q0hdIFtXSVBdIFRyeSB1c2luZyBhIGtleW1hcCBmb3Igc2VydmVyLW1vZGUKCi0tLQogbGlz
cC9zZXJ2ZXIuZWwgfCAxNyArKysrKysrKysrKysrKysrKwogMSBmaWxlIGNoYW5nZWQsIDE3
IGluc2VydGlvbnMoKykKCmRpZmYgLS1naXQgYS9saXNwL3NlcnZlci5lbCBiL2xpc3Avc2Vy
dmVyLmVsCmluZGV4IDkwZDk3YzE1MzguLmM4ZjkwNzIwZjcgMTAwNjQ0Ci0tLSBhL2xpc3Av
c2VydmVyLmVsCisrKyBiL2xpc3Avc2VydmVyLmVsCkBAIC03OTYsNiArNzk2LDE4IEBAIHNl
cnZlci1ydW5uaW5n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
IFNob3VsZCB0aGlzIGNoZWNrIGZvciBhbiBleGlzdGluZyBzZXJ2ZXIgc29ja2V0IGFuZCBk
bwogICA7OyBub3RoaW5nIGlmIHRoZXJlIGlzIG9uZSAoZm9yIG11bHRpcGxlIEVtYWNzIHNl
c3Npb25zKT8KICAgKHNlcnZlci1zdGFydCAobm90IHNlcnZlci1tb2RlKSkpCi0tIAoyLjI1
LjEKCg==

--------------qlARUBNhtTsCxdvPZv0SDD6R--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#58909; Package emacs. Full text available.

Message received at 58909 <at> debbugs.gnu.org:


Received: (at 58909) by debbugs.gnu.org; 2 Nov 2022 12:16:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Nov 02 08:16:22 2022
Received: from localhost ([127.0.0.1]:45078 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oqCfO-0002OP-12
	for submit <at> debbugs.gnu.org; Wed, 02 Nov 2022 08:16:22 -0400
Received: from eggs.gnu.org ([209.51.188.92]:38032)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1oqCfM-0002OE-RA
 for 58909 <at> debbugs.gnu.org; Wed, 02 Nov 2022 08:16:21 -0400
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 <eliz@HIDDEN>)
 id 1oqCfH-0005Jp-Iv; Wed, 02 Nov 2022 08:16:15 -0400
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=7ti80OOSr5mCm4wZDvWv6jL42Z9d6Yqu7yQLFAmREnM=; b=FGdsBeiqK0VC
 BzCGnIOS/pOh6kekqbwRGD831T0gf0JLTvzsJcZjRtkDqWBzXA2Tci4ozkRyd04WnDbtvbQ41B+mN
 uDWAlIyx66WDd+Lsa55aAdo9KrjM7Ki9/LnCj8+1eAjOqw54ac9jWitRPMViAzYFVazPJSu9nAhUG
 kc1RVdtTHSw+hpKXcSB3EWwUEw9I+OfeQ1vElmR2buT6zseueQOad7J334RCMEv1IC+603PhD+szk
 H8Xf0tzRlyjPnYgfCNKhjeMO36X8Q8adlYKnmdK7a3LmtdXdkLmnK/1zN6F+a4aWTeVeH4LPnS7Ci
 R4+Xja41OWIt68QcxfnI3A==;
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 <eliz@HIDDEN>)
 id 1oqCfG-0002tF-Eh; Wed, 02 Nov 2022 08:16:14 -0400
Date: Wed, 02 Nov 2022 14:16:04 +0200
Message-Id: <83bkppblh7.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <0dc07894-dfa1-01f6-87c4-9e02bfcaf0dc@HIDDEN> (message from
 Jim Porter on Tue, 1 Nov 2022 15:39:29 -0700)
Subject: Re: bug#58909: 29.0.50; [WIP PATCH] Deleting the last frame of an
 emacsclient doesn't ask to save
References: <9a70f868-ca50-52fc-af3e-23813af104f2@HIDDEN>
 <83zgdcduxm.fsf@HIDDEN> <53238b5b-3e0a-3dfe-eeba-f37cafa81f50@HIDDEN>
 <838rkveq3n.fsf@HIDDEN> <7de45884-b4c9-4a4c-777c-5db17b3bacca@HIDDEN>
 <835yfzeobt.fsf@HIDDEN> <7694fcf2-8982-9099-5eb8-39835d049847@HIDDEN>
 <83y1svch5u.fsf@HIDDEN> <b5172c2a-9cb1-7e37-6c9c-e14eeff8eb20@HIDDEN>
 <0dc07894-dfa1-01f6-87c4-9e02bfcaf0dc@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 58909
Cc: 58909 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Tue, 1 Nov 2022 15:39:29 -0700
> From: Jim Porter <jporterbugs@HIDDEN>
> Cc: 58909 <at> debbugs.gnu.org
> 
> Attached is a (hopefully) safer version of my change to 'delete-frame'. 
> In this patch, a hook can only cancel frame deletion if FORCE is 
> non-nil. This way, if there were ever some bug with a hook, you (or some 
> code) can still force-delete the frame.

Sorry, but I still don't like this.  We currently call this hook via
safe_call because we don't want to let the hook prevent the deletion
of the frame.

I prefer to solve this in server.el, not in lower-level primitives.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#58909; Package emacs. Full text available.

Message received at 58909 <at> debbugs.gnu.org:


Received: (at 58909) by debbugs.gnu.org; 1 Nov 2022 22:39:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 01 18:39:40 2022
Received: from localhost ([127.0.0.1]:44404 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1opzv2-000612-6J
	for submit <at> debbugs.gnu.org; Tue, 01 Nov 2022 18:39:40 -0400
Received: from mail-pj1-f48.google.com ([209.85.216.48]:55127)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jporterbugs@HIDDEN>) id 1opzv0-00060i-Hv
 for 58909 <at> debbugs.gnu.org; Tue, 01 Nov 2022 18:39:38 -0400
Received: by mail-pj1-f48.google.com with SMTP id h14so14547599pjv.4
 for <58909 <at> debbugs.gnu.org>; Tue, 01 Nov 2022 15:39:38 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=in-reply-to:references:cc:to:from:content-language:subject
 :mime-version:date:message-id:from:to:cc:subject:date:message-id
 :reply-to; bh=evKgme73iBkIjVn+nCEu7uKELc/ETaLpi2Mxs6Wg7ng=;
 b=OmQr5PnGz4omaq3CdsRNHKixWMYSDQrZKU2u6cXi0N9PuRxwmr7kZSsBOTrwG6Pnio
 LbhQIJOMmbVl2FoSNsEHzNv9lAt3fiGmkmk+3OdHuCddrgLB9FYh9xa7Kje2awcI8QaS
 z3e2E30WUH/2HygT5qqBmcxPHihL8ed+ZD4cNSsb0iqpvNK6Pko9iBOkf6ZkGz8kVOCU
 /6sNBgNa9Eur1tnw6AuuLMenfJugerVnNsrV9hQcX2+CFIQR85LnR4XmqHBuZNIoUxl8
 OVPcyq5d4C8bSCgC1Zzn/Ml1Z6ODqGLO7PPRgmgGoVAMC2Ehn7nl0MkSVrsFm93n1Eo+
 I32g==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=in-reply-to:references:cc:to:from:content-language:subject
 :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject
 :date:message-id:reply-to;
 bh=evKgme73iBkIjVn+nCEu7uKELc/ETaLpi2Mxs6Wg7ng=;
 b=fv1u908UvSenvOOvHMHHboX8pkILMZ8cxb1c2fOZDx94PISby/zIvJryoAPerR9mYB
 nW6gb/Jc3kJsQ2URMB6dWTjShRjtq5MDfTguixKHpgwAdRkE2s2wyES5LsoqxtPnxRyB
 3I5eX0RIzQ9Ou+OFhRIZpFU+J76uQ4Sn9w+N8urVGI+fswMWv3KmENLv2ZwKE/vLWbRy
 lUq7xq8H1mQfgyPN0S6eTu6gyHFX2eqk6ymizdu27WeIyldxEkPcks3aF5xDK5UZqqku
 pWokpyXxlEU8WJazRdTUnzO7bJLgcNc7TpxXzPjBWWa4UfnUGRGvjsX0SOubm017ivze
 ll4w==
X-Gm-Message-State: ACrzQf1BW68w0EgtEycovf+K77e3o59w4deTwAsUILEboPjOe77N/gdf
 OYveCJZ/aSq4NQCMEl8OtOY=
X-Google-Smtp-Source: AMsMyM6/ukysvZ+eSH2mF1GfVoXKoNOW0veDUSeIqrDKRFOt7NX6XtuvhHpxG912OJnIlWEki7u8EA==
X-Received: by 2002:a17:902:9a07:b0:178:8024:1393 with SMTP id
 v7-20020a1709029a0700b0017880241393mr21705300plp.128.1667342372428; 
 Tue, 01 Nov 2022 15:39:32 -0700 (PDT)
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
 a19-20020aa79713000000b0056b3c863950sm7062897pfg.8.2022.11.01.15.39.30
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Tue, 01 Nov 2022 15:39:31 -0700 (PDT)
Content-Type: multipart/mixed; boundary="------------Rbi4e1m0rLHYKzgxzaYbA2os"
Message-ID: <0dc07894-dfa1-01f6-87c4-9e02bfcaf0dc@HIDDEN>
Date: Tue, 1 Nov 2022 15:39:29 -0700
MIME-Version: 1.0
Subject: Re: bug#58909: 29.0.50; [WIP PATCH] Deleting the last frame of an
 emacsclient doesn't ask to save
Content-Language: en-US
From: Jim Porter <jporterbugs@HIDDEN>
To: Eli Zaretskii <eliz@HIDDEN>
References: <9a70f868-ca50-52fc-af3e-23813af104f2@HIDDEN>
 <83zgdcduxm.fsf@HIDDEN> <53238b5b-3e0a-3dfe-eeba-f37cafa81f50@HIDDEN>
 <838rkveq3n.fsf@HIDDEN> <7de45884-b4c9-4a4c-777c-5db17b3bacca@HIDDEN>
 <835yfzeobt.fsf@HIDDEN> <7694fcf2-8982-9099-5eb8-39835d049847@HIDDEN>
 <83y1svch5u.fsf@HIDDEN> <b5172c2a-9cb1-7e37-6c9c-e14eeff8eb20@HIDDEN>
In-Reply-To: <b5172c2a-9cb1-7e37-6c9c-e14eeff8eb20@HIDDEN>
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 58909
Cc: 58909 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

This is a multi-part message in MIME format.
--------------Rbi4e1m0rLHYKzgxzaYbA2os
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

On 11/1/2022 9:11 AM, Jim Porter wrote:
> However, I'm not sure how to do this in a complete way without tweaking 
> 'delete-frame-functions'. ...
Attached is a (hopefully) safer version of my change to 'delete-frame'. 
In this patch, a hook can only cancel frame deletion if FORCE is 
non-nil. This way, if there were ever some bug with a hook, you (or some 
code) can still force-delete the frame.

This would probably still need a NEWS entry, but I'm personally less 
worried about this change compared to my previous revision. What do you 
think?
--------------Rbi4e1m0rLHYKzgxzaYbA2os
Content-Type: text/plain; charset=UTF-8;
 name="0001-Let-delete-frame-functions-quit-out-of-frame-deletio.patch"
Content-Disposition: attachment;
 filename*0="0001-Let-delete-frame-functions-quit-out-of-frame-deletio.pa";
 filename*1="tch"
Content-Transfer-Encoding: base64

RnJvbSBlYTdhNmZmNTQxY2NmYWU0NzRmMzJmZmExZGVkZDM2NjdlZGU2M2I3IE1vbiBTZXAg
MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBKaW0gUG9ydGVyIDxqcG9ydGVyYnVnc0BnbWFpbC5j
b20+CkRhdGU6IFR1ZSwgMSBOb3YgMjAyMiAxNToyODoxOCAtMDcwMApTdWJqZWN0OiBbUEFU
Q0hdIExldCAnZGVsZXRlLWZyYW1lLWZ1bmN0aW9ucycgcXVpdCBvdXQgb2YgZnJhbWUgZGVs
ZXRpb24gaWYKIEZPUkNFIGlzIG5pbAoKKiBzcmMvZnJhbWUuYyAoZGVsZXRlX2ZyYW1lKTog
V2hlbiBGT1JDRSBpcyBuaWwsIGNhbGwKJ2RlbGV0ZS1mcmFtZS1mdW5jdGlvbnMnIHdpdGgg
J2NhbGwyJyBpbnN0ZWFkIG9mICdzYWZlX2NhbGwyJyB0byBhbGxvdwpob29rcyB0byBxdWl0
IG91dC4KLS0tCiBzcmMvZnJhbWUuYyB8IDYgKysrKystCiAxIGZpbGUgY2hhbmdlZCwgNSBp
bnNlcnRpb25zKCspLCAxIGRlbGV0aW9uKC0pCgpkaWZmIC0tZ2l0IGEvc3JjL2ZyYW1lLmMg
Yi9zcmMvZnJhbWUuYwppbmRleCBmMDc2YTViYTU0Li45NzIyZWZhNTA1IDEwMDY0NAotLS0g
YS9zcmMvZnJhbWUuYworKysgYi9zcmMvZnJhbWUuYwpAQCAtMjAzNyw3ICsyMDM3LDExIEBA
IGRlbGV0ZV9mcmFtZSAoTGlzcF9PYmplY3QgZnJhbWUsIExpc3BfT2JqZWN0IGZvcmNlKQog
ICAgICAgeF9jbGlwYm9hcmRfbWFuYWdlcl9zYXZlX2ZyYW1lIChmcmFtZSk7CiAjZW5kaWYK
IAotICAgICAgc2FmZV9jYWxsMiAoUXJ1bl9ob29rX3dpdGhfYXJncywgUWRlbGV0ZV9mcmFt
ZV9mdW5jdGlvbnMsIGZyYW1lKTsKKyAgICAgIC8qIElmIEZPUkNFIGlzIG5pbCwgYWxsb3cg
aG9va3MgdG8gcXVpdCBvdXQgb2YgZnJhbWUgZGVsZXRpb24uICAqLworICAgICAgaWYgKE5J
TFAgKGZvcmNlKSkKKwljYWxsMiAoUXJ1bl9ob29rX3dpdGhfYXJncywgUWRlbGV0ZV9mcmFt
ZV9mdW5jdGlvbnMsIGZyYW1lKTsKKyAgICAgIGVsc2UKKwlzYWZlX2NhbGwyIChRcnVuX2hv
b2tfd2l0aF9hcmdzLCBRZGVsZXRlX2ZyYW1lX2Z1bmN0aW9ucywgZnJhbWUpOwogICAgIH0K
IAogICAvKiBkZWxldGVfZnJhbWVfZnVuY3Rpb25zIG1heSBoYXZlIGRlbGV0ZWQgYW55IGZy
YW1lLCBpbmNsdWRpbmcgdGhpcwotLSAKMi4yNS4xCgo=

--------------Rbi4e1m0rLHYKzgxzaYbA2os--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#58909; Package emacs. Full text available.

Message received at 58909 <at> debbugs.gnu.org:


Received: (at 58909) by debbugs.gnu.org; 1 Nov 2022 16:11:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 01 12:11:49 2022
Received: from localhost ([127.0.0.1]:44067 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1optrh-0000HU-Eb
	for submit <at> debbugs.gnu.org; Tue, 01 Nov 2022 12:11:49 -0400
Received: from mail-pf1-f178.google.com ([209.85.210.178]:40866)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jporterbugs@HIDDEN>) id 1optrf-0000HG-Ac
 for 58909 <at> debbugs.gnu.org; Tue, 01 Nov 2022 12:11:47 -0400
Received: by mail-pf1-f178.google.com with SMTP id y13so13880443pfp.7
 for <58909 <at> debbugs.gnu.org>; Tue, 01 Nov 2022 09:11:47 -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=utqA4ISbWGl45yR/IPhYCYfp1heNQLwY17UMC4oTTj0=;
 b=NndV+GTAYAplRmjx5kJlm22tbqUb/kexg7gnCPlFFVsB6TwTnmnIKVYW3ECwkqn8SB
 nDVDa4LmRIIMFHmWp8Ga+Z+fP8HycSuXcB/EZI90iG0vGvgScj+0zxE2OJF//jlTKxPB
 T7wS/d5KEzeS8Pq2BKX2LIUcVJQabGw0/3uv7CG1L6dq8c6skOlf0de2Xoz0B7x59Nn5
 s7LlsDys4VLnF/uAl1DGvypmCS5FHB/AP4cdB2fFWiAWOjqXqUmwPlWqeeshlalUVcBX
 +w1xLqbsPd5cixlbWIlomfmI6v5eeBXRUNnwS0m5GDTjMe6pgOB2n9OaaxXc4wVHRmsr
 U6gw==
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=utqA4ISbWGl45yR/IPhYCYfp1heNQLwY17UMC4oTTj0=;
 b=C0kl1185SYHnKMh+/btbw9jIQPkMdpDcI+8q4XrSXaBtvHBZsXgHpdeOJyIL/Cv/v6
 o+nfwXLFs8YNIOpwn/6UEJVAFl/FVnVYDW8WTa67NtfNdg+QjCYwP2hDpLHegGd5E6Zx
 9nC+Hh9By9V3EPHar6jWu5hJmx2yTI9OGOncud1oQy3jkBWlaPOwl9np9Uv8uchHzTo1
 q/MOFrqA6Db36ELmG4CkMZeMyoT1iXS+lbizZj9t1M0SRNMM+oXthATK20dvAubQ4A0i
 vRLZv4ejNxW0PI7YdYGs2X51RhyEsbEpM41xQEbfNPUcf9TO+qkpBNzB+th7S4HAT1FX
 93wQ==
X-Gm-Message-State: ACrzQf0kE20UOLg57XKTFcHXcVIVfIZjid01Z+7CzM1mJZPpC5+1xgEB
 S9qDLbBUBZR0TOP/aiPA7FfMWnWumw8=
X-Google-Smtp-Source: AMsMyM5R+a8MY0hMr8I036AQqF+20mDhmEfqV2yIGEkiMEXmU44MX7AkQXcWYtUqRHnkHBbtV8JfNw==
X-Received: by 2002:a63:7252:0:b0:46f:9763:7355 with SMTP id
 c18-20020a637252000000b0046f97637355mr14090383pgn.542.1667319101428; 
 Tue, 01 Nov 2022 09:11:41 -0700 (PDT)
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
 m12-20020a170902db0c00b0018725c2fc46sm3604399plx.303.2022.11.01.09.11.39
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Tue, 01 Nov 2022 09:11:40 -0700 (PDT)
Message-ID: <b5172c2a-9cb1-7e37-6c9c-e14eeff8eb20@HIDDEN>
Date: Tue, 1 Nov 2022 09:11:40 -0700
MIME-Version: 1.0
Subject: Re: bug#58909: 29.0.50; [WIP PATCH] Deleting the last frame of an
 emacsclient doesn't ask to save
Content-Language: en-US
To: Eli Zaretskii <eliz@HIDDEN>
References: <9a70f868-ca50-52fc-af3e-23813af104f2@HIDDEN>
 <83zgdcduxm.fsf@HIDDEN> <53238b5b-3e0a-3dfe-eeba-f37cafa81f50@HIDDEN>
 <838rkveq3n.fsf@HIDDEN> <7de45884-b4c9-4a4c-777c-5db17b3bacca@HIDDEN>
 <835yfzeobt.fsf@HIDDEN> <7694fcf2-8982-9099-5eb8-39835d049847@HIDDEN>
 <83y1svch5u.fsf@HIDDEN>
From: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <83y1svch5u.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 58909
Cc: 58909 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On 10/31/2022 11:39 PM, Eli Zaretskii wrote:
>> Date: Mon, 31 Oct 2022 14:06:16 -0700
>> Cc: 58909 <at> debbugs.gnu.org
>> From: Jim Porter <jporterbugs@HIDDEN>
>>
>> 1) For now, just make the change in my patch to 'delete-frame' in
>> src/frame.c to allow hooks in 'delete-frame-functions' to quit out of
>> frame deletion. That way, users who want the rest of the behavior in my
>> patch can just replace 'server-handle-delete-frame' with their own Elisp
>> function. This change isn't entirely without risk, since it could cause
>> some hooks to go from silently signaling an error to making it
>> impossible to delete frames, but I'm not sure that will come up in
>> practice (and if it does, the hooks can be fixed easily enough).
> 
> I don't see how this would serve well the use case you want to enable.
> We are talking about prompting the user to save unsaved buffers, yes?
> So adding a hook in server-delete-client sounds like a much better
> solution to me, as it doesn't affect the (much more general)
> delete-frame in any way.

I think a hook on 'server-delete-client' could work well. It'd make it 
easier to write hooks that run at the right time compared to using other 
existing hooks. In fact, I had a similar idea for bug#51993[1]. In that 
case I ended up adding 2 hooks to 'server-delete-client', but that was 
just to work around a strange bug I saw in testing; I could probably fix 
that in a better way with some more effort so that we only need one new 
hook.

However, I'm not sure how to do this in a complete way without tweaking 
'delete-frame-functions'. Deleting a frame can cause Emacs to delete the 
client if that was the last frame for the client; that's 
long-established behavior, so we shouldn't change it. But that poses a 
problem. If 1) I delete a frame, 2) it calls 'server-delete-client', and 
3) some 'server-delete-client-hook' prompts me, then I might try to quit 
out via C-g. Without my change to how 'delete-frame-functions' are run, 
then C-g would only quit out of 'server-delete-client', but would still 
delete the frame. At least for some emacsclient use cases, that could be 
a problem.

For example, suppose I have a system called "remotehost" with an "emacs 
--daemon" instance and EDITOR="emacsclient -c":

   me@localhost $ ssh -X remotehost
   ...
   me@remotehost $ git commit

   ;; emacsclient starts and creates a new frame on my local display.
   ;; Start editing the git commit message.
   ;; Get distracted, do some other stuff...

   ;; ... finish up the other stuff, click "X" on the emacsclient frame.
   Save file /home/me/src/project/.git/COMMIT_EDITMSG?
   ;; Realize, "Oh yeah! I forgot to finish this commit message."
   C-g

Without the 'delete-frame-functions' change, I'd now be left with no 
Emacs frames on my localhost, but the emacsclient is still running. That 
would be inconvenient, since I'd have to do more work to fix the 
situation. The best way I can think of would be to start another 
emacsclient locally, do the edits to COMMIT_EDITMSG, and then 'C-x #' to 
finish editing. It'd be a lot nicer if 'C-g' stopped the frame from 
getting deleted. (Incidentally, that's how it would work in a regular, 
non-client/server Emacs. Clicking "X" on the last frame actually calls 
'save-buffer-kill-emacs' instead of 'delete-frame', and you can 'C-g' 
out of that to keep the frame open.)

> You can start the discussion now, from my POV.  But if having a hook
> in server-delete-client is good enough, I don't see why we would need
> to discuss an actual behavior change.

Yeah, let's finish up the discussion here, and if I have any open 
questions that could use a wider audience, I'll post to emacs-devel 
afterwards.

[1] https://lists.gnu.org/archive/html/bug-gnu-emacs/2022-10/msg00908.html




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#58909; Package emacs. Full text available.

Message received at 58909 <at> debbugs.gnu.org:


Received: (at 58909) by debbugs.gnu.org; 1 Nov 2022 06:39:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 01 02:39:52 2022
Received: from localhost ([127.0.0.1]:42526 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1opkw9-0008Th-BN
	for submit <at> debbugs.gnu.org; Tue, 01 Nov 2022 02:39:52 -0400
Received: from eggs.gnu.org ([209.51.188.92]:51610)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1opkw7-0008TU-KG
 for 58909 <at> debbugs.gnu.org; Tue, 01 Nov 2022 02:39:47 -0400
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 <eliz@HIDDEN>)
 id 1opkw1-00070j-6W; Tue, 01 Nov 2022 02:39:41 -0400
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=XUI3bjSQ1JbVaAiD2rebCxFgHj0+bnr8TpPIh7afavA=; b=QhfFpPUlI7AA
 GOEL/TBs6i4go5X54fl0150ylQAB6XidRFXwjuoUea2i0eDEpm8li8yPCgnZ6J+wi6cESZwAwzPPu
 0eSA/h1v/Dani2Wa5jP1/RTWxLwPj8EGi9hFbq7EYSVSAKy5qMCCl0Zvyt+5V5/zA9Ytn5k8ZeXG1
 LJa/c94YHgwIoATyHD2bgpAMQExmlcxQniRONjhj4YAlsTMcvSvLtVFBeA6ACE5Z61g01zBN3g4dv
 t/GYejI1k9UKrxV0f+4hNVQiVXhEH8nDTPwMRVZsx9isiwViz6VI+lVVHdpjFtDZQxBjeYv5HzRaz
 RKLAT6wZI/YYhU/PZgNgOQ==;
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 <eliz@HIDDEN>)
 id 1opkvz-0006Ap-En; Tue, 01 Nov 2022 02:39:39 -0400
Date: Tue, 01 Nov 2022 08:39:25 +0200
Message-Id: <83y1svch5u.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <7694fcf2-8982-9099-5eb8-39835d049847@HIDDEN> (message from
 Jim Porter on Mon, 31 Oct 2022 14:06:16 -0700)
Subject: Re: bug#58909: 29.0.50; [WIP PATCH] Deleting the last frame of an
 emacsclient doesn't ask to save
References: <9a70f868-ca50-52fc-af3e-23813af104f2@HIDDEN>
 <83zgdcduxm.fsf@HIDDEN> <53238b5b-3e0a-3dfe-eeba-f37cafa81f50@HIDDEN>
 <838rkveq3n.fsf@HIDDEN> <7de45884-b4c9-4a4c-777c-5db17b3bacca@HIDDEN>
 <835yfzeobt.fsf@HIDDEN> <7694fcf2-8982-9099-5eb8-39835d049847@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 58909
Cc: 58909 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Mon, 31 Oct 2022 14:06:16 -0700
> Cc: 58909 <at> debbugs.gnu.org
> From: Jim Porter <jporterbugs@HIDDEN>
> 
> 1) For now, just make the change in my patch to 'delete-frame' in 
> src/frame.c to allow hooks in 'delete-frame-functions' to quit out of 
> frame deletion. That way, users who want the rest of the behavior in my 
> patch can just replace 'server-handle-delete-frame' with their own Elisp 
> function. This change isn't entirely without risk, since it could cause 
> some hooks to go from silently signaling an error to making it 
> impossible to delete frames, but I'm not sure that will come up in 
> practice (and if it does, the hooks can be fixed easily enough).

I don't see how this would serve well the use case you want to enable.
We are talking about prompting the user to save unsaved buffers, yes?
So adding a hook in server-delete-client sounds like a much better
solution to me, as it doesn't affect the (much more general)
delete-frame in any way.

> 2) After the Emacs 29 branch is cut, maybe (emphasis on maybe) discuss 
> the changes to prompting on emacs-devel, and possibly even commit it to 
> the master branch with the caveat that if it causes problems for anyone, 
> we back it out. Obviously not everyone follows emacs-devel, but this 
> would give people a chance to provide feedback, positive or negative.

You can start the discussion now, from my POV.  But if having a hook
in server-delete-client is good enough, I don't see why we would need
to discuss an actual behavior change.

(And the proviso of backing out changes doesn't work in this project,
IME: people get defensive about their changes, and perceive reverting
them as personal insult.  So we do that only in very extreme cases.)




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#58909; Package emacs. Full text available.

Message received at 58909 <at> debbugs.gnu.org:


Received: (at 58909) by debbugs.gnu.org; 1 Nov 2022 06:17:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 01 02:17:27 2022
Received: from localhost ([127.0.0.1]:42513 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1opkaU-0007wx-UR
	for submit <at> debbugs.gnu.org; Tue, 01 Nov 2022 02:17:27 -0400
Received: from eggs.gnu.org ([209.51.188.92]:53068)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1opkaT-0007wk-MC
 for 58909 <at> debbugs.gnu.org; Tue, 01 Nov 2022 02:17:25 -0400
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 <eliz@HIDDEN>)
 id 1opkaO-00075j-8G; Tue, 01 Nov 2022 02:17:20 -0400
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=U37Xu2NVqu5RsHjXyjJ3Y5y2RpJnksUbN/PMjf52Y4g=; b=dUjj5wWGsl3x
 pU8FjEmxRH6MhmVO7zmGAfU7r2kIhSjggdIhcHPUsa96WCIwi17Lqeh8AnSb5yaq1ZH9VzxBvQGv6
 S6Xk6VXJ7hvN7Fkc7IXXktF8ZHZKirTW8CL0t3hEGrBZKe3sQZsGG8CsyfAj5Uj0TgJm8yMb6ia7R
 hVsNbZbsW74kRwb+O0AP6HTkl2R/bDYSxMnenRtkep9C+F+VNliG0VUHj75bf/oUZ93jyqhACDEa0
 aRTL2uUExcIHnX9Mf8jMojE0oKPk9APhb+o/XPT1NgKkHXRTrtnJ/9vSOCd8BsQFBRxZfcfRYXHKC
 Fc0oVtppDFEKOidWM8fPWg==;
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 <eliz@HIDDEN>)
 id 1opkaN-0007BM-IB; Tue, 01 Nov 2022 02:17:19 -0400
Date: Tue, 01 Nov 2022 08:17:06 +0200
Message-Id: <8335b3dwrh.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <cbe7fa28-a4d0-fb28-ef77-153d3df20454@HIDDEN> (message from
 Jim Porter on Mon, 31 Oct 2022 13:28:01 -0700)
Subject: Re: bug#58909: 29.0.50; [WIP PATCH] Deleting the last frame of an
 emacsclient doesn't ask to save
References: <9a70f868-ca50-52fc-af3e-23813af104f2@HIDDEN>
 <83zgdcduxm.fsf@HIDDEN> <a18c7b22-b579-a5dd-44fa-af6a64ed34be@HIDDEN>
 <83bkpretpn.fsf@HIDDEN> <e2f5888f-4e28-b34b-9b55-68ec39f11079@HIDDEN>
 <837d0fepoz.fsf@HIDDEN> <cbe7fa28-a4d0-fb28-ef77-153d3df20454@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 58909
Cc: 58909 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Mon, 31 Oct 2022 13:28:01 -0700
> Cc: 58909 <at> debbugs.gnu.org
> From: Jim Porter <jporterbugs@HIDDEN>
> 
> > My interpretation of why "C-x C-c" prompts is that it does the same as
> > when you use it from a non-client frame.  We want the same UX in both
> > cases.  "C-x 5 0" should IMO likewise produce the same behavior in
> > both cases.
> 
> That's actually my goal too: I'd like to ensure that the UX for a client 
> frame is as similar as possible as for a non-client frame. Since we 
> disagree on what that similarity should be, I guess that means we have 
> different mental models for some part of this. If it helps, I'll try to 
> explain how I think of it.

Thanks.  Our notions of "similarity" are different.  For me, it's the
immediate effect of the command; for you, it's what happens in Emacs
under the hood, in particular how many other "similar" frames remain.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#58909; Package emacs. Full text available.

Message received at 58909 <at> debbugs.gnu.org:


Received: (at 58909) by debbugs.gnu.org; 31 Oct 2022 21:06:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 31 17:06:26 2022
Received: from localhost ([127.0.0.1]:42045 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1opbzG-0002HL-4L
	for submit <at> debbugs.gnu.org; Mon, 31 Oct 2022 17:06:26 -0400
Received: from mail-pl1-f179.google.com ([209.85.214.179]:34726)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jporterbugs@HIDDEN>) id 1opbzD-0002H6-Ko
 for 58909 <at> debbugs.gnu.org; Mon, 31 Oct 2022 17:06:24 -0400
Received: by mail-pl1-f179.google.com with SMTP id v17so8810943plo.1
 for <58909 <at> debbugs.gnu.org>; Mon, 31 Oct 2022 14:06:23 -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=3ms3Ghlmjhv3m2dpWu/ilR/zgusZqOXJ6N8fusKh3cw=;
 b=I2OPz2VVt7yAhpoidri8ytEGNN7oU2+8J+0UMQcLfal/27mEFl5p9Ws6ueuFmSlp5G
 7PZpAwh9MyndjT3mGoumsVThXAVTiAWT6XoVqzydLCuswNwRcAfnRUT46GJCDY0lW5Sn
 BzpbwmNdd0kFk8J0heTF+kFmnhs7jgp0w5DR5nXNoJEtT3YH/ZUUbmhxwfh+JerUdu27
 FBIuc/yXmbkXhxNxhCS7sF3QursUbrTC2kHIE/6j3gEnp7yx/1U9A048ScNOPiJ2OeRB
 syVcnx1TQvwk5GfRfAyxis797lb4lSGZD/6o1Gj0gTRJ0Z9H845J0L6Nn+d4kBglpuYk
 VHUA==
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=3ms3Ghlmjhv3m2dpWu/ilR/zgusZqOXJ6N8fusKh3cw=;
 b=V9MxQ3nRtJ2sDLmZjNBb21MCHBrFLqs+5vEcIn1bRCU98yMWfsxlb7XDAv7/ufhqIH
 Ou3v1a51FsJMbQkOeideWrBhiGEwcsVrWON816PzTqXMNL7/Bz7QRzJGXGalseEkTXlc
 UmR1QeXARa1cMnV1mUbQ+h7iOWVAQUfWHZ2AFxNICiYp6+EpFk/aUn/uTgmurs8enTUh
 mnhgmXtlXL7kVjdIdDwVlnxDcEozzYLZluJF+HKQMWVSV0EpB+Wiyj0GFDhcRiXkNwQe
 qVydRYG8qCr4LQOxVXDX0cXjL1qnGZDc6wPpb/rMfZR2lrNow4PmqayoDfdJE4rNFDbz
 r5Lw==
X-Gm-Message-State: ACrzQf3PKSquitUyK/+ymmkdLizrBjFnMCKgoaHkgXvyld5qQPIA9+54
 RtelxN9bWjph4o583hdsRYk=
X-Google-Smtp-Source: AMsMyM7C9bBshHQ8HhVrHzuEDGRZeLS3cKktVwbHjLrAWqtIWz73DRddPK/DS7G8rb2XRVHOlRANhg==
X-Received: by 2002:a17:903:240a:b0:183:6555:7a89 with SMTP id
 e10-20020a170903240a00b0018365557a89mr16044100plo.68.1667250377749; 
 Mon, 31 Oct 2022 14:06:17 -0700 (PDT)
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
 s67-20020a625e46000000b00560cdb3784bsm5045142pfb.60.2022.10.31.14.06.16
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Mon, 31 Oct 2022 14:06:16 -0700 (PDT)
Message-ID: <7694fcf2-8982-9099-5eb8-39835d049847@HIDDEN>
Date: Mon, 31 Oct 2022 14:06:16 -0700
MIME-Version: 1.0
Subject: Re: bug#58909: 29.0.50; [WIP PATCH] Deleting the last frame of an
 emacsclient doesn't ask to save
Content-Language: en-US
To: Eli Zaretskii <eliz@HIDDEN>
References: <9a70f868-ca50-52fc-af3e-23813af104f2@HIDDEN>
 <83zgdcduxm.fsf@HIDDEN> <53238b5b-3e0a-3dfe-eeba-f37cafa81f50@HIDDEN>
 <838rkveq3n.fsf@HIDDEN> <7de45884-b4c9-4a4c-777c-5db17b3bacca@HIDDEN>
 <835yfzeobt.fsf@HIDDEN>
From: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <835yfzeobt.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 58909
Cc: 58909 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On 10/31/2022 1:21 PM, Eli Zaretskii wrote:
>> Date: Mon, 31 Oct 2022 13:01:55 -0700
>> Cc: 58909 <at> debbugs.gnu.org
>> From: Jim Porter <jporterbugs@HIDDEN>
>>
>> A user might instead type "emacsclient -c file.txt" (or use "-t", etc)
>> to create an all-new frame. In that case, my patch would prompt. But if
>> the user is already typing "emacsclient -c file.txt", then "emacsclient
>> -nc foo.txt" is just one more character, and it would make it explicit
>> that the client isn't waiting around for file.txt. Then my patch would
>> *not* prompt.
> 
> Yes, this new behavior can be worked around, in more than one way.
> But people get annoyed by changes which invalidate their muscle memory
> of many years.  So we must in each case like this to have a very good
> reason for such changes, otherwise people would rightfully conclude
> that our decisions are more-or-less are arbitrary and basically prefer
> someone's workflows over those of others.

I can definitely understand that position. It's an aspect of Emacs that 
I know I appreciate very much. Emacs has been around for a long time, 
and hopefully will be around for a lot longer. I'm not sure I have a 
great sense of how to balance Emacs' history with ensuring that the next 
decade (and more!) of Emacs is on the best footing possible.

In any case, unless my other recent messages have convinced you 
otherwise, what do you think of the following:

1) For now, just make the change in my patch to 'delete-frame' in 
src/frame.c to allow hooks in 'delete-frame-functions' to quit out of 
frame deletion. That way, users who want the rest of the behavior in my 
patch can just replace 'server-handle-delete-frame' with their own Elisp 
function. This change isn't entirely without risk, since it could cause 
some hooks to go from silently signaling an error to making it 
impossible to delete frames, but I'm not sure that will come up in 
practice (and if it does, the hooks can be fixed easily enough).

2) After the Emacs 29 branch is cut, maybe (emphasis on maybe) discuss 
the changes to prompting on emacs-devel, and possibly even commit it to 
the master branch with the caveat that if it causes problems for anyone, 
we back it out. Obviously not everyone follows emacs-devel, but this 
would give people a chance to provide feedback, positive or negative.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#58909; Package emacs. Full text available.

Message received at 58909 <at> debbugs.gnu.org:


Received: (at 58909) by debbugs.gnu.org; 31 Oct 2022 20:28:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 31 16:28:12 2022
Received: from localhost ([127.0.0.1]:41910 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1opbOF-00019s-OD
	for submit <at> debbugs.gnu.org; Mon, 31 Oct 2022 16:28:12 -0400
Received: from mail-pj1-f49.google.com ([209.85.216.49]:40521)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jporterbugs@HIDDEN>) id 1opbOD-00019c-NS
 for 58909 <at> debbugs.gnu.org; Mon, 31 Oct 2022 16:28:10 -0400
Received: by mail-pj1-f49.google.com with SMTP id
 r61-20020a17090a43c300b00212f4e9cccdso16928172pjg.5
 for <58909 <at> debbugs.gnu.org>; Mon, 31 Oct 2022 13:28:09 -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=+MmfvQpWNEMKRg5JSy+UwnpkwThKMShKGipjktS1shY=;
 b=OW3SH8fluJZAv1ExidRUSwcQbF7U0dscbiXfag9/68eNX/joOv3VsXsFe3TxAhlYvU
 ZVanVnXi1Fmfu0ULhvn6/Ev0VRPLg97ZIOqPR44HyWYXpmrRI5HQ6mHpqWDdgeXgXzgd
 EAxTT6M8sm8Zp0dpmldwZZtRqgF3ELyGiDBFAU/F9IiqwE3Xs0F+rv9GNFlCWVxbbTj2
 rhIh2pgu8KhjWbiDb8FyrvfaYgLpnfYKjFGm4RKI6fnmlZevxnv/7ymzMXrv6H9qXt82
 OYV0ySHSJn+IQ34jG6rjeETAe4KrwRYyY4trvseWoCHds5jJA1QAPmqJbo7yL9Tz8ZYl
 Zvmg==
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=+MmfvQpWNEMKRg5JSy+UwnpkwThKMShKGipjktS1shY=;
 b=8McDeBuC6CfwuB0ORZ05r3M002wAkv07jxINF7SbglT6HwQE73ptsgBb8hg3eQi2Gt
 D3tO4Xq8Ysoz9VDMGJZ5jkGEu0NyhTo2qLwlaekOOqiMsuRsNxEEElMGgjqd/U57YJ3E
 8NH5VGTru/mQcDqn+QcDN2f4hYa9TuN2z/AZBQwbNS//Zbjd1HIZ9z/5ZjbBg/5smF+g
 h140bo1fojth41F+Fh/+NG6+xZ0Fe4yEuseh6pyiAG40B+LI/Ea+sQ9T0SDZGvgGSHj/
 90bbeuG4qD8JAohoVsPdtX874HuBL4DKFTYktZCmT3lx+K0u11xAUpo0rItuIGBZ1LaF
 I85w==
X-Gm-Message-State: ACrzQf0NXNjFmMhv+lVZfDLB9xu0IdaDDyPcx4Kmv9hfNyNSXC4aZUuL
 V+Bx6zEQklQtQAr96lhv8XI=
X-Google-Smtp-Source: AMsMyM5CxS1sT2LEHB5HSXcjF6AWf5QXpmUo0eaj4IxsuE174i/reXAWHf06n/PM7SVpsOZDkH8Z0Q==
X-Received: by 2002:a17:902:d2d0:b0:186:9e90:699 with SMTP id
 n16-20020a170902d2d000b001869e900699mr16241472plc.172.1667248083736; 
 Mon, 31 Oct 2022 13:28:03 -0700 (PDT)
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
 17-20020a17090a19d100b002036006d65bsm4606935pjj.39.2022.10.31.13.28.02
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Mon, 31 Oct 2022 13:28:03 -0700 (PDT)
Message-ID: <cbe7fa28-a4d0-fb28-ef77-153d3df20454@HIDDEN>
Date: Mon, 31 Oct 2022 13:28:01 -0700
MIME-Version: 1.0
Subject: Re: bug#58909: 29.0.50; [WIP PATCH] Deleting the last frame of an
 emacsclient doesn't ask to save
Content-Language: en-US
To: Eli Zaretskii <eliz@HIDDEN>
References: <9a70f868-ca50-52fc-af3e-23813af104f2@HIDDEN>
 <83zgdcduxm.fsf@HIDDEN> <a18c7b22-b579-a5dd-44fa-af6a64ed34be@HIDDEN>
 <83bkpretpn.fsf@HIDDEN> <e2f5888f-4e28-b34b-9b55-68ec39f11079@HIDDEN>
 <837d0fepoz.fsf@HIDDEN>
From: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <837d0fepoz.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 58909
Cc: 58909 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On 10/31/2022 12:52 PM, Eli Zaretskii wrote:
>> Date: Mon, 31 Oct 2022 12:38:04 -0700
>> From: Jim Porter <jporterbugs@HIDDEN>
>> Cc: 58909 <at> debbugs.gnu.org
>>
>> Still,
>> 'C-x C-c' still prompts in that case too. My understanding is that it
>> does so because when an application is waiting for the emacsclient to
>> finish, you can't go back from killing the terminal/client; you *can*
>> (usually) go back if you're only killing a frame.
> 
> My interpretation of why "C-x C-c" prompts is that it does the same as
> when you use it from a non-client frame.  We want the same UX in both
> cases.  "C-x 5 0" should IMO likewise produce the same behavior in
> both cases.

That's actually my goal too: I'd like to ensure that the UX for a client 
frame is as similar as possible as for a non-client frame. Since we 
disagree on what that similarity should be, I guess that means we have 
different mental models for some part of this. If it helps, I'll try to 
explain how I think of it.

 From a client frame, 'C-x C-c' prompts to save all the file-buffers 
associated with that client, and then kills the client, which kills the 
frames for that client. That's similar to 'C-x C-c' in a non-client 
setting: it kills *all* frames and prompts to save *all* file-buffers. 
So I see the client as a "sub" Emacs: it owns some frames and 
(partially) owns some buffers. Commands on the client then work on that 
subset, and only that subset. Since frames can only be owned by a single 
client, in my mind frame commands also work within that client's subset.

For frame-deletion, non-client Emacs lets you kill a single frame via 
'C-x 5 0' or clicking the X in the frame's title bar. However, if it's 
the last frame, then:

   C-x 5 0    -> Error: "Attempt to delete the sole visible or iconified 
frame"
   Clicking X -> Call 'save-buffers-kill-emacs' (see 'handle-delete-frame')

To me, that would mean that the matching UX for a client with a single 
frame (but possibly other frames for Emacs overall) is:

   C-x 5 0    -> Error
   Clicking X -> Call 'save-buffers-kill-terminal'

Signaling an error for 'C-x 5 0' seems excessively strict to me, so 
calling 'save-buffers-kill-terminal' in both cases seemed like a good 
compromise to me. Instead of getting an error, the user gets a prompt, 
but can still proceed with killing that frame if they're sure.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#58909; Package emacs. Full text available.

Message received at 58909 <at> debbugs.gnu.org:


Received: (at 58909) by debbugs.gnu.org; 31 Oct 2022 20:22:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 31 16:22:30 2022
Received: from localhost ([127.0.0.1]:41900 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1opbIj-00010z-SW
	for submit <at> debbugs.gnu.org; Mon, 31 Oct 2022 16:22:30 -0400
Received: from eggs.gnu.org ([209.51.188.92]:57652)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1opbIi-00010k-0Y
 for 58909 <at> debbugs.gnu.org; Mon, 31 Oct 2022 16:22:28 -0400
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 <eliz@HIDDEN>)
 id 1opbIb-0003SP-ED; Mon, 31 Oct 2022 16:22:21 -0400
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=5YV/1gr9Oo/noJngEW1QPH0aBEUfnaPe2Bfs6Fjftic=; b=jwTLSBgFgvdI
 CbBMYhR0SCooVXoF2OIbOnMwS9MGZYskO/xGGGOSbSPiNU7g/HGzOTg3h5+AjFYSEXN9NquhRwwkh
 gGTinPGrDE/mnZMjtekA5hCLsdj/RVZrsYttOtyVgyqq/nz6cYkfwycqHD9d1cWYabaVtiovyLvAW
 BLSxeJwAykCXy7cNRh7vGpUuETnlobZbXSZ0ZraGy9Kx3HnCgGOoNC6tKj0qozuXIBKfxL0jLLu87
 c0It/a5DcKvm2jSr4kl/T02KyJzcu+fiq+hAq0r+2ChBZFmdkJtRumL1XgnKEY8Gh7IcZpWmYls9Z
 QCo5DZ7vXxrXuuHa29qBWA==;
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 <eliz@HIDDEN>)
 id 1opbIC-0005VM-Nd; Mon, 31 Oct 2022 16:22:06 -0400
Date: Mon, 31 Oct 2022 22:21:42 +0200
Message-Id: <835yfzeobt.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <7de45884-b4c9-4a4c-777c-5db17b3bacca@HIDDEN> (message from
 Jim Porter on Mon, 31 Oct 2022 13:01:55 -0700)
Subject: Re: bug#58909: 29.0.50; [WIP PATCH] Deleting the last frame of an
 emacsclient doesn't ask to save
References: <9a70f868-ca50-52fc-af3e-23813af104f2@HIDDEN>
 <83zgdcduxm.fsf@HIDDEN> <53238b5b-3e0a-3dfe-eeba-f37cafa81f50@HIDDEN>
 <838rkveq3n.fsf@HIDDEN> <7de45884-b4c9-4a4c-777c-5db17b3bacca@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 58909
Cc: 58909 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Mon, 31 Oct 2022 13:01:55 -0700
> Cc: 58909 <at> debbugs.gnu.org
> From: Jim Porter <jporterbugs@HIDDEN>
> 
> A user might instead type "emacsclient -c file.txt" (or use "-t", etc) 
> to create an all-new frame. In that case, my patch would prompt. But if 
> the user is already typing "emacsclient -c file.txt", then "emacsclient 
> -nc foo.txt" is just one more character, and it would make it explicit 
> that the client isn't waiting around for file.txt. Then my patch would 
> *not* prompt.

Yes, this new behavior can be worked around, in more than one way.
But people get annoyed by changes which invalidate their muscle memory
of many years.  So we must in each case like this to have a very good
reason for such changes, otherwise people would rightfully conclude
that our decisions are more-or-less are arbitrary and basically prefer
someone's workflows over those of others.  I'm sorry, but past
behavior gets more weight in such situations, just because it was here
first.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#58909; Package emacs. Full text available.

Message received at 58909 <at> debbugs.gnu.org:


Received: (at 58909) by debbugs.gnu.org; 31 Oct 2022 20:02:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 31 16:02:05 2022
Received: from localhost ([127.0.0.1]:41872 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1opayz-0000WN-Kp
	for submit <at> debbugs.gnu.org; Mon, 31 Oct 2022 16:02:05 -0400
Received: from mail-pl1-f180.google.com ([209.85.214.180]:35358)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jporterbugs@HIDDEN>) id 1opayx-0000Vr-AD
 for 58909 <at> debbugs.gnu.org; Mon, 31 Oct 2022 16:02:03 -0400
Received: by mail-pl1-f180.google.com with SMTP id y4so11716884plb.2
 for <58909 <at> debbugs.gnu.org>; Mon, 31 Oct 2022 13:02:03 -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=tJGDBpx1zGrhFsFhbOzDEZmEZmDdHrcq9tN30PQ3IAo=;
 b=KC4avW09XPWyK+65K5pxrTPXY8RdGoW3oJ+W0mCmEhqnQMvOErj9JTQ0l/zU2tCEYJ
 I8STQIffNljP1B2p9Smb/oa+03DHl7K68X/68S7EDvZR8E8HQYvNz3JB0f4gQrFyrCjf
 ixQR8XewOw3MPeINSRIqKkYwQ/iA+mqExEwzFWMvY33JJgmE5qrWbPuwsBQRKW0C3oY5
 S9yXeUjj2/dMdjcViGnmJzZkncjBrpNkPk+2L36KdquviBM50iJUJpC68gNFuQ8X+OMN
 /Njl4PHv6O/a5Ares+gCU2Krlfzq6qipbXODBebAu1kU47nWeTu+U6lHoeU1aePVHhLb
 qcpw==
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=tJGDBpx1zGrhFsFhbOzDEZmEZmDdHrcq9tN30PQ3IAo=;
 b=zyQoarKKgT5pfYI+iFvoiKmgEmMTisuLuYcaTc8+1B2OLGZrkxjhM7A7ZIeh3cf2WV
 CZr4pSysQf+1DmvUZtwTSL+9GFvJRLIbi/lMRFCemz//yn+cHBlwvghYz8iIasYU/qI/
 As3QhTWcGKt6wtVhuJMsvr3Uuc/3WzCM1HgUeKjlzPpjg64GnI51oRIIHUxp8IYQve5d
 O3JEFZsguRtiyJ7DEA+w368/4fjoHa3WVeO/ujTQuReqFXqWL14J3SrD5ISDzlbcwMly
 jkJ9ADm2jjytsEbtbz0Tb47JTu2Rw7JHn0JeRnubd3r6cv80OoO9tSX+40MvFCj2jhmB
 Eu1g==
X-Gm-Message-State: ACrzQf1InOoMm9bQ2Qzd7KsA5zwr969v2rcUQ9IR01EAi0RJxdnO/ylA
 d3fLCH6twk4hkfq8E+c0UsmR9XFhug4=
X-Google-Smtp-Source: AMsMyM6oZ9QxB0P6wURrUALC7pbIapGxajmSCzduUAT6hdOcjG49CAigTJA6bQ8zyVTb/w8N+/2QMQ==
X-Received: by 2002:a17:902:8ec8:b0:186:9c32:79c8 with SMTP id
 x8-20020a1709028ec800b001869c3279c8mr16250828plo.105.1667246517379; 
 Mon, 31 Oct 2022 13:01:57 -0700 (PDT)
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
 68-20020a17090a09ca00b0021134a19ae2sm4548058pjo.50.2022.10.31.13.01.56
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Mon, 31 Oct 2022 13:01:56 -0700 (PDT)
Message-ID: <7de45884-b4c9-4a4c-777c-5db17b3bacca@HIDDEN>
Date: Mon, 31 Oct 2022 13:01:55 -0700
MIME-Version: 1.0
Subject: Re: bug#58909: 29.0.50; [WIP PATCH] Deleting the last frame of an
 emacsclient doesn't ask to save
Content-Language: en-US
To: Eli Zaretskii <eliz@HIDDEN>
References: <9a70f868-ca50-52fc-af3e-23813af104f2@HIDDEN>
 <83zgdcduxm.fsf@HIDDEN> <53238b5b-3e0a-3dfe-eeba-f37cafa81f50@HIDDEN>
 <838rkveq3n.fsf@HIDDEN>
From: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <838rkveq3n.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 58909
Cc: 58909 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On 10/31/2022 12:43 PM, Eli Zaretskii wrote:
>> Date: Mon, 31 Oct 2022 12:28:23 -0700
>> Cc: 58909 <at> debbugs.gnu.org
>> From: Jim Porter <jporterbugs@HIDDEN>
>>
>>> I'm uneasy with this incompatible behavior change.  I can think of
>>> some legitimate use cases where "C-x 5 0" should not prompt, e.g., if
>>> the user intends to keep editing the file, and no application is
>>> waiting for the client to finish.  Why break such flows?
>>
>> After thinking about this some more, I realized that I didn't properly
>> address this part of your message. If no application is waiting for the
>> client to finish, then the user hopefully used "--no-wait" when starting
>> emacsclient.
> 
> No, I meant that the user invoked emacsclient from the shell prompt,
> for example.  As opposed to some application invoking emacsclient via
> $EDITOR or similar.

If a user simply typed "emacsclient file.txt", that would visit file.txt 
in an existing frame (if possible), so that frame wouldn't be associated 
with the emacsclient process the user just started. Pressing 'C-x 5 0' 
wouldn't need to prompt then: it's not deleting the last frame 
associated with that client, so the code in 'server-handle-delete-frame' 
doesn't apply. (Note: It's possible that the frame in question is the 
last frame of some *other* client though.)

A user might instead type "emacsclient -c file.txt" (or use "-t", etc) 
to create an all-new frame. In that case, my patch would prompt. But if 
the user is already typing "emacsclient -c file.txt", then "emacsclient 
-nc foo.txt" is just one more character, and it would make it explicit 
that the client isn't waiting around for file.txt. Then my patch would 
*not* prompt.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#58909; Package emacs. Full text available.

Message received at 58909 <at> debbugs.gnu.org:


Received: (at 58909) by debbugs.gnu.org; 31 Oct 2022 19:52:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 31 15:52:34 2022
Received: from localhost ([127.0.0.1]:41868 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1opapm-0000Dz-ET
	for submit <at> debbugs.gnu.org; Mon, 31 Oct 2022 15:52:34 -0400
Received: from eggs.gnu.org ([209.51.188.92]:35218)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1opapl-0000Dc-Hy
 for 58909 <at> debbugs.gnu.org; Mon, 31 Oct 2022 15:52:34 -0400
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 <eliz@HIDDEN>)
 id 1opapg-0000T9-An; Mon, 31 Oct 2022 15:52:28 -0400
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=v6CAKstmXy1RZvlNm8W5QT/1JtqXjylQioojQYPteSY=; b=HQ//AqfPWtIe
 yuNyd2fRr29p7yc0rVmhq1AwfPFXWoK/EVjYcOeVT8KNL0zLh+Zm8/nSUXsGvofX3XoqwixKck6oz
 CxUaW1LB5aC69l/zOCAwp8Q6d24QWq4SoTXifG0D2MxgN67dgFpMNj0dkNKbmjUXnAOCraqJhy69p
 yqar46OkaSqlyF7l4Dwyw+8BugNd90obstUq/hUMz+294pnCtWbdm146iqASC6upUFMgyIv3A3M2M
 +sLuJ4/x2qU+JQsvVhs39R3iu8/yHBpYhXeeI/o3yi4mwr0FTx47Hel3HNQTA9kW21GYjsVyCgUkn
 PldqBJbOIWOHuNVQJ/dKCg==;
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 <eliz@HIDDEN>)
 id 1opapf-0004sJ-9w; Mon, 31 Oct 2022 15:52:28 -0400
Date: Mon, 31 Oct 2022 21:52:12 +0200
Message-Id: <837d0fepoz.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <e2f5888f-4e28-b34b-9b55-68ec39f11079@HIDDEN> (message from
 Jim Porter on Mon, 31 Oct 2022 12:38:04 -0700)
Subject: Re: bug#58909: 29.0.50; [WIP PATCH] Deleting the last frame of an
 emacsclient doesn't ask to save
References: <9a70f868-ca50-52fc-af3e-23813af104f2@HIDDEN>
 <83zgdcduxm.fsf@HIDDEN> <a18c7b22-b579-a5dd-44fa-af6a64ed34be@HIDDEN>
 <83bkpretpn.fsf@HIDDEN> <e2f5888f-4e28-b34b-9b55-68ec39f11079@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 58909
Cc: 58909 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Mon, 31 Oct 2022 12:38:04 -0700
> From: Jim Porter <jporterbugs@HIDDEN>
> Cc: 58909 <at> debbugs.gnu.org
> 
> On 10/31/2022 11:25 AM, Eli Zaretskii wrote:
> >> I think it does about the same amount of harm as pressing 'C-x C-c' in
> >> an emacs client.
> > 
> > How can you say that?  "C-x C-c" kills the entire terminal, whereas
> > "C-x 5 0" kills just one frame!
> 
> When there's only one frame left for the client, 'C-x 5 0' *also* kills 
> the entire terminal.

But "C-x 5 0" doesn't have the same significance as "C-x C-c".  They
are different in the non-client use, and they are different in the
client use.  That someone could perceive them as very similar because
some aspects of what they do are the same doesn't mean they are
similar enough to behave the same wrt the prompt to save.

> Of course, 'C-x C-c' also has the effect of killing any other frames for 
> that client, but that that doesn't apply there's only one frame.

It would (or at least could) be possible to reason that way.  But it
could be argued that forcing the user to distinguish between the last
"C-x 5 0" and any other is bad UI.  When I type "C-x 5 0" I don't want
to expect different behavior depending on how many frames the current
client has.  "C-x 5 0" means "delete this frame", no more, no less.

> Still, 
> 'C-x C-c' still prompts in that case too. My understanding is that it 
> does so because when an application is waiting for the emacsclient to 
> finish, you can't go back from killing the terminal/client; you *can* 
> (usually) go back if you're only killing a frame.

My interpretation of why "C-x C-c" prompts is that it does the same as
when you use it from a non-client frame.  We want the same UX in both
cases.  "C-x 5 0" should IMO likewise produce the same behavior in
both cases.

> See my other message about this too: we could make sure Emacs only 
> prompts the user when deleting a frame if doing so would kill a terminal 
> that's actually waiting for some files to be saved. If the client was 
> invoked with "--no-wait", we could just silently delete the frame: 
> there's no application waiting for a file.

This has the same problem, IMO: it changes long-time behavior of
client frames in incompatible ways.  I don't think it's right, since
the reasons for these changes are rather weak.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#58909; Package emacs. Full text available.

Message received at 58909 <at> debbugs.gnu.org:


Received: (at 58909) by debbugs.gnu.org; 31 Oct 2022 19:43:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 31 15:43:51 2022
Received: from localhost ([127.0.0.1]:41863 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1opahL-0008BC-Eg
	for submit <at> debbugs.gnu.org; Mon, 31 Oct 2022 15:43:51 -0400
Received: from eggs.gnu.org ([209.51.188.92]:52102)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1opahF-0008Aa-Q3
 for 58909 <at> debbugs.gnu.org; Mon, 31 Oct 2022 15:43:49 -0400
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 <eliz@HIDDEN>)
 id 1opahA-0005BW-Hb; Mon, 31 Oct 2022 15:43:40 -0400
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=fOv9kEdE6LIqaOMC6m4D3/tOb7szVTsgvRweqmbs+o0=; b=rT6s9RpuaBAQ
 BzOIrtc3qsz49T27bearmeoEXPh9DgpTUD0R1FbPFHkc/HvfewZW2pkD5tCKT7HddY8CjpmAxJh3B
 maFcouey/+mFX653B+kz3iJSZeSVESlDTRdO4KCUgenITIaxqCtUmetHNqY4fZxXLTBFQjRgJ7dDx
 c34/cnZhvt+qbff1Ua4lp4bVN6/zQxTG2mAkzH4lytZZS2EUUCUUPJk+Oi7x6cann6qbodeDFm/FS
 XvIsDCS3TprMJwGBpUmWSWsgVdI5uyV1p5+TKxi6WwkiqvxZjd+NkOFIbuoq2ElNtodjw7FrN2SWi
 NwM9T6eDLwkuuTnr0IOuww==;
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 <eliz@HIDDEN>)
 id 1opah9-00042H-G8; Mon, 31 Oct 2022 15:43:40 -0400
Date: Mon, 31 Oct 2022 21:43:24 +0200
Message-Id: <838rkveq3n.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <53238b5b-3e0a-3dfe-eeba-f37cafa81f50@HIDDEN> (message from
 Jim Porter on Mon, 31 Oct 2022 12:28:23 -0700)
Subject: Re: bug#58909: 29.0.50; [WIP PATCH] Deleting the last frame of an
 emacsclient doesn't ask to save
References: <9a70f868-ca50-52fc-af3e-23813af104f2@HIDDEN>
 <83zgdcduxm.fsf@HIDDEN> <53238b5b-3e0a-3dfe-eeba-f37cafa81f50@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 58909
Cc: 58909 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Mon, 31 Oct 2022 12:28:23 -0700
> Cc: 58909 <at> debbugs.gnu.org
> From: Jim Porter <jporterbugs@HIDDEN>
> 
> > I'm uneasy with this incompatible behavior change.  I can think of
> > some legitimate use cases where "C-x 5 0" should not prompt, e.g., if
> > the user intends to keep editing the file, and no application is
> > waiting for the client to finish.  Why break such flows?
> 
> After thinking about this some more, I realized that I didn't properly 
> address this part of your message. If no application is waiting for the 
> client to finish, then the user hopefully used "--no-wait" when starting 
> emacsclient.

No, I meant that the user invoked emacsclient from the shell prompt,
for example.  As opposed to some application invoking emacsclient via
$EDITOR or similar.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#58909; Package emacs. Full text available.

Message received at 58909 <at> debbugs.gnu.org:


Received: (at 58909) by debbugs.gnu.org; 31 Oct 2022 19:38:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 31 15:38:15 2022
Received: from localhost ([127.0.0.1]:41858 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1opabu-0007v5-Mj
	for submit <at> debbugs.gnu.org; Mon, 31 Oct 2022 15:38:14 -0400
Received: from mail-pl1-f171.google.com ([209.85.214.171]:42738)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jporterbugs@HIDDEN>) id 1opabs-0007uo-6R
 for 58909 <at> debbugs.gnu.org; Mon, 31 Oct 2022 15:38:13 -0400
Received: by mail-pl1-f171.google.com with SMTP id c24so11642317pls.9
 for <58909 <at> debbugs.gnu.org>; Mon, 31 Oct 2022 12:38:12 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=content-transfer-encoding:in-reply-to:content-language:references
 :cc:to:subject:from:mime-version:date:message-id:from:to:cc:subject
 :date:message-id:reply-to;
 bh=5qX9UmbV8LXc+CSlZxfUjriv1ilOhsQTVE0RD0sqgZE=;
 b=hKbDfZzrLgG5wtTp4Y+p4uznNL4knH5TaZwhMn2ay04Miq0w/+W8gxPNNB5WCamaAS
 Iz231aCp7ZhkpLF9TVfFEaFnmWbX7tD0a29O3O/2kNhpho9KgwA0Yf/0RE4b1uxbgKgM
 ql0tZLrDi5sQSo/Rj/7aWXbYgWQNmxnU26v4+3bg3PQookZCFJX55NyloxpB/+daush6
 /U7w9Hc3d2o7Evh7XeK27UmJdB4Lm8Q/ZL1P7dRwsDcgpn98K/c6v1db3YGXeD0blfwd
 ewBXmJhGQmCvwncEVinXSH5t9RzvnmzXNEpRYqSTWkz1GklN+lo0m7OueXsxJUr/xf5Z
 DpCg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:in-reply-to:content-language:references
 :cc:to:subject:from:mime-version:date:message-id:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=5qX9UmbV8LXc+CSlZxfUjriv1ilOhsQTVE0RD0sqgZE=;
 b=gwFkssnIUVwQPpfeUZc8OYRSSWJ/AB6emu6t29pHaAlBgZTbsv7zpp6zvlnNSkf9DG
 VZACzHHSDIJUCAEUWIiW3nvjCQMr37I/OhSFFaU4uBWmEzdNbstGKArPjhli8VvD4PSr
 me6mfx1kH3o6qUFyFSFjdI5anu2shXNjyak91CFd2hzhEgl11DK9WVXUJq2oqu5nN4El
 UvJnHeXxInnEAd61fnywnJKDgEWE3ta7nVlHxMfZ/c08Vc9xkU01dyh4mF/TIHUDTPyB
 e+ow1vw3f2IXlm7c0qupkOyt0rA2XeumvrPQAxaX4KY8U5ixCaVRvo1n9Dn+QPIbbPnt
 bJ5A==
X-Gm-Message-State: ACrzQf2yRpSRO20hmi0S0MG65KqZeorZ84AoBCa+f8FyU2iY+IFN+20L
 kJ3hI4rL66qvRDuBILFiJHA=
X-Google-Smtp-Source: AMsMyM6Z0E0ZdXsLbeRruvNygQli3F37kIwuUMOgg3lGI1SwX6EEafQaWtSzQfhJ2AmoN+AxVF2Bxg==
X-Received: by 2002:a17:902:b402:b0:179:e5b0:96d3 with SMTP id
 x2-20020a170902b40200b00179e5b096d3mr15668406plr.142.1667245086385; 
 Mon, 31 Oct 2022 12:38:06 -0700 (PDT)
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
 s6-20020a170902ea0600b001872999f58esm1604705plg.189.2022.10.31.12.38.05
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Mon, 31 Oct 2022 12:38:05 -0700 (PDT)
Message-ID: <e2f5888f-4e28-b34b-9b55-68ec39f11079@HIDDEN>
Date: Mon, 31 Oct 2022 12:38:04 -0700
MIME-Version: 1.0
From: Jim Porter <jporterbugs@HIDDEN>
Subject: Re: bug#58909: 29.0.50; [WIP PATCH] Deleting the last frame of an
 emacsclient doesn't ask to save
To: Eli Zaretskii <eliz@HIDDEN>
References: <9a70f868-ca50-52fc-af3e-23813af104f2@HIDDEN>
 <83zgdcduxm.fsf@HIDDEN> <a18c7b22-b579-a5dd-44fa-af6a64ed34be@HIDDEN>
 <83bkpretpn.fsf@HIDDEN>
Content-Language: en-US
In-Reply-To: <83bkpretpn.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 58909
Cc: 58909 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On 10/31/2022 11:25 AM, Eli Zaretskii wrote:
>> I think it does about the same amount of harm as pressing 'C-x C-c' in
>> an emacs client.
> 
> How can you say that?  "C-x C-c" kills the entire terminal, whereas
> "C-x 5 0" kills just one frame!

When there's only one frame left for the client, 'C-x 5 0' *also* kills 
the entire terminal. That's the only case I want to add a prompt to. I 
agree that if you're only killing a frame, there's no sense in 
prompting. But when killing a frame gets upgraded into killing the 
entire terminal, it then has the same end result as having pressed 'C-x 
C-c'. Shouldn't Emacs then ask the user about what to do before killing 
the terminal?

Of course, 'C-x C-c' also has the effect of killing any other frames for 
that client, but that that doesn't apply there's only one frame. Still, 
'C-x C-c' still prompts in that case too. My understanding is that it 
does so because when an application is waiting for the emacsclient to 
finish, you can't go back from killing the terminal/client; you *can* 
(usually) go back if you're only killing a frame.

See my other message about this too: we could make sure Emacs only 
prompts the user when deleting a frame if doing so would kill a terminal 
that's actually waiting for some files to be saved. If the client was 
invoked with "--no-wait", we could just silently delete the frame: 
there's no application waiting for a file.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#58909; Package emacs. Full text available.

Message received at 58909 <at> debbugs.gnu.org:


Received: (at 58909) by debbugs.gnu.org; 31 Oct 2022 19:28:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 31 15:28:33 2022
Received: from localhost ([127.0.0.1]:41848 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1opaSX-0007cS-0u
	for submit <at> debbugs.gnu.org; Mon, 31 Oct 2022 15:28:33 -0400
Received: from mail-pl1-f169.google.com ([209.85.214.169]:47069)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jporterbugs@HIDDEN>) id 1opaSV-0007cD-W2
 for 58909 <at> debbugs.gnu.org; Mon, 31 Oct 2022 15:28:32 -0400
Received: by mail-pl1-f169.google.com with SMTP id l2so11608740pld.13
 for <58909 <at> debbugs.gnu.org>; Mon, 31 Oct 2022 12:28:31 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=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=/GcB5dj7k+O8SfGujkqjZWgf4rd2Kw1aQumggnlKGmo=;
 b=Hokj4FZCX8TOnaBPNQkPkB0qtvxFh9+Wt6X0OEZQ1QCNzr+nJDvIGLOmgV3YxP9C7i
 Hzg5wXITmjBu+nj9+U5psVbbValov4kdXsZLIBxLOZRmRs3vS626ifChmWpY8ScW3ZlB
 V6UAl30SqYyx3qxpziY35A8rY2AFW1ZgsTy91g1xfV9v9s1/dvDHzoIGrk1NIQNA58SZ
 BP2vT8qha+0TuBHw9Kfal4LdyX7+H1L9Vo/G/P1WQunxoAEAjilu6MANZBQ47+VWA3j2
 ++15Hpr0rkplPU0naPhCIy0jFwc0tfMtUHz1PRYWgQjrTgIKftnSgvh1PXXj5ZNNwmSz
 +FNw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=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=/GcB5dj7k+O8SfGujkqjZWgf4rd2Kw1aQumggnlKGmo=;
 b=lr8b6gDtlQuL2dV2BxSqR33PCzjenSYBEIyFVXeHAHyKEaB3Rga76KMLykO8WSa6Kh
 vTJGrUqLGwcF8zaBRjQlr9H/C00fHt5xng+0NfD0+WBqyu5SOq3ZA25KLf5WM3TZeW5t
 zjjozmVrb1AI4ckBdSlrtQwKPoDc1opg8qvWfMP6zPgq7yPGoblzqD8w8BVO5J0cOFmN
 sfkN+Wr2ippZAqrpHmiFf9msMy/BlUZdJeVSHWKRkHTqD/ldvFuPfChS2+Y281U51HTX
 VWKTkntcmFfruw45PZIy/0pQRsyuoLYg2kjVZmmkUkYVvC1zxeI0G5mb3qEH5MIeX3ea
 PsHA==
X-Gm-Message-State: ACrzQf1ZEMIhJkPPSBMoHxmJIFKvv2NY7EwUYa1lWTu0Ue2CEPQkbpD4
 xwu5jIUHDeTZ6TDkBENuBOyALZbcDOo=
X-Google-Smtp-Source: AMsMyM5hXU7+yf3O3di8UfDsH0p7ts0OLH3VMLh/dqr33skwkoSaI8uC7Iko4VQW+dWZah6IRfTC7Q==
X-Received: by 2002:a17:902:ab5d:b0:186:bb2e:85a4 with SMTP id
 ij29-20020a170902ab5d00b00186bb2e85a4mr15794294plb.135.1667244505920; 
 Mon, 31 Oct 2022 12:28:25 -0700 (PDT)
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
 ig14-20020a17090b154e00b00213a9e1f863sm4585272pjb.4.2022.10.31.12.28.24
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Mon, 31 Oct 2022 12:28:24 -0700 (PDT)
Content-Type: multipart/mixed; boundary="------------FL9Lr4PDX1xN3K0OHPQNtji0"
Message-ID: <53238b5b-3e0a-3dfe-eeba-f37cafa81f50@HIDDEN>
Date: Mon, 31 Oct 2022 12:28:23 -0700
MIME-Version: 1.0
Subject: Re: bug#58909: 29.0.50; [WIP PATCH] Deleting the last frame of an
 emacsclient doesn't ask to save
Content-Language: en-US
To: Eli Zaretskii <eliz@HIDDEN>
References: <9a70f868-ca50-52fc-af3e-23813af104f2@HIDDEN>
 <83zgdcduxm.fsf@HIDDEN>
From: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <83zgdcduxm.fsf@HIDDEN>
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 58909
Cc: 58909 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

This is a multi-part message in MIME format.
--------------FL9Lr4PDX1xN3K0OHPQNtji0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

On 10/31/2022 5:44 AM, Eli Zaretskii wrote:
>> Date: Sun, 30 Oct 2022 15:29:30 -0700
>> From: Jim Porter <jporterbugs@HIDDEN>
>>
>> However, if you use 'C-x 5 0' instead, that terminates the Emacs client,
>> but *doesn't* prompt to save foo.txt. I think it should prompt in this
>> case too: all three of 'C-x #', 'C-x C-c', and 'C-x 5 0' have the effect
>> (in this simple case) of deleting the Emacs client and returning to the
>> calling process. (A user who wanted to bail out of an Emacs client
>> without saving should use 'sever-edit-abort' instead.)
> 
> I'm uneasy with this incompatible behavior change.  I can think of
> some legitimate use cases where "C-x 5 0" should not prompt, e.g., if
> the user intends to keep editing the file, and no application is
> waiting for the client to finish.  Why break such flows?

After thinking about this some more, I realized that I didn't properly 
address this part of your message. If no application is waiting for the 
client to finish, then the user hopefully used "--no-wait" when starting 
emacsclient. We could avoid prompting in that case.[1]

If an application *is* waiting for the client to finish, then 
"--no-wait" would be unset. In that case, prompting the user has some 
value. See the attached patch. (I changed the code to only prompt when 
deleting the last frame of a *non-nowait* client.)

[1] Currently, 'C-x C-c' from a nowait frame prompts via 
'save-some-buffers' (so long as there's another frame; see 
'server-save-buffers-kill-terminal'). Maybe we could avoid prompting 
then too? After prompting, it just calls 'delete-frame', so it's very 
similar to 'C-x 5 0' in this scenario... Still, as you say, it's 
probably good to be careful about making incompatible changes here.
--------------FL9Lr4PDX1xN3K0OHPQNtji0
Content-Type: text/plain; charset=UTF-8;
 name="0001-When-deleting-the-last-frame-of-an-Emacs-client-ask-.patch"
Content-Disposition: attachment;
 filename*0="0001-When-deleting-the-last-frame-of-an-Emacs-client-ask-.pa";
 filename*1="tch"
Content-Transfer-Encoding: base64

RnJvbSA2OGI5ZjQxNjg1MjU2ODcwZjM0MDllYTQ2ODk3MWVlMGI2NGNmMTM2IE1vbiBTZXAg
MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBKaW0gUG9ydGVyIDxqcG9ydGVyYnVnc0BnbWFpbC5j
b20+CkRhdGU6IFNhdCwgMjkgT2N0IDIwMjIgMjA6NDA6NDkgLTA3MDAKU3ViamVjdDogW1BB
VENIXSBXaGVuIGRlbGV0aW5nIHRoZSBsYXN0IGZyYW1lIG9mIGFuIEVtYWNzIGNsaWVudCwg
YXNrIHRvIHNhdmUKCiogc3JjL2ZyYW1lLmMgKGRlbGV0ZV9mcmFtZSk6IENhbGwgJ2RlbGV0
ZS1mcmFtZS1mdW5jdGlvbnMnIHdpdGgKJ2NhbGwyJyBpbnN0ZWFkIG9mICdzYWZlX2NhbGwy
JyB0byBhbGxvdyBob29rcyB0byBxdWl0LCBjYW5jZWxsaW5nIHRoZQpmcmFtZSdzIGRlbGV0
aW9uLgoKKiBsaXNwL3NlcnZlci5lbCAoc2VydmVyLXNhd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UgKGZyYW1lKTsKICNlbmRpZgogCi0gICAgICBz
YWZlX2NhbGwyIChRcnVuX2hvb2tfd2l0aF9hcmdzLCBRZGVsZXRlX2ZyYW1lX2Z1bmN0aW9u
cywgZnJhbWUpOworICAgICAgY2FsbDIgKFFydW5faG9va193aXRoX2FyZ3MsIFFkZWxldGVf
ZnJhbWVfZnVuY3Rpb25zLCBmcmFtZSk7CiAgICAgfQogCiAgIC8qIGRlbGV0ZV9mcmFtZV9m
dW5jdGlvbnMgbWF5IGhhdmUgZGVsZXRlZCBhbnkgZnJhbWUsIGluY2x1ZGluZyB0aGlzCi0t
IAoyLjI1LjEKCg==

--------------FL9Lr4PDX1xN3K0OHPQNtji0--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#58909; Package emacs. Full text available.

Message received at 58909 <at> debbugs.gnu.org:


Received: (at 58909) by debbugs.gnu.org; 31 Oct 2022 18:25:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 31 14:25:53 2022
Received: from localhost ([127.0.0.1]:41747 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1opZTt-0005yf-GR
	for submit <at> debbugs.gnu.org; Mon, 31 Oct 2022 14:25:53 -0400
Received: from eggs.gnu.org ([209.51.188.92]:54410)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1opZTm-0005yM-2O
 for 58909 <at> debbugs.gnu.org; Mon, 31 Oct 2022 14:25:52 -0400
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 <eliz@HIDDEN>)
 id 1opZTf-0002sC-QO; Mon, 31 Oct 2022 14:25:39 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From:
 Date; bh=rwHMhxLKK+Q3O0xN9cWkl8KtHdkvHTyT/aR4NCe0Alw=; b=LVPkjS+nsBc3/lZhokMv
 4EEjZTvXWsw6JoULQ2ONc9dV/a86Z7k7T9TlQ5apCTFo3rfXFkNzQEoLh0f3Qf7g8YwDpN5qfOoE+
 klBuvHM6MU5AVUj058y36aZVDkmK0fLkSmBJfxyB0ijqDOMy32tqPxw1l+MJX+SZ2VmZlJyF7r5Ye
 eoTdyXFPjnX4YnN4MriIsF3M3D2k+SNuN+lSjhJQylFlbr/ruw01qQOWf39uyGY+ilz5JGCHXNh3z
 WLDCaxjC7WukekKdQWxhY0cvmgPeLEzgsOVeRdFd5Z7eMuook/0hrTlgHKnUuDhOMdnK27yXlJEUB
 P4mUlI7xZZneHA==;
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 <eliz@HIDDEN>)
 id 1opZTe-0001Jr-Qg; Mon, 31 Oct 2022 14:25:39 -0400
Date: Mon, 31 Oct 2022 20:25:24 +0200
Message-Id: <83bkpretpn.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <a18c7b22-b579-a5dd-44fa-af6a64ed34be@HIDDEN> (message from
 Jim Porter on Mon, 31 Oct 2022 10:36:57 -0700)
Subject: Re: bug#58909: 29.0.50; [WIP PATCH] Deleting the last frame of an
 emacsclient doesn't ask to save
References: <9a70f868-ca50-52fc-af3e-23813af104f2@HIDDEN>
 <83zgdcduxm.fsf@HIDDEN> <a18c7b22-b579-a5dd-44fa-af6a64ed34be@HIDDEN>
MIME-version: 1.0
Content-type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 58909
Cc: 58909 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Mon, 31 Oct 2022 10:36:57 -0700
> Cc: 58909 <at> debbugs.gnu.org
> From: Jim Porter <jporterbugs@HIDDEN>
> 
> On 10/31/2022 5:44 AM, Eli Zaretskii wrote:
> > I'm uneasy with this incompatible behavior change.  I can think of
> > some legitimate use cases where "C-x 5 0" should not prompt, e.g., if
> > the user intends to keep editing the file, and no application is
> > waiting for the client to finish.  Why break such flows?
> 
> Maybe we should add an option like 
> 'server-save-before-deleting-last-frame', in case users prefer the old 
> behavior?

I tend to think we shouldn't change the behavior here, not at all.
Not even as an option.  I see no problem here that we must solve.

> Alternately, we could add a keybinding for 'server-edit-abort'.

Users who need this can easily make a binding for them.  There's no
need to have such a binding by default.

> Still another possibility would be to prompt only when closing a frame 
> by clicking the "X" on the frame's title bar. When using a 
> non-client/server Emacs, doing this prompts the user to save when 
> closing the last frame. ('C-x 5 0' in this case would just error out, 
> since it refuses to delete the last frame.) That's because clicking the 
> X calls 'handle-delete-frame' which calls 'save-buffers-kill-emacs' in 
> that case. Then clicking the "X" would behave similarly when deleting 
> the last frame of a client and deleting the last frame overall.

But "last frame of a client" ≠ "the last frame".  So I see no reason
for a similar behavior.

> > Deleting a frame does no harm as long as Emacs is still up and running
> > after that, so IMO forcing the user to answer such a prompt could be
> > an annoyance.
> 
> I think it does about the same amount of harm as pressing 'C-x C-c' in 
> an emacs client.

How can you say that?  "C-x C-c" kills the entire terminal, whereas
"C-x 5 0" kills just one frame!

> Since my patch only affects the case when there's a single frame for
> the client, both 'C-x C-c' and 'C-x 5 0' would do the same thing
> (aside from prompting): they close the current frame and terminate
> the client connection.

I disagree, sorry.  We are talking about maybe a minor inconvenience
in a pretty special use case.  It is unjustified to change long-time
behavior for such weak reasons.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#58909; Package emacs. Full text available.

Message received at 58909 <at> debbugs.gnu.org:


Received: (at 58909) by debbugs.gnu.org; 31 Oct 2022 17:37:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 31 13:37:06 2022
Received: from localhost ([127.0.0.1]:41682 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1opYif-0004PA-On
	for submit <at> debbugs.gnu.org; Mon, 31 Oct 2022 13:37:06 -0400
Received: from mail-pl1-f169.google.com ([209.85.214.169]:33513)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jporterbugs@HIDDEN>) id 1opYid-0004Oh-Fv
 for 58909 <at> debbugs.gnu.org; Mon, 31 Oct 2022 13:37:03 -0400
Received: by mail-pl1-f169.google.com with SMTP id 4so11409806pli.0
 for <58909 <at> debbugs.gnu.org>; Mon, 31 Oct 2022 10:37:03 -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=jyythNiSKCKeyj/ttJNpNlqge63u+Bon7x88GkLNTt4=;
 b=Eeha9xDq2bQtUKmjywgpJ2ram7o1SGXJlouPb0C528DzAVBld6Pxpmig6ZbMXuoSh9
 7J2HH+chu4lIAbZNVbrJzcSLU/aTfY1UQigWq0DU82YY7wblnKKVcIdN8fINQyVInj3f
 9GPRpAta4LyxlTkKeno+HcqQkWFMjv7uJGTTn59ZER1o/7OfMf1s7n1o4dqWwVKemE+d
 x+FfyUnkOHTBhIN1chne1yZ9vdPBIuBiYQG7aw9yenXmaBzW3qeDYIX4bemXwSifbHPI
 irMSF0oL2kI2EkcBLg6JvknZZ6K10i9zu34rdfoV0Sq+5/szddFD7opyMdj4W68XoeOr
 6s2Q==
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=jyythNiSKCKeyj/ttJNpNlqge63u+Bon7x88GkLNTt4=;
 b=5+9/ITACjGk0UoedE2xkVlRK8nkFHSJByYotBxBsnbGpDDbO2tZd00wNv6P/P+iEAn
 U+ydDBJMnibyTpQfe8j8smPucSacGex33ZUsVfv97npTOL1SgWc4MF8X0Z/CAKRfzTe+
 ZMgYAVwN863mj1APp1cROZFeojbR4eu2/Pzyy/fVQKK6+kbxEjpZHyMrBs7b6pE0/JGA
 uTkuewCkCfK/ZlfyWI4odO9gelHqVZZlvnmCxkePZaH+hoW2xjQ4YCbb0q+1solfi7na
 rWovR7Km3X12uHfLxRhBTNliOvVFfidAQFymQbd71hZlGUxU+aV6XRA6HSgabNg999cF
 hD8w==
X-Gm-Message-State: ACrzQf0H/Z2PKC3Nezv0m/yNh0MNSwJPdEUmNA3JGptdSpxK5wqL/sdd
 19X1XL0xW7tckthj385CzqQ=
X-Google-Smtp-Source: AMsMyM4hVyDXRTqm7IrAQG329/zxmgOHOn2+0FjOah2vjbXluTyc/7bUxGiRAAAtjJwf/Z00F/mVNg==
X-Received: by 2002:a17:902:ec81:b0:187:1dbd:b86c with SMTP id
 x1-20020a170902ec8100b001871dbdb86cmr7492938plg.172.1667237817550; 
 Mon, 31 Oct 2022 10:36:57 -0700 (PDT)
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
 p23-20020a63c157000000b0046fd180640asm1522097pgi.24.2022.10.31.10.36.56
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Mon, 31 Oct 2022 10:36:56 -0700 (PDT)
Message-ID: <a18c7b22-b579-a5dd-44fa-af6a64ed34be@HIDDEN>
Date: Mon, 31 Oct 2022 10:36:57 -0700
MIME-Version: 1.0
Subject: Re: bug#58909: 29.0.50; [WIP PATCH] Deleting the last frame of an
 emacsclient doesn't ask to save
Content-Language: en-US
To: Eli Zaretskii <eliz@HIDDEN>
References: <9a70f868-ca50-52fc-af3e-23813af104f2@HIDDEN>
 <83zgdcduxm.fsf@HIDDEN>
From: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <83zgdcduxm.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 58909
Cc: 58909 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On 10/31/2022 5:44 AM, Eli Zaretskii wrote:
> I'm uneasy with this incompatible behavior change.  I can think of
> some legitimate use cases where "C-x 5 0" should not prompt, e.g., if
> the user intends to keep editing the file, and no application is
> waiting for the client to finish.  Why break such flows?

Maybe we should add an option like 
'server-save-before-deleting-last-frame', in case users prefer the old 
behavior? I had originally planned to add an option like this for the 
same reason you mention, but I didn't want to be too aggressive with 
adding extra options if they aren't really needed. Since you mentioned 
it too though, I think this should at least have an option.

Alternately, we could add a keybinding for 'server-edit-abort'. Then 
users could easily use that command to support this flow. That has the 
benefit that it's a command which is explicitly for saying, "I'm done 
with this file and don't want to save it," though it does break users' 
muscle memory.

Still another possibility would be to prompt only when closing a frame 
by clicking the "X" on the frame's title bar. When using a 
non-client/server Emacs, doing this prompts the user to save when 
closing the last frame. ('C-x 5 0' in this case would just error out, 
since it refuses to delete the last frame.) That's because clicking the 
X calls 'handle-delete-frame' which calls 'save-buffers-kill-emacs' in 
that case. Then clicking the "X" would behave similarly when deleting 
the last frame of a client and deleting the last frame overall.

I think I prefer one of the first two though.

> Deleting a frame does no harm as long as Emacs is still up and running
> after that, so IMO forcing the user to answer such a prompt could be
> an annoyance.

I think it does about the same amount of harm as pressing 'C-x C-c' in 
an emacs client. Since my patch only affects the case when there's a 
single frame for the client, both 'C-x C-c' and 'C-x 5 0' would do the 
same thing (aside from prompting): they close the current frame and 
terminate the client connection.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#58909; Package emacs. Full text available.

Message received at 58909 <at> debbugs.gnu.org:


Received: (at 58909) by debbugs.gnu.org; 31 Oct 2022 12:44:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 31 08:44:44 2022
Received: from localhost ([127.0.0.1]:39721 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1opU9k-0004p7-A2
	for submit <at> debbugs.gnu.org; Mon, 31 Oct 2022 08:44:44 -0400
Received: from eggs.gnu.org ([209.51.188.92]:59048)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1opU9i-0004ou-Gg
 for 58909 <at> debbugs.gnu.org; Mon, 31 Oct 2022 08:44:42 -0400
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 <eliz@HIDDEN>)
 id 1opU9d-0008BM-7t; Mon, 31 Oct 2022 08:44:37 -0400
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=qtef3QX1WyjwM4LBArarc2s82WljPdyuBkU5Fr5TDkM=; b=Yj7ck1jrgbBK
 4q2Revwy0Oj+TLvohjeUlcqd1eExrBL0r9ZBr3dgDUfsyUnKfPOQ6fj27t2LHuE18PRbmpGjfNY3U
 cjXyAcyflXTM5DENV8tVPDqxtu6meaccoatV0/hZvqWg9lq08FMWhjXAXPyL/ckM3EsFBq4xw5CqQ
 f446olHCarv6R+iDA1qsysInBqSAa2ysmoKlUlrrBQgGlMeTvAG21vH4nNq8zRpdYqU5W7bTjRQyf
 qQBoO+7BpgKveBqCFe1dNCM+EW7azLM/xkhiM66goz1vtgAPLnALJg2zC2rUlScfeBHLIL9i4JYCY
 EyZO+ks6X4xRApCVlqDCzg==;
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 <eliz@HIDDEN>)
 id 1opU9c-0003Ne-Nt; Mon, 31 Oct 2022 08:44:37 -0400
Date: Mon, 31 Oct 2022 14:44:21 +0200
Message-Id: <83zgdcduxm.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Jim Porter <jporterbugs@HIDDEN>
In-Reply-To: <9a70f868-ca50-52fc-af3e-23813af104f2@HIDDEN> (message from
 Jim Porter on Sun, 30 Oct 2022 15:29:30 -0700)
Subject: Re: bug#58909: 29.0.50;
 [WIP PATCH] Deleting the last frame of an emacsclient doesn't ask to
 save
References: <9a70f868-ca50-52fc-af3e-23813af104f2@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 58909
Cc: 58909 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Sun, 30 Oct 2022 15:29:30 -0700
> From: Jim Porter <jporterbugs@HIDDEN>
> 
>    $ emacs -Q -f server-start
>    $ emacsclient -c foo.txt
> 
>    ;; type some random characters
> 
>    C-x #
>    ;; or...
>    C-x C-c
> 
> In both cases, Emacs will ask to save foo.txt, though the prompts will 
> be slightly different. That's good, since whatever invoked "emacsclient 
> -c foo.txt" is likely waiting for the user to have saved that file.
> 
> However, if you use 'C-x 5 0' instead, that terminates the Emacs client, 
> but *doesn't* prompt to save foo.txt. I think it should prompt in this 
> case too: all three of 'C-x #', 'C-x C-c', and 'C-x 5 0' have the effect 
> (in this simple case) of deleting the Emacs client and returning to the 
> calling process. (A user who wanted to bail out of an Emacs client 
> without saving should use 'sever-edit-abort' instead.)

I'm uneasy with this incompatible behavior change.  I can think of
some legitimate use cases where "C-x 5 0" should not prompt, e.g., if
the user intends to keep editing the file, and no application is
waiting for the client to finish.  Why break such flows?

Deleting a frame does no harm as long as Emacs is still up and running
after that, so IMO forcing the user to answer such a prompt could be
an annoyance.

Thanks.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#58909; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 30 Oct 2022 22:29:51 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Oct 30 18:29:51 2022
Received: from localhost ([127.0.0.1]:39162 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1opGoQ-0001pb-WA
	for submit <at> debbugs.gnu.org; Sun, 30 Oct 2022 18:29:51 -0400
Received: from lists.gnu.org ([209.51.188.17]:59302)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jporterbugs@HIDDEN>) id 1opGoP-0001pU-PA
 for submit <at> debbugs.gnu.org; Sun, 30 Oct 2022 18:29:50 -0400
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 <jporterbugs@HIDDEN>)
 id 1opGoP-0000lj-Ib
 for bug-gnu-emacs@HIDDEN; Sun, 30 Oct 2022 18:29:49 -0400
Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <jporterbugs@HIDDEN>)
 id 1opGoB-0007Ez-Da
 for bug-gnu-emacs@HIDDEN; Sun, 30 Oct 2022 18:29:48 -0400
Received: by mail-pf1-x42c.google.com with SMTP id 17so4950421pfv.4
 for <bug-gnu-emacs@HIDDEN>; Sun, 30 Oct 2022 15:29:34 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=to:content-language:subject:from:mime-version:date:message-id:from
 :to:cc:subject:date:message-id:reply-to;
 bh=zoFjE22cTW3xXdPpEKheAg3I4NRX/U2nL4kwI3hBraw=;
 b=aPjwZeLpw8AuW8VAvHMUOq9aOKAe9pgd/WyOdEtzWs+QixyskoPp9JCzbI6JZJ/N8o
 gIBtcD7oPGMRZF4feokANwI0F816U8PNfHek2FGMulg2ckqx5O+eTHRGwd+HX0YGdwi0
 IMJBL8RT2EBRocR9j8y0vhDRznNz0QkpiZ15ATHr2fT9GOnyrOc5Q1juwxrMQPPoZf2B
 9JvYbX+UtC3TKmdO7HWAK3X5F6DyAlria9WZfSbc5Scm2WAcJVVduAUbb+4z7UugZ337
 T1cjGH3MvN1temLXqXwYemr7Lq7gt3C9mP2tnXxtyr/alUu0pYNeXRGys8isPjic1azp
 P4rw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=to:content-language:subject:from:mime-version:date:message-id
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=zoFjE22cTW3xXdPpEKheAg3I4NRX/U2nL4kwI3hBraw=;
 b=NH7AqygdGcGRaAu/IDk1ZpbKneTd1aZVsTpdIFtxFwvaminauhDqu4+9+d4KhgQ0Vh
 X8RZwXkEPFC7x5/FCY0S+HRvBFlzfLgPQU7g7tNEBBVq5VszHNAOdy5yKt1Obn5PQQez
 /n4y7YRKY6yKPZD1L0Tth5WxbVWyHWWQmMaleDFfKhzdThUBGHJFZIGpwaxilFhr8184
 Qd9UUbeKzlXhMpY2yOw9Udunwe5mOc+zkTFJt/l+h+4dCqFHmDQ/VPpWDiVNkkWbHfAS
 IhjwlL9nMKJK7M7yhNHmUEgk74cEKrKUAYnl0hoJ5tZfGfVYs8X1aWTolz9iazTmMwGH
 NQVw==
X-Gm-Message-State: ACrzQf1HE/C5BlXcFtoz+xIn3jSc0qdCnd6Yw5ZgSQhyXnrZdxW+92Xw
 oShzoAxi3bKRJcs92lB/rqv3dFVWso4=
X-Google-Smtp-Source: AMsMyM78N0GwUhq8wJYqSOZVxpLGgMJcOPuKeWERVmM6mU6inlZ8jzm87fzqE+oYRXYtWmb5uPL+fA==
X-Received: by 2002:aa7:92c8:0:b0:56b:d0b8:10f0 with SMTP id
 k8-20020aa792c8000000b0056bd0b810f0mr11121702pfa.46.1667168972358; 
 Sun, 30 Oct 2022 15:29:32 -0700 (PDT)
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
 t189-20020a6281c6000000b005668b26ade0sm3090566pfd.136.2022.10.30.15.29.31
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Sun, 30 Oct 2022 15:29:31 -0700 (PDT)
Content-Type: multipart/mixed; boundary="------------0BvVna6Ty8GhOfAUnAobIOnu"
Message-ID: <9a70f868-ca50-52fc-af3e-23813af104f2@HIDDEN>
Date: Sun, 30 Oct 2022 15:29:30 -0700
MIME-Version: 1.0
From: Jim Porter <jporterbugs@HIDDEN>
Subject: 29.0.50; [WIP PATCH] Deleting the last frame of an emacsclient
 doesn't ask to save
X-Mozilla-News-Host: news://news://news.gmane.io:119
Content-Language: en-US
To: bug-gnu-emacs@HIDDEN
Received-SPF: pass client-ip=2607:f8b0:4864:20::42c;
 envelope-from=jporterbugs@HIDDEN; helo=mail-pf1-x42c.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

This is a multi-part message in MIME format.
--------------0BvVna6Ty8GhOfAUnAobIOnu
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

(Note: this is tangentially related to bug#51993, but it happens 
regardless of whether 'server-stop-automatically' is enabled.)

In most cases when you do something to exit an Emacs client, it prompts 
you to save buffers associated with that client. For example:

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

   ;; type some random characters

   C-x #
   ;; or...
   C-x C-c

In both cases, Emacs will ask to save foo.txt, though the prompts will 
be slightly different. That's good, since whatever invoked "emacsclient 
-c foo.txt" is likely waiting for the user to have saved that file.

However, if you use 'C-x 5 0' instead, that terminates the Emacs client, 
but *doesn't* prompt to save foo.txt. I think it should prompt in this 
case too: all three of 'C-x #', 'C-x C-c', and 'C-x 5 0' have the effect 
(in this simple case) of deleting the Emacs client and returning to the 
calling process. (A user who wanted to bail out of an Emacs client 
without saving should use 'sever-edit-abort' instead.)

Attached is a WIP patch to do this. It's WIP because it will need to 
have some special handling for the 'server-stop-automatically' case so 
that it doesn't prompt twice in some cases. I also changed how 
'delete-frame' calls 'delete-frame-functions'. Hopefully the change I 
made is correct; I'm hesitant to change low-level code like that, but I 
think it's the right thing to do for this case at least. (Maybe that 
change should be called out in NEWS?)

Ultimately, it might make sense to merge this bug with bug#51993, but 
the discussion in that bug is already pretty long, and I think it would 
just confuse matters to add even more tangents to that discussion.
--------------0BvVna6Ty8GhOfAUnAobIOnu
Content-Type: text/plain; charset=UTF-8;
 name="0001-When-deleting-the-last-frame-of-an-Emacs-client-ask-.patch"
Content-Disposition: attachment;
 filename*0="0001-When-deleting-the-last-frame-of-an-Emacs-client-ask-.pa";
 filename*1="tch"
Content-Transfer-Encoding: base64

RnJvbSA4NzBkOTk1NDA0ODNkMzkxNzQ4NjAxOTA4NzJkN2U2MWYyMjA1ZmFkIE1vbiBTZXAg
MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBKaW0gUG9ydGVyIDxqcG9ydGVyYnVnc0BnbWFpbC5j
b20+CkRhdGU6IFNhdCwgMjkgT2N0IDIwMjIgMjA6NDA6NDkgLTA3MDAKU3ViamVjdDogW1BB
VENIXSBXaGVuIGRlbGV0aW5nIHRoZSBsYXN0IGZyYW1lIG9mIGFuIEVtYWNzIGNsaWVudCwg
YXNrIHRvIHNhdmUKCiogc3JjL2ZyYW1lLmMgKGRlbGV0ZV9mcmFtZSk6IENhbGwgJ2RlbGV0
ZS1mcmFtZS1mdW5jdGlvbnMnIHdpdGgKJ2NhbGwyJyBpbnN0ZWFkIG9mICdzYWZlX2NhbGwy
JyB0byBhbGxvdyBob29rcyB0byBx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AgfQogCiAg
IC8qIGRlbGV0ZV9mcmFtZV9mdW5jdGlvbnMgbWF5IGhhdmUgZGVsZXRlZCBhbnkgZnJhbWUs
IGluY2x1ZGluZyB0aGlzCi0tIAoyLjI1LjEKCg==

--------------0BvVna6Ty8GhOfAUnAobIOnu--




Acknowledgement sent to Jim Porter <jporterbugs@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#58909; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 2 Nov 2022 18:30:01 UTC

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