From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jim Porter Newsgroups: gmane.emacs.bugs Subject: bug#51993: 29.0.50; [PATCH] Killing emacsclient terminal with `server-stop-automatically' doesn't prompt to save files Date: Mon, 29 Nov 2021 11:31:20 -0800 Message-ID: <0cbd22ae-e1e9-c6fb-a907-48bcc98dc6f2@gmail.com> References: <9e47c871-a2c3-d764-bec9-d87abf3efe83@gmail.com> <79a53ecc-dbfc-d088-d80d-96f349be794a@gmail.com> <834k7vw2vb.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------E7EEC49F63D237D7D1D22B4B" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31912"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, 51993@debbugs.gnu.org To: Gregory Heytings , Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Nov 29 20:33:11 2021 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 1mrmOk-00085m-Ch for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 29 Nov 2021 20:33:10 +0100 Original-Received: from localhost ([::1]:55888 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mrmOi-0003wS-VM for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 29 Nov 2021 14:33:08 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:36364) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mrmNf-0003tv-Qn for bug-gnu-emacs@gnu.org; Mon, 29 Nov 2021 14:32:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:56172) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mrmNf-0003QI-FD for bug-gnu-emacs@gnu.org; Mon, 29 Nov 2021 14:32:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mrmNe-0002lg-8F for bug-gnu-emacs@gnu.org; Mon, 29 Nov 2021 14:32:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Jim Porter Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 29 Nov 2021 19:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51993 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 51993-submit@debbugs.gnu.org id=B51993.16382142959427 (code B ref 51993); Mon, 29 Nov 2021 19:32:02 +0000 Original-Received: (at 51993) by debbugs.gnu.org; 29 Nov 2021 19:31:35 +0000 Original-Received: from localhost ([127.0.0.1]:39485 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mrmN6-0002M4-Me for submit@debbugs.gnu.org; Mon, 29 Nov 2021 14:31:35 -0500 Original-Received: from mail-pl1-f170.google.com ([209.85.214.170]:44955) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mrmN5-0002HD-Ic for 51993@debbugs.gnu.org; Mon, 29 Nov 2021 14:31:28 -0500 Original-Received: by mail-pl1-f170.google.com with SMTP id q17so12986878plr.11 for <51993@debbugs.gnu.org>; Mon, 29 Nov 2021 11:31:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-language; bh=oI81EMvi2IboNe0MWS34dygN3MzS80C2az7x52yzXz0=; b=ARgjGusOgdEQe9dLnNOOo76Tf0ZCfGb8zYvRIsofFEBc9boSGVl/a6lsBo0B2RLFoA AkNN+PUoYNVj+sW8PiRKoa896nRBCfhWXAksaT2hWYyfKlomZhNjse2qV6/HjxaME+yU DoFeG+d9TRHJeLyKzgdpUSgj3mNuy3xIpilMX+JH4aR30Ilm8E1M/PnXy1Z62Lb4w8Pl qOclsLpueKyr8WdY8p4wwHwAh+kxzjE4fVfv9d/rjzIn9yL1BZL9gVyhGIioc5fGJevw /5UpBHl8CVcaDUufzWmd4A/RIwfpzIEZQ9X9wE8N9UjELYWCmwkFdhZEYD1v7NB60sjU U/zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :mime-version:in-reply-to:content-language; bh=oI81EMvi2IboNe0MWS34dygN3MzS80C2az7x52yzXz0=; b=rnp7z2GOBLba8byvr9DgMOhGubVkoV6imW3dAmnARY4HIKD+VjHYp+l4pQjAO9IWJi 9WUU+nB4vjkwsJQkS3C8SC9YGch/En1LhhwUgHDGad/LOQCS9u2Se7ElF+sJwQTo8+sq LbYo2GiGrk1Ln/DdrJUHS9k1yl7KenCmk6ncL0zuuz5rhzV27jref8HmzFzkZAMruCdy MqpvUjrgAP3QtJTfRLrgj7NyPmWWPEhBwsDplMDX2uRm99+b4GrBVwbMCrcRLJVOMbZJ aB/R53vfOHl0seAAhGhRv2ZQhdNjulI/ejPYg5htDXdk5XhWalpJcELTnV3zU3ZrQqx8 mXAQ== X-Gm-Message-State: AOAM531uYsngC50jqzZXh5cLz6K6LKCWbtQM5QxeKwTVIsE5i4b/K77v SJLGQO7YV9TMp1JV9TB/g+sStRsN/H8= X-Google-Smtp-Source: ABdhPJzOyi79e3+20/jQs1jxWM4ruHJ2F5ZIW9cI2deBO806iB0/X4CaPW2SDQaqAdpwi+/bUPqQYA== X-Received: by 2002:a17:90b:4b4e:: with SMTP id mi14mr116962pjb.122.1638214281702; Mon, 29 Nov 2021 11:31:21 -0800 (PST) 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 mp12sm119113pjb.39.2021.11.29.11.31.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 29 Nov 2021 11:31:21 -0800 (PST) In-Reply-To: Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:221075 Archived-At: This is a multi-part message in MIME format. --------------E7EEC49F63D237D7D1D22B4B Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 11/29/2021 5:40 AM, Gregory Heytings wrote: > > I'm in the process of implementing something that should satisfy > everyone, but it's not finished yet. Thanks. Hopefully my proposal helps to explain more precisely my mental model and how I'd like things to work. If there's anything that's not clear, just let me know and I'll try to elaborate on it. In case it would help, I've also attached the relevant bits of my Emacs configuration, which implements the Explicit Shutdown behavior I've described. Overall, it's similar to the first patch I posted in this bug, but it's usable in Emacs 27+ (maybe even earlier). However, I think it has (at least) one problem: if `server-buffer-done' (indirectly called by `server-edit' / `C-x #') deletes the last client, it doesn't stop the daemon. I haven't had a chance to look into this in detail yet though. I think the most consistent behavior would be to stop the daemon in this case, since then the logic is simply "stop the daemon when the last client would be deleted", and we don't have to worry about exceptions to that rule. --------------E7EEC49F63D237D7D1D22B4B Content-Type: text/plain; charset=UTF-8; name="server-advice.el" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="server-advice.el" KHVzZS1wYWNrYWdlIHNlcnZlcgogIDpkZWZlci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mVhdGVkIGJ5IHRoaXMgZnJhbWUgKGFzIHdoZW4ga2ls bGluZyB0aGUgdGVybWluYWwgb2YgYW4KICAgICAgICAgICAgICAgICA7OyBvcmRpbmFyeSBj bGllbnQgYmVsb3cpLCBidXQgd2UgY2FuJ3QgZGlzdGluZ3Vpc2ggc2VwYXJhdGUKICAgICAg ICAgICAgICAgICA7OyBncm91cHMgb2Ygbm93YWl0IGZyYW1lcyBjdXJyZW50bHkuCgkgICAg ICAgICAocHJvZ24gKHNhdmUtc29tZS1idWZmZXJzIGFyZykKCQkgICAgICAgIChkZWxldGUt ZnJhbWUpKQoJICAgICAgIDs7IElmIHdlJ3JlIHRoZSBsYXN0IGZyYW1lIHN0YW5kaW5nLCBr aWxsIEVtYWNzLgoJICAgICAgIChzYXZlLWJ1ZmZlcnMta2lsbC1lbWFjcyBhcmcpKSkKCSAg ICAoKHByb2Nlc3NwIHByb2MpCiAgICAgICAgICAgICAoaWYgKHNlcS1zb21lCiAgICAgICAg ICAgICAgICAgIChsYW1iZGEgKGZyYW1lKQogICAgICAgICAgICAgICAgICAgIChsZXQgKChw IChmcmFtZS1wYXJhbWV0ZXIgZnJhbWUgJ2NsaWVudCkpKQogICAgICAgICAgICAgICAgICAg ICAgKHVubGVzcyAoYW5kIChkYWVtb25wKSAobnVsbCBwKSkKICAgICAgICAgICAgICAgICAg ICAgICAgKG5vdCAoZXF1YWwgcHJvYyBwKSkpKSkKICAgICAgICAgICAgICAgICAgKGZyYW1l LWxpc3QpKQogICAgICAgICAgICAgICAgIDs7IElmIHRoZXJlJ3MgYSBmcmFtZSBub3QgZnJv bSB0aGlzIGNsaWVudCwgb25seSBkZWxldGUgdGhlCiAgICAgICAgICAgICAgICAgOzsgY2xp ZW50LgoJICAgICAgICAgKGxldCAoKGJ1ZmZlcnMgKHByb2Nlc3MtZ2V0IHByb2MgJ2J1ZmZl cnMpKSkKCSAgICAgICAgICAgKHNhdmUtc29tZS1idWZmZXJzCgkgICAgICAgICAgICBhcmc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N1cnJlbnQgZnJhbWUncyBjbGllbnQsIGRvbid0IGJvdGhlciBhc2tpbmcu IgogICAgKGxldCAoKGlnbm9yZWQtcHJvYyAoYW5kIChkYWVtb25wKSAoZnJhbWUtcGFyYW1l dGVyIG5pbCAnY2xpZW50KSkpKQogICAgICAob3IgKG5vdCAoc2VxLXNvbWUgKGxhbWJkYSAo cHJvYykKICAgICAgICAgICAgICAgICAgICAgICAgICAgKHVubGVzcyAoZXEgaWdub3JlZC1w cm9jIHByb2MpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgKHNlcS1zb21lICMnYnVm ZmVyLWxpdmUtcAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAocHJv Y2Vzcy1nZXQgcHJvYyAnYnVmZmVycykpKSkKICAgICAgICAgICAgICAgICAgICAgICAgIHNl cnZlci1jbGllbnRzKSkKICAgICAgICAgICh5ZXMtb3Itbm8tcCAiVGhpcyBFbWFjcyBzZXNz aW9uIGhhcyBjbGllbnRzOyBleGl0IGFueXdheT8gIikpKSkKCiAgKGRlZnVuIHVzZXItLWhh bmRsZS1kZWxldGUtZnJhbWUgKGZyYW1lKQogICAgIldoZW4gZGVsZXRpbmcgdGhlIGxhc3Qg bm9uLWRhZW1vbiBmcmFtZSwga2lsbCBFbWFjcy4KXChUbyBiZSB1c2VkIGZyb20gYGRlbGV0 ZS1mcmFtZS1mdW5jdGlvbnMnLikiCiAgICAod2hlbiAoYW5kIChkYWVtb25wKQogICAgICAg ICAgICAgICA7OyBDaGVjayB0aGF0IHRoZSBmcmFtZSBpcyBhIGNsaWVudCBmcmFtZS4KICAg ICAgICAgICAgICAgOzsgTm90ZTogYHNlcnZlci1kZWxldGUtY2xpZW50JyBzZXRzIGBjbGll bnQnIHRvIG5pbCBiZWZvcmUKICAgICAgICAgICAgICAgOzsgY2FsbGluZyBgZGVsZXRlLWZy YW1lJywgYnV0IHRoYXQncyBnb29kLCBzaW5jZSB3ZSB3YW50IHRvIGNhbGwKICAgICAgICAg ICAgICAgOzsgYHNhdmUtYnVmZmVycy1raWxsLWVtYWNzJyBiZWZvcmUgYWxsIHRoYXQgYW55 d2F5LgogICAgICAgICAgICAgICAoZnJhbWUtcGFyYW1ldGVyIGZyYW1lICdjbGllbnQpCiAg ICAgICAgICAgICAgIChudWxsIChjZGRyIChmcmFtZS1saXN0KSkpKQogICAgICAoc2F2ZS1i dWZmZXJzLWtpbGwtZW1hY3MpKSkKCiAgOmNvbmZpZwogIChhZHZpY2UtYWRkICMnc2VydmVy LXNhdmUtYnVmZmVycy1raWxsLXRlcm1pbmFsIDpvdmVycmlkZQogICAgICAgICAgICAgICMn dXNlci0tc2VydmVyLXNhdmUtYnVmZmVycy1raWxsLXRlcm1pbmFsKQogIChhZHZpY2UtYWRk ICMnc2VydmVyLWtpbGwtZW1hY3MtcXVlcnktZnVuY3Rpb24gOm92ZXJyaWRlCiAgICAgICAg ICAgICAgIyd1c2VyLS1zZXJ2ZXIta2lsbC1lbWFjcy1xdWVyeS1mdW5jdGlvbikKICAoYWRk LWhvb2sgJ2RlbGV0ZS1mcmFtZS1mdW5jdGlvbnMgIyd1c2VyLS1oYW5kbGUtZGVsZXRlLWZy YW1lKSkK --------------E7EEC49F63D237D7D1D22B4B--