all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Jean Louis <bugs@gnu.support>
To: Pankaj Jangid <pankaj@codeisgreat.org>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Understanding the behaviour of Emacs and Emacs Client
Date: Wed, 23 Feb 2022 09:56:42 +0300	[thread overview]
Message-ID: <YhXaqkGW+laCk0Gl@protected.localdomain> (raw)
In-Reply-To: <87ley2b70o.fsf@codeisgreat.org>

* Pankaj Jangid <pankaj@codeisgreat.org> [2022-02-23 06:25]:
> I am on version 29 (Git-master). And I "make install" into $HOME/.local
> on a Debian (stable) system. I am using Gnome.
> 
> Now I have two application icons - Emacs and Emacs (Client). I want to
> understand the behaviour of these two links. Following is what is
> happening on my system and I want to know if that is the desired
> behaviour:
> 
> 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?

Emacs Client will connect to Emacs server or daemon. 

And here it output from

$ emacs --help

use this to understand how to run Emacs daemon, there are few ways.

Usage: emacs [OPTION-OR-FILENAME]...

Run Emacs, the extensible, customizable, self-documenting real-time
display editor.  The recommended way to start Emacs for normal editing
is with no options at all.

Run M-x info RET m emacs RET m emacs invocation RET inside Emacs to
read the main documentation for these command-line arguments.

Initialization options:

--batch                     do not do interactive display; implies -q
--chdir DIR                 change to directory DIR
--daemon, --bg-daemon[=NAME] start a (named) server in the background
--fg-daemon[=NAME]          start a (named) server in the foreground
--debug-init                enable Emacs Lisp debugger for init file
--display, -d DISPLAY       use X server DISPLAY
--module-assertions         assert behavior of dynamic modules
--dump-file FILE            read dumped state from FILE
--fingerprint               output fingerprint and exit
--seccomp=FILE              read Seccomp BPF filter from FILE
--no-build-details          do not add build details such as time stamps
--no-desktop                do not load a saved desktop
--no-init-file, -q          load neither ~/.emacs nor default.el
--no-loadup, -nl            do not load loadup.el into bare Emacs
--no-site-file              do not load site-start.el
--no-x-resources            do not load X resources
--no-site-lisp, -nsl        do not add site-lisp directories to load-path
--no-splash                 do not display a splash screen on startup
--no-window-system, -nw     do not communicate with X, ignoring $DISPLAY
--quick, -Q                 equivalent to:
                              -q --no-site-file --no-site-lisp --no-splash
                              --no-x-resources
--script FILE               run FILE as an Emacs Lisp script
--terminal, -t DEVICE       use DEVICE for terminal I/O
--user, -u USER             load ~USER/.emacs instead of your own

Action options:

FILE                    visit FILE
+LINE                   go to line LINE in next FILE
+LINE:COLUMN            go to line LINE, column COLUMN, in next FILE
--directory, -L DIR     prepend DIR to load-path (with :DIR, append DIR)
--eval EXPR             evaluate Emacs Lisp expression EXPR
--execute EXPR          evaluate Emacs Lisp expression EXPR
--file FILE             visit FILE
--find-file FILE        visit FILE
--funcall, -f FUNC      call Emacs Lisp function FUNC with no arguments
--insert FILE           insert contents of FILE into current buffer
--kill                  exit without asking for confirmation
--load, -l FILE         load Emacs Lisp FILE using the load function
--visit FILE            visit FILE

Display options:

--background-color, -bg COLOR   window background color
--basic-display, -D             disable many display features;
                                  used for debugging Emacs
--border-color, -bd COLOR       main border color
--border-width, -bw WIDTH       width of main border
--color, --color=MODE           override color mode for character terminals;
                                  MODE defaults to `auto', and
                                  can also be `never', `always',
                                  or a mode name like `ansi8'
--cursor-color, -cr COLOR       color of the Emacs cursor indicating point
--font, -fn FONT                default font; must be fixed-width
--foreground-color, -fg COLOR   window foreground color
--fullheight, -fh               make the first frame high as the screen
--fullscreen, -fs               make the first frame fullscreen
--fullwidth, -fw                make the first frame wide as the screen
--maximized, -mm                make the first frame maximized
--geometry, -g GEOMETRY         window geometry
--no-bitmap-icon, -nbi          do not use picture of gnu for Emacs icon
--iconic                        start Emacs in iconified state
--internal-border, -ib WIDTH    width between text and main border
--line-spacing, -lsp PIXELS     additional space to put between lines
--mouse-color, -ms COLOR        mouse cursor color in Emacs window
--name NAME                     title for initial Emacs frame
--no-blinking-cursor, -nbc      disable blinking cursor
--reverse-video, -r, -rv        switch foreground and background
--title, -T TITLE               title for initial Emacs frame
--vertical-scroll-bars, -vb     enable vertical scroll bars
--xrm XRESOURCES                set additional X resources
--parent-id XID                 set parent window
--help                          display this help and exit
--version                       output version information and exit

You can generally also specify long option names with a single -; for
example, -batch as well as --batch.  You can use any unambiguous
abbreviation for a --option.

Various environment variables and window system resources also affect
the operation of Emacs.  See the main documentation.

Report bugs to bug-gnu-emacs@gnu.org.  First, please see the Bugs
section of the Emacs manual or the file BUGS.

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


-- 
Jean

Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns

In support of Richard M. Stallman
https://stallmansupport.org/



  reply	other threads:[~2022-02-23  6:56 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 [this message]
2022-02-23  8:41   ` Pankaj Jangid
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

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

  git send-email \
    --in-reply-to=YhXaqkGW+laCk0Gl@protected.localdomain \
    --to=bugs@gnu.support \
    --cc=help-gnu-emacs@gnu.org \
    --cc=pankaj@codeisgreat.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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.