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#51377: Automatically exit server when it has no remaining clients Date: Sun, 24 Oct 2021 11:08:57 -0700 Message-ID: <7f3dde25-f81b-d7db-efc5-f8d471fd06bc@gmail.com> References: <90ba36dccc00d6f0d62d@heytings.org> <63203d9f-dae7-a39f-c70f-ebf37632e642@gmail.com> <90ba36dcccc2abc8dec1@heytings.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16910"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 51377@debbugs.gnu.org To: Gregory Heytings Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Oct 24 20:14:28 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 1mei0p-0004HT-S3 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 24 Oct 2021 20:14:27 +0200 Original-Received: from localhost ([::1]:35664 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mei0k-0002pX-0l for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 24 Oct 2021 14:14:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34254) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mehwZ-0006Uo-Ok for bug-gnu-emacs@gnu.org; Sun, 24 Oct 2021 14:10:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57473) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mehwZ-0001RM-Fh for bug-gnu-emacs@gnu.org; Sun, 24 Oct 2021 14:10:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mehwZ-0006J8-Al for bug-gnu-emacs@gnu.org; Sun, 24 Oct 2021 14:10:03 -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, 24 Oct 2021 18:10:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51377 X-GNU-PR-Package: emacs Original-Received: via spool by 51377-submit@debbugs.gnu.org id=B51377.163509894524123 (code B ref 51377); Sun, 24 Oct 2021 18:10:03 +0000 Original-Received: (at 51377) by debbugs.gnu.org; 24 Oct 2021 18:09:05 +0000 Original-Received: from localhost ([127.0.0.1]:40776 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mehvd-0006H1-CN for submit@debbugs.gnu.org; Sun, 24 Oct 2021 14:09:05 -0400 Original-Received: from mail-pl1-f180.google.com ([209.85.214.180]:44766) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mehva-0006GW-Bj for 51377@debbugs.gnu.org; Sun, 24 Oct 2021 14:09:03 -0400 Original-Received: by mail-pl1-f180.google.com with SMTP id t11so6335546plq.11 for <51377@debbugs.gnu.org>; Sun, 24 Oct 2021 11:09:02 -0700 (PDT) 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:content-transfer-encoding; bh=idRMFJ+adBU/K0NZ3E8Cjs8TyqyBWrLgwCFCVl3X3Wg=; b=WWelIwUy3kY6H++iO10wEmcnIuY/wnFid6uIHaHCJTumkx7EwaZUW41FQg5Gr+yhmj qm3fRJGJXaz5KjpkAvWNuZGC+x4CFcLDB74By5BIjnAiRBgFadpknyiPr/PlcMatwR0v tEIYFTH50BjZoISXI0UC8bVjosLArk82pG8yOJRoXwACfj8Fh/OwA4TTNCkBZSg66m+2 LnGfAxWltTNXYXjtn2bjuuq/kxmS9S725C23HNt74bD0P2OcnK0FuElLRGbrwcxwKPOW CRaK0buz46VVxT7QHathRHDSgFmjY9RtJYXzaINcHX3tU9mW2TaVdUgKgMdjbKMCppJD X3WA== 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:content-transfer-encoding; bh=idRMFJ+adBU/K0NZ3E8Cjs8TyqyBWrLgwCFCVl3X3Wg=; b=IepLKtkF4JlXJcLY42DoSSd1M8eaKnbkyGbTjnUcCGUrXn/+m8GEBdniSc0NVbjNvu 3WGhEnFBjlie4wSQt85YPQj39zrb3wukCL/0dc0OLTsD6Huo+qqGobOv8uGOO/R3q1/G Sx0a7vDhpzBJX9PUCZV+Ostqyl55RjU+KSptsIOVQokqygjWChuIgAeXsu+Mu3qvNpeL zhk+x737XZdL0aFxbYC4a5bF60GsQ/VONc+DIT390on5Lx0dXwRm70Ntl102QJeFv8wq XT2kFzb/xgqzqZBz+KD/9tC++l2flvotQQ5weNlqOFT6AmnIXkbDHyDXK4WEoJr1/CGJ hAqA== X-Gm-Message-State: AOAM533tj2z5hEOR0BxD8/7dfGe9vj0YDqxb2cY2UYvE4F3ZAUGG6Jhq Xo/S88kyrzZuS5ur6XahOC2CAvqOs/g= X-Google-Smtp-Source: ABdhPJzVpCXT8ve/1zjccgDZ2ayqpZT2nnInswbcB7229hEIKYA4Rw0jBHFi14xUTtM/MguujUcgsQ== X-Received: by 2002:a17:90b:1d06:: with SMTP id on6mr29783679pjb.119.1635098936565; Sun, 24 Oct 2021 11:08:56 -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 v18sm2629212pjn.55.2021.10.24.11.08.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 24 Oct 2021 11:08:56 -0700 (PDT) In-Reply-To: <90ba36dcccc2abc8dec1@heytings.org> 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:218166 Archived-At: On 10/24/2021 9:32 AM, Gregory Heytings wrote: >> I'm not sure I understand the patch; `save-buffers-kill-emacs' prompts >> the user to save buffers before killing Emacs, but how would that work >> in a daemon when there are no frames remaining? > > There is one (invisible) frame remaining: the daemon frame.  And when > there are no other frames (graphical or non-graphical) ones, there's > nothing to save, save-buffer-kill-emacs just kills emacs. I don't think this is true in general. The docstring for `server-save-buffers-kill-terminal' says: "If emacsclient was started with a list of filenames to edit, then only these files will be asked to be saved." As a result, some files with unsaved changes may still exist, so we'd want to prompt about those *before* the last frame is closed. To see this in action: $ emacs -Q --daemon $ emacsclient foo.txt C-x C-f bar.txt ;; Make some edits C-x C-c ;; Exits immediately without prompting about saving bar.txt If `save-buffers-kill-emacs' were called after that, the Emacs daemon would be killed, losing the edits to bar.txt.