From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean Louis Newsgroups: gmane.emacs.help Subject: Re: Understanding the behaviour of Emacs and Emacs Client Date: Wed, 23 Feb 2022 09:56:42 +0300 Message-ID: References: <87ley2b70o.fsf@codeisgreat.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33113"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/2.2.0 (2022-02-12) Cc: help-gnu-emacs@gnu.org To: Pankaj Jangid Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Feb 23 08:02:22 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 1nMlfJ-0008Oc-Do for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 23 Feb 2022 08:02:21 +0100 Original-Received: from localhost ([::1]:58064 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nMlfH-0000DM-Vy for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 23 Feb 2022 02:02:20 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:49456) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nMldP-0000B8-42 for help-gnu-emacs@gnu.org; Wed, 23 Feb 2022 02:00:23 -0500 Original-Received: from stw1.rcdrun.com ([217.170.207.13]:58929) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nMldM-0006fr-I0 for help-gnu-emacs@gnu.org; Wed, 23 Feb 2022 02:00:22 -0500 Original-Received: from localhost ([::ffff:154.225.233.48]) (AUTH: PLAIN admin, TLS: TLS1.3,256bits,ECDHE_RSA_AES_256_GCM_SHA384) by stw1.rcdrun.com with ESMTPSA id 000000000008DB97.000000006215DB83.000047A8; Wed, 23 Feb 2022 00:00:18 -0700 Mail-Followup-To: Pankaj Jangid , help-gnu-emacs@gnu.org Content-Disposition: inline In-Reply-To: <87ley2b70o.fsf@codeisgreat.org> Received-SPF: pass client-ip=217.170.207.13; envelope-from=bugs@gnu.support; helo=stw1.rcdrun.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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:136160 Archived-At: * Pankaj Jangid [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/