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: Sun, 30 Oct 2022 15:29:30 -0700 Message-ID: <9a70f868-ca50-52fc-af3e-23813af104f2@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------0BvVna6Ty8GhOfAUnAobIOnu" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30357"; mail-complaints-to="usenet@ciao.gmane.io" To: 58909@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 30 23:30:21 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1opGov-0007mV-71 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 30 Oct 2022 23:30:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1opGof-0001dW-Tq; Sun, 30 Oct 2022 18:30:05 -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 1opGod-0001YY-QB for bug-gnu-emacs@gnu.org; Sun, 30 Oct 2022 18:30: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 1opGod-0007am-HT for bug-gnu-emacs@gnu.org; Sun, 30 Oct 2022 18:30:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1opGoc-0001qR-VK for bug-gnu-emacs@gnu.org; Sun, 30 Oct 2022 18:30: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: Sun, 30 Oct 2022 22:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 58909 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16671689917048 (code B ref -1); Sun, 30 Oct 2022 22:30:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 30 Oct 2022 22:29:51 +0000 Original-Received: from localhost ([127.0.0.1]:39162 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1opGoQ-0001pb-WA for submit@debbugs.gnu.org; Sun, 30 Oct 2022 18:29:51 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:59302) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1opGoP-0001pU-PA for submit@debbugs.gnu.org; Sun, 30 Oct 2022 18:29:50 -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 1opGoP-0000lj-Ib for bug-gnu-emacs@gnu.org; Sun, 30 Oct 2022 18:29:49 -0400 Original-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 ) id 1opGoB-0007Ez-Da for bug-gnu-emacs@gnu.org; Sun, 30 Oct 2022 18:29:48 -0400 Original-Received: by mail-pf1-x42c.google.com with SMTP id 17so4950421pfv.4 for ; 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) 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 t189-20020a6281c6000000b005668b26ade0sm3090566pfd.136.2022.10.30.15.29.31 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 30 Oct 2022 15:29:31 -0700 (PDT) X-Mozilla-News-Host: news://news://news.gmane.io:119 Content-Language: en-US Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=jporterbugs@gmail.com; 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-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@gnu.org Xref: news.gmane.io gmane.emacs.bugs:246655 Archived-At: 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 VENIXSBXaGVu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