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: Wed, 2 Nov 2022 11:17:00 -0700 Message-ID: <39e03350-2783-fa90-5d66-26e47abe100d@gmail.com> References: <9a70f868-ca50-52fc-af3e-23813af104f2@gmail.com> <83zgdcduxm.fsf@gnu.org> <53238b5b-3e0a-3dfe-eeba-f37cafa81f50@gmail.com> <838rkveq3n.fsf@gnu.org> <7de45884-b4c9-4a4c-777c-5db17b3bacca@gmail.com> <835yfzeobt.fsf@gnu.org> <7694fcf2-8982-9099-5eb8-39835d049847@gmail.com> <83y1svch5u.fsf@gnu.org> <0dc07894-dfa1-01f6-87c4-9e02bfcaf0dc@gmail.com> <83bkppblh7.fsf@gnu.org> <83a6599t7m.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="15349"; 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@gnu.org Wed Nov 02 19:42:13 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 1oqIgl-0003kE-I4 for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 02 Nov 2022 19:42:11 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oqIfj-0004ty-T1; Wed, 02 Nov 2022 14:41:07 -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 1oqIfg-0004qd-FD for bug-gnu-emacs@gnu.org; Wed, 02 Nov 2022 14:41:04 -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 1oqIfg-00045b-4J for bug-gnu-emacs@gnu.org; Wed, 02 Nov 2022 14:41:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oqIJO-0005us-HE for bug-gnu-emacs@gnu.org; Wed, 02 Nov 2022 14:18: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: Wed, 02 Nov 2022 18:18: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.166741302722677 (code B ref 58909); Wed, 02 Nov 2022 18:18:02 +0000 Original-Received: (at 58909) by debbugs.gnu.org; 2 Nov 2022 18:17:07 +0000 Original-Received: from localhost ([127.0.0.1]:47157 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oqIIV-0005tg-Dl for submit@debbugs.gnu.org; Wed, 02 Nov 2022 14:17:07 -0400 Original-Received: from mail-pl1-f171.google.com ([209.85.214.171]:34721) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oqIIU-0005t9-Bm for 58909@debbugs.gnu.org; Wed, 02 Nov 2022 14:17:06 -0400 Original-Received: by mail-pl1-f171.google.com with SMTP id v17so14326054plo.1 for <58909@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) 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 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) Content-Language: en-US In-Reply-To: <83a6599t7m.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@gnu.org Xref: news.gmane.io gmane.emacs.bugs:246887 Archived-At: 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@debbugs.gnu.org >> From: Jim Porter >> >> 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