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#58877: 29.0.50; [PATCH] When killing Emacs from a client frame with no other frames, Emacs shows a useless error prompt Date: Sat, 29 Oct 2022 14:33:42 -0700 Message-ID: <8121efd5-77c3-0682-ce0f-6be9375dadd8@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------m0GquRHHJ48pym6nKNABktgY" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10379"; mail-complaints-to="usenet@ciao.gmane.io" To: 58877@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Oct 29 23:34:20 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 1ootTA-0002RL-75 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 29 Oct 2022 23:34:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ootSu-0001gx-GG; Sat, 29 Oct 2022 17:34:04 -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 1ootSt-0001go-1t for bug-gnu-emacs@gnu.org; Sat, 29 Oct 2022 17:34: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 1ootSs-0004CY-RU for bug-gnu-emacs@gnu.org; Sat, 29 Oct 2022 17:34:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ootSs-0001Mx-Do for bug-gnu-emacs@gnu.org; Sat, 29 Oct 2022 17:34: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: Sat, 29 Oct 2022 21:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 58877 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.16670792345247 (code B ref -1); Sat, 29 Oct 2022 21:34:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 29 Oct 2022 21:33:54 +0000 Original-Received: from localhost ([127.0.0.1]:36792 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ootSj-0001MY-IW for submit@debbugs.gnu.org; Sat, 29 Oct 2022 17:33:53 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:56464) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ootSe-0001MO-WB for submit@debbugs.gnu.org; Sat, 29 Oct 2022 17:33:52 -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 1ootSe-0001gD-Os for bug-gnu-emacs@gnu.org; Sat, 29 Oct 2022 17:33:48 -0400 Original-Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ootSc-0004Bm-T2 for bug-gnu-emacs@gnu.org; Sat, 29 Oct 2022 17:33:48 -0400 Original-Received: by mail-pj1-x1031.google.com with SMTP id f5-20020a17090a4a8500b002131bb59d61so10017808pjh.1 for ; Sat, 29 Oct 2022 14:33:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:from:content-language:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=my1eDXVALNFtbiLgxJsoJBBbXLtiOKXfz2dGAoZgBY4=; b=WmKa9zIRg/tPeoLhbOGvfHnR8PoSOx693HzruOl678UJN90Whxtj7gAdLExm1ZL/RE qAFgqOHnORyhLst7f+JEbzozAYbLB7Q3qrpwuP/t+iO4iPzAQ5cbGz/3wVdKkL2SgUzM xCYw6IJfN9rTWszkEg32KZEYsu0vrQq3cQUoHsiQ9X+flj25/gceREnUB2+SQ/sx1yEF b0hY3Bh/wcLhiX/wB5/Bghwm3jukjHe5Cz5kJM8QyGGjeWPUkEp0kpPgR5yz2auoPifz R/OVu9JToiY9IXXXgzjvc6t8ueVNKEApv41kcYlgwDwaO4SeC7F0SBQuZSDihHou5Rhv xSmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:from:content-language:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=my1eDXVALNFtbiLgxJsoJBBbXLtiOKXfz2dGAoZgBY4=; b=UFCALDOhV0CYrThBRCwsRY3Xdlkwf9EM/3M0yLab/v69Wp+Fz836YgczyNDKreDPpN Gcf6+d7RK+emmLhDuypQ9BqdanXgxviIhBPNFE+KGVEyta6JHkqRpNgB8jzjGDktAPNT N7dRCxLh5Ptkv/zTf6rdz7XiIljkeZAYJ13dDFV/pYKaeAX4p9d1fzP5LmnfLZ1YMPl0 +hO1t4Zq4WIj4woaJ+MiSx6DOcplW0JQZhSFoEptQ4fEMbR5+EqpcOmZ9H6b+ujpyAL1 lkcg8F7L+eD30zwMkp2tuQcL6DeWZinMeNuFTWW+R/TalSyU05+h9lXCrGxv2744eV1E 4Ong== X-Gm-Message-State: ACrzQf3laDeQbpDG6BLcvf0JquXbBz+18njF4m12pueJeAfa+yDdMAw7 sAJiADcn1d+5/ZFEM1i9BFHz6RcOYEI= X-Google-Smtp-Source: AMsMyM63h0ZZDZK+r8NhqjOQhlWhxowjJT8z0qhGT7s26yMj6fxMWnkz1rzw45AF199+c54Pf7bm1w== X-Received: by 2002:a17:903:2596:b0:186:a395:c4bd with SMTP id jb22-20020a170903259600b00186a395c4bdmr6345194plb.60.1667079224713; Sat, 29 Oct 2022 14:33:44 -0700 (PDT) Original-Received: from [192.168.1.2] (cpe-76-168-148-233.socal.res.rr.com. [76.168.148.233]) by smtp.googlemail.com with ESMTPSA id u10-20020a170902714a00b001730a1af0fbsm1728318plm.23.2022.10.29.14.33.43 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 29 Oct 2022 14:33:43 -0700 (PDT) X-Mozilla-News-Host: news://news.gmane.io:119 Content-Language: en-US Received-SPF: pass client-ip=2607:f8b0:4864:20::1031; envelope-from=jporterbugs@gmail.com; helo=mail-pj1-x1031.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:246573 Archived-At: This is a multi-part message in MIME format. --------------m0GquRHHJ48pym6nKNABktgY Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit (Note: I originally mentioned this in bug#51993, but it's only somewhat-related to that bug. To make things easier to follow, I pulled this part out into a separate bug.) To see this in action: $ emacs -Q -f server-start $ emacsclient -c foo.txt ;; From the first (non-client) frame: C-x 5 0 ;; delete-frame ;; From the second (client) frame: M-x kill-emacs ;; Emacs prompts: Error (error Attempt to delete the sole visible or iconified frame); continue? (y or n) Pressing "y" will properly kill Emacs, but there's no real use for the warning in this case. It happens because 'server-force-stop' (indirectly) tries to delete the last (client) frame before killing Emacs, meaning that Emacs would have zero frames for a bit. Since 'server-force-stop's docstring says, "This function is meant to be called from `kill-emacs-hook'," it should be safe to have 'server-force-stop' avoid deleting any frames: they'll just get deleted when Emacs is actually killed. Attached is a patch to do this. Note that I named the new argument "noframe" because that matches the existing code in server.el (see 'server-delete-client'). It's a bit of a misnomer though, and maybe "keep-frames" would be better... --------------m0GquRHHJ48pym6nKNABktgY Content-Type: text/plain; charset=UTF-8; name="0001-Don-t-explicitly-delete-client-frames-when-killing-E.patch" Content-Disposition: attachment; filename*0="0001-Don-t-explicitly-delete-client-frames-when-killing-E.pa"; filename*1="tch" Content-Transfer-Encoding: base64 RnJvbSA1MjI1NzRjZTY5ZTNjMTk4YTQwYjU3ZTJlMjExZTE0NTYyMzM0ZjMzIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBKaW0gUG9ydGVyIDxqcG9ydGVyYnVnc0BnbWFpbC5j b20+CkRhdGU6IEZyaSwgMTkgTm92IDIwMjEgMjA6MTQ6MzMgLTA4MDAKU3ViamVjdDogW1BB VENIXSBEb24ndCBleHBsaWNpdGx5IGRlbGV0ZSBjbGllbnQgZnJhbWVzIHdoZW4ga2lsbGlu ZyBFbWFjcwogYW55d2F5CgpUaGlzIGVsaW1pbmF0ZXMgYSB1c2VsZXNzIGVycm9yIHByb21w dCB3aGVuIGtpbGxp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