[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Lisp functions called on Emacs close
From: |
Ehud Karni |
Subject: |
Re: Lisp functions called on Emacs close |
Date: |
Tue, 3 Sep 2002 00:03:21 +0300 |
On Sun, 01 Sep 2002 20:40:52 +0200, Kai.Grossjohann@CS.Uni-Dortmund.DE wrote:
>
> "Joseph Fannin" <jhf@rivenstone.net writes:
>
> > Can anyone point me to which lisp functions are called when emacs is
> > closed? Specifically, I'd like to know which functions are called when
> > the window manager's close button is pressed.
>
> Whee. Not sure. There is kill-emacs-hook and there is
> kill-emacs-query-functions. I don't know whether they are executed
> in that case, though.
The hook `kill-emacs-query-functions' is surely called when using any
way to kill emacs willingly (C-x C-c, M-x save-buffers-kill-emacs,
close by the window manager), but not by M-x kill-emacs.
I have this function to warn me, and it saved me several times.
(defun kill-warn ()
(interactive)
(or (boundp 'NO-kill-warn) ;; define this to disable warning
(yes-or-no-p "Stop editing and kill all buffers ?")))
(add-hook 'kill-emacs-query-functions 'kill-warn)
Ehud.
--
Ehud Karni Tel: +972-3-7966-561 /"\
Mivtach - Simon Fax: +972-3-7966-667 \ / ASCII Ribbon Campaign
Insurance agencies (USA) voice mail and X Against HTML Mail
http://www.mvs.co.il FAX: 1-815-5509341 / \
mailto:ehud@unix.mvs.co.il Better Safe Than Sorry