From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.bugs Subject: bug#58909: 29.0.50; [WIP PATCH] Deleting the last frame of an emacsclient doesn't ask to save Date: Mon, 31 Oct 2022 12:28:23 -0700 Message-ID: <53238b5b-3e0a-3dfe-eeba-f37cafa81f50@gmail.com> References: <9a70f868-ca50-52fc-af3e-23813af104f2@gmail.com> <83zgdcduxm.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------FL9Lr4PDX1xN3K0OHPQNtji0" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="12793"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 58909@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Oct 31 20:29:27 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1opaTP-0003Dw-8i for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 31 Oct 2022 20:29:27 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1opaT9-0007wA-Lk; Mon, 31 Oct 2022 15:29:13 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1opaT0-0007u7-Lz for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2022 15:29:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1opaT0-0000cX-EG for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2022 15:29:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1opaT0-0007dL-3z for bug-gnu-emacs@gnu.org; Mon, 31 Oct 2022 15:29:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jim Porter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 31 Oct 2022 19:29:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58909 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 58909-submit@debbugs.gnu.org id=B58909.166724451329297 (code B ref 58909); Mon, 31 Oct 2022 19:29:02 +0000 Original-Received: (at 58909) by debbugs.gnu.org; 31 Oct 2022 19:28:33 +0000 Original-Received: from localhost ([127.0.0.1]:41848 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1opaSX-0007cS-0u for submit@debbugs.gnu.org; Mon, 31 Oct 2022 15:28:33 -0400 Original-Received: from mail-pl1-f169.google.com ([209.85.214.169]:47069) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1opaSV-0007cD-W2 for 58909@debbugs.gnu.org; Mon, 31 Oct 2022 15:28:32 -0400 Original-Received: by mail-pl1-f169.google.com with SMTP id l2so11608740pld.13 for <58909@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) Original-Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id 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-Language: en-US In-Reply-To: <83zgdcduxm.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: "bug-gnu-emacs" Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:246714 Archived-At: 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 >> >> 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 aW9uLgoKKiBsaXNwL3NlcnZlci5lbCAoc2VydmVyLXNhdmUtc29tZS1idWZmZXJzKTogTmV3 IGZ1bmN0aW9uLi4uCihzZXJ2ZXItaGFuZGxlLWRlbGV0ZS1mcm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