unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Joost Kremers <joostkremers@fastmail.fm>
To: emacs-devel@gnu.org
Subject: Re: graceful shutdown of non-interactive Elisp program
Date: Sun, 14 Jun 2020 00:59:51 +0200	[thread overview]
Message-ID: <87tuzed120.fsf@fastmail.fm> (raw)
In-Reply-To: <CAG7BpaqQ+KZro+v12x3y_v3wcQnB7wnP6qQ66sWDRx7EXEhEkw@mail.gmail.com>


On Sat, Jun 13 2020, Paul Pogonyshev wrote:
> I'm trying to make a Elisp program that is run in a 
> non-interactive mode,
> i.e. essentially as `emacs --batch --load myfile.el'. A normal 
> way to
> shutdown terminal programs is with C-c, which is expected to be 
> "graceful"
> shutdown, e.g. the program still has a chance to save files etc.
>
> However, with Elisp I'm not sure how to achieve that except for 
> constantly
> modifying `kill-emacs-hook', which would be a nightmare from 
> coding
> perspective.

What do you mean "constantly modifying `kill-emacs-hook'"? You 
just add a function to it when your program starts and if it's 
shut down before Emacs is killed, you remove the function again. 
Or leave it, if it doesn't do any harm.



-- 
Joost Kremers
Life has its moments



  reply	other threads:[~2020-06-13 22:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-13 21:42 graceful shutdown of non-interactive Elisp program Paul Pogonyshev
2020-06-13 22:59 ` Joost Kremers [this message]
2020-06-14 15:01 ` Eli Zaretskii
2020-06-14 16:47   ` Paul Pogonyshev

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=87tuzed120.fsf@fastmail.fm \
    --to=joostkremers@fastmail.fm \
    --cc=emacs-devel@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.
Code repositories for project(s) associated with this public inbox

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

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).