unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Pankaj Jangid <pankaj@codeisgreat.org>
To: help-gnu-emacs@gnu.org
Subject: Re: Understanding the behaviour of Emacs and Emacs Client
Date: Wed, 23 Feb 2022 14:11:53 +0530	[thread overview]
Message-ID: <87fsoaasa6.fsf@codeisgreat.org> (raw)
In-Reply-To: <YhXaqkGW+laCk0Gl@protected.localdomain> (Jean Louis's message of "Wed, 23 Feb 2022 09:56:42 +0300")

Jean Louis <bugs@gnu.support> writes:

> * Pankaj Jangid <pankaj@codeisgreat.org> [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?
>
> <<cut>>
>
> 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.



  reply	other threads:[~2022-02-23  8:41 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-23  3:23 Understanding the behaviour of Emacs and Emacs Client Pankaj Jangid
2022-02-23  6:56 ` Jean Louis
2022-02-23  8:41   ` Pankaj Jangid [this message]
2022-02-23 12:02     ` Jean Louis
2022-02-23 12:54       ` Eli Zaretskii
2022-02-23 12:26 ` Eli Zaretskii
2022-02-28  3:29   ` Pankaj Jangid
2022-03-01 16:54     ` Suvayu Ali

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87fsoaasa6.fsf@codeisgreat.org \
    --to=pankaj@codeisgreat.org \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).