Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site decwrl.UUCP
Path: utzoo!watmath!clyde!burl!mgnetp!ihnp4!zehntel!dual!decwrl!dec-rhea!dec-null!marantz
From: marantz@null.DEC (Josh HL01-1/S07 DTN 225-4835)
Newsgroups: net.emacs
Subject: Re: Executing a function when restarting Emacs
Message-ID: <3287@decwrl.UUCP>
Date: Sun, 12-Aug-84 20:06:55 EDT
Article-I.D.: decwrl.3287
Posted: Sun Aug 12 20:06:55 1984
Date-Received: Tue, 14-Aug-84 02:39:47 EDT
Sender: daemon@decwrl.UUCP
Organization: DEC Engineering Network
Lines: 16

I use VMS and VMS Emacs now has standard variables "return-to-emacs-hook",
and "leave-emacs-hook" that can be setq'd to the functions of your choice,
but the way it used to be done was to write a new function that you bound
to ^X^Z or ^C or whatever as follows:

    (defun (hooked-pause-emacs
	(if (error-occurred (execute-mlisp-line leave-emacs-hook))
	    (progn
		(message error-message)
		(sit-for 20)))
	(pause-emacs)
	(execute-mlisp-line return-to-emacs-hook)))

The last line will be executed when the emacs is restarted.  This may
not work exactly on unix like it does on VMS, but the idea should be
similar.