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.devel Subject: Re: [RFC] Option to kill `emacs --daemon' when closing the last client frame Date: Mon, 25 Oct 2021 10:18:09 -0700 Message-ID: <1e69e16b-d88c-cb45-219d-b72b0a643cd4@gmail.com> References: <83h7dbc2sl.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="11769"; mail-complaints-to="usenet@ciao.gmane.io" To: Eli Zaretskii , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Oct 25 19:18:54 2021 Return-path: Envelope-to: ged-emacs-devel@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 1mf3cb-0002oA-PJ for ged-emacs-devel@m.gmane-mx.org; Mon, 25 Oct 2021 19:18:53 +0200 Original-Received: from localhost ([::1]:48374 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mf3cZ-00026b-VP for ged-emacs-devel@m.gmane-mx.org; Mon, 25 Oct 2021 13:18:51 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:44234) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mf3bx-0001Qm-HW for emacs-devel@gnu.org; Mon, 25 Oct 2021 13:18:13 -0400 Original-Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:39486) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mf3bv-0005Oz-AX; Mon, 25 Oct 2021 13:18:13 -0400 Original-Received: by mail-pj1-x102b.google.com with SMTP id u6-20020a17090a3fc600b001a00250584aso11986635pjm.4; Mon, 25 Oct 2021 10:18:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:references:from:message-id:date:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=Bvpt6sk+cm2lyBluP/6Sz3o3l22DkgdyXPBqf3yubVY=; b=o7qExU/PTQQqBF4xVUtePmRGi3taITAbdGENzid7jIAXQ4N2G89q6OcIDH4+kh41E9 s8MPHWhf8uTJRhsFtRi0PdZlSacn1Ph8jXLP/2wfD/cs8Uz68m3EyhoGUGQCvfDVTLzK 7hICjvndZLwTgDcBJQ71uBHoU4EHHtJemSDsK8pC5RekrSeJ3oe64Pz/Y8I6Fi3xIpza 4ueF8wNuq+Wv7VBxZGRNqfp74XVR7EsNwwLyvLTuVNAyQsv+8vzkc+MtzVhbfFHfbWEO 0x2VxNfDJi6CIDYdafbmsid5BRlrZMUl0XVRbPKXmjxU60lwViP34kNIyp63ONSiqqR/ B+kg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=Bvpt6sk+cm2lyBluP/6Sz3o3l22DkgdyXPBqf3yubVY=; b=3N3gnLxqWnJchRZEN85V1ZFw1mjiMh25eOWFaXORc2GerZmKc10AZBnjqFH4eiKsLV MPd8XiG8448a1vtPIPFG5wdQQllMRXU/XtveDa4qASRXvE8Dju3U3VgN12BEDaUbs3PR SbtfpeKqapfKYCT2jPLsYb7aWV7DmmeQxDq0ETA5mDFTzjlaONiNwyd7JbWWwQcNRXFh RSfQRqwi5qLQuw01P8TMrCZ3pPBYpkB/KhCOQ/iKNJvHrUjlKlZ0Z4IMh88/LkOT8MMt PIKVuyM2D35G7Yzl/UnevfuOQ+k3dPlLCFydDY0oZnqLX3ICp2ezpvYSVnaXQIcqnFGv Jucg== X-Gm-Message-State: AOAM533y+0Cc1uET1v4+rVSBnoSbiALEPPyJDVVHro7lG6dlo2ZKpxY7 nshCxPpv/oKCIAGrp2/qLSo/XpZ0jqQ= X-Google-Smtp-Source: ABdhPJwXQaNacmcdIp8w3A+TJXoWMpWT+KLZcaFfPcORZ0Zuipx4ofjIqoqm5fiJF/NLSudls2qqbA== X-Received: by 2002:a17:902:e353:b0:13f:354a:1151 with SMTP id p19-20020a170902e35300b0013f354a1151mr17188677plc.16.1635182289343; Mon, 25 Oct 2021 10:18:09 -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 u4sm22717529pjg.54.2021.10.25.10.18.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 25 Oct 2021 10:18:08 -0700 (PDT) In-Reply-To: Content-Language: en-US Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=jporterbugs@gmail.com; helo=mail-pj1-x102b.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: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:277766 Archived-At: On 10/24/2021 11:11 PM, Jean Louis wrote: > Why in particular don't you use continuously the Emacs daemon if you > are already invoking many times emacsclient? Beyond it just being what I'm used to, the main reason is that I prefer to close Emacs when I'm done working on whatever it is I was doing, so that when I reopen it later, I have a fresh session with nothing open. (I could use `desktop-clear' to do this, but since, in my usage, I'm already closing all the Emacs frames to get them out of my way, that would just be an extra step I need to remember to do.) > What you forgot to mention is that many buffers and files could be > open in the same time, some of them unsaved. It is not just a question > of emacsclient. > > A browser may not have "open files", it is not equivalent to Emacs as > it has more static configuration. In the age of web apps, that's less true than it was before. I may well be editing a file in a browser, composing an email, posting on a forum, etc. In "richer" web apps, these might auto-save for you if you leave the page, but many sites will just prompt you to save or discard your work in progress if you close the browser. This behavior is what I've customized my Emacs configuration to do. > I don't think clients are important there. > > What is important are buffers and open files, some unfinished work. > > `daemon-kill-when-no-clients' makes no sense to me. I would not like > not even by mistake to accidentally remove the last client and that my > buffers and open files are lost because I have set the option to quit > that way. I am using daemon option in the first place exactly to avoid > the situation you wish to create. That's why, in my patch[1], I call `save-buffers-kill-emacs' to kill the daemon when the last client frame is closed. That way, I'm prompted before the daemon stops, and can either save my work or change my mind and leave some Emacs frames open. This has the additional benefit for me that if I shut down my system, I generally close all the windows first (or the OS does this for me), which means that when the last Emacs frame is closed, I'm prompted to save my unfinished work. If I had my configuration set to leave the daemon alive and not bother prompting to save when closing the last frame, I could still lose my unfinished work when the system actually reboots. That loss of work could probably be resolved via `desktop-mode', but as mentioned above, I much prefer having a "fresh" Emacs session when I start it up. - Jim [1] https://lists.gnu.org/archive/html/bug-gnu-emacs/2021-10/msg02184.html and https://lists.gnu.org/archive/html/bug-gnu-emacs/2021-10/msg02209.html