From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pankaj Jangid Newsgroups: gmane.emacs.help Subject: Re: Understanding the behaviour of Emacs and Emacs Client Date: Wed, 23 Feb 2022 14:11:53 +0530 Message-ID: <87fsoaasa6.fsf@codeisgreat.org> References: <87ley2b70o.fsf@codeisgreat.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13951"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 23 09:43:53 2022 Return-path: Envelope-to: geh-help-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 1nMnFZ-0003RA-5h for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 23 Feb 2022 09:43:53 +0100 Original-Received: from localhost ([::1]:37386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nMnFX-00057p-BY for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 23 Feb 2022 03:43:51 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:42188) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nMnDk-00056k-4o for help-gnu-emacs@gnu.org; Wed, 23 Feb 2022 03:42:00 -0500 Original-Received: from [2607:f8b0:4864:20::62f] (port=43842 helo=mail-pl1-x62f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nMnDh-0005wq-VW for help-gnu-emacs@gnu.org; Wed, 23 Feb 2022 03:41:59 -0500 Original-Received: by mail-pl1-x62f.google.com with SMTP id x11so17988680pll.10 for ; Wed, 23 Feb 2022 00:41:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codeisgreat-org.20210112.gappssmtp.com; s=20210112; h=from:to:subject:references:mail-followup-to:date:in-reply-to :message-id:user-agent:mime-version; bh=m7NSN7jz1Z2hjXmKJPw8VIQKnwGiGfcVs8ctlNlcJ/U=; b=yNdkgMoMdFSZK9eq7Cy86FJacyEAM3xc8/Cc+HF6nq0dEyXzOAnOvsDbdecFM6l+7T 1eGwUYdQ7J0DDwxu7gAnauCNfuMmGfIfJWW+X/j3qk0pU/leT8CsDYDOWs4yd0n6AlCf 9vflWR5rVli0FeQq5AlfP1jHzm2FiVoRT2tpqkaQ5l8avOJOk1AL4bqDtZBnmUFxR7KR BjBSLUz/ECmB30+jrlMRAJP7vBqafn4Xwk29uN+5lL7fVeleYqrprVqdWo4Wlng23+zu fDVNAhwmFeqLZP/0VijiMuxZy72QSIPSyLjHODBnWsmqzjp0rztVTaneP6qCo00snu4J quuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:references:mail-followup-to:date :in-reply-to:message-id:user-agent:mime-version; bh=m7NSN7jz1Z2hjXmKJPw8VIQKnwGiGfcVs8ctlNlcJ/U=; b=vdHB4rZdmX9eCrexCjH5BVfFO2jNIPAtNYK9WyNgeGUy/b/969flZO4E/ELXGuFIE0 1a29VNV9+wRE0dShhvKg0sknvQs49HQ+L/GHQGMqwkOPAKW1ItqRKdn66xrVdnb0HkjA ZstijtqWrieJv7umZCIPtmaQA6tM7UNrcJ15CLaEUKh4OfRJUifDMD37AkCpSOjgQa/E Ar4SQNJ8Byr68BnpHtum7/oZRezBgzo9bCGiTiMuHH8Ae0K9Hcm11dNcbuasNs54mtzR +R4mnfxvac7C9MDxutN+6zVmybt7+/Rc3C+eL+GK14HxvBHpeK7Amx/j0wleviAOvcRj oD2Q== X-Gm-Message-State: AOAM531H6GwqHBZM1qEKJh+Sf3d7FpFJjFGcTHmfLjZ9+9iAMs7/Nk+T Hn9cSg0C/2+bl1K5i1wO6buFkkdc11mZtA== X-Google-Smtp-Source: ABdhPJwz2N/LmRg3H/xG9ni9IZToNcefzZhjMETpUtxFSBbEtY82pBdjCTwXJxOYZgGgRN7THo7A6Q== X-Received: by 2002:a17:902:6b48:b0:14f:3b13:b8e with SMTP id g8-20020a1709026b4800b0014f3b130b8emr27026268plt.26.1645605716179; Wed, 23 Feb 2022 00:41:56 -0800 (PST) Original-Received: from anant ([49.36.238.143]) by smtp.gmail.com with ESMTPSA id p24sm866099pfh.4.2022.02.23.00.41.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Feb 2022 00:41:55 -0800 (PST) Mail-Followup-To: help-gnu-emacs@gnu.org In-Reply-To: (Jean Louis's message of "Wed, 23 Feb 2022 09:56:42 +0300") X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::62f (failed) Received-SPF: none client-ip=2607:f8b0:4864:20::62f; envelope-from=pankaj@codeisgreat.com; helo=mail-pl1-x62f.google.com X-Spam_score_int: -1 X-Spam_score: -0.2 X-Spam_bar: / X-Spam_report: (-0.2 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, PDS_HP_HELO_NORDNS=0.659, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:136162 Archived-At: Jean Louis writes: > * Pankaj Jangid [2022-02-23 06:25]: >> 1. When I launch Emacs by clicking "Emacs" icon from apps. Emacs >> launches as usual and shows "Emacs (Client)" near the Activities menu >> in Gnome shell. And when I exit Emacs, C-x C-c, it is perfectly >> shutdown. >> >> 2. When I launch Emacs by clicking "Emacs (Client)" icon from >> apps. Emacs launches as expected. And shows "Emacs (Client)" near the >> Activities menu. But when I want to exit this instance of Emacs, I >> press C-x C-c and the frame is gone. But there is still an Emacs >> process running. >> >> I want to know if this is the desired behaviour of Emacs. And if Yes >> then what is the official way to terminate the residual Emacs process in >> case (2) above? > > <> > > I use this file to start Emacs as server, subsequently emacsclient, > and if Emacs already run as server, I start emacsclient. So I use > emacsclient all the time. > > #!/bin/bash > export EMACS_SOCKET_NAME="/run/user/1001/emacs/server" > if pgrep -f "emacs --bg-daemon" > /dev/null > then > espeak "Starting Emacs client" > emacsclient -c > else > espeak "Starting Emacs daemon" > emacs --bg-daemon > sleep 10 > emacsclient -c > fi I understand how to launch the server and how to launch from CLI. May be that I was not clear enough. I just want to know how to cleanup (gracefully) the residual process when there are no more clients connecting. i.e. case (2) above. User has started Emacs by clicking on the "Emacs (Client)" icon in a graphical environment.