From: CSBVAX::MRGATE!montnaro@steinmetz@SMTP 24-NOV-1987 13:50 To: EVERHART Subj: Bad interactions between TO and Kept GNU Emacs Received: from sprite.moose (sprite.ARPA) by steinmetz.steinmetz (1.2/1.1x Steinmetz) id AA18949; Tue, 24 Nov 87 13:42:23 est Received: by sprite.moose (3.2/1.1x Steinmetz) id AA07840; Tue, 24 Nov 87 13:41:21 EST Date: Tue, 24 Nov 87 13:41:21 EST From: Skip Montanaro Posted-Date: Tue, 24 Nov 87 13:41:21 EST Message-Id: <8711241841.AA07840@sprite.moose> To: gurus, morrow@crd, davidsen@crd, barnum@crd, sajeski@crd Cc: wildes@crd Subject: Bad interactions between TO and Kept GNU Emacs Doug Wildes pointed out a problem to me yesterday that can affect people on VMS VAxes who run GNU Emacs in a subprocess as their default editor when they try to send mail using TO. It may have been reported before, but I hadn't heard of it. If users tell TO that EMACS is their editor, and it is defined to execute GNU emacs in a subprocess, TO will obligingly spawn a subprocess to edit the draft file. The user will be able to suspend that emacs process and return to the TO prompt, without having to save the draft file. This may result in a mail message that has an empty message body, or an incomplete one, depending on whether the user saved the draft file at all in the editor session. To get around this, I defined a GNU Emacs Lisp command that prompts the user to save modified files when suspending. Substitute-key-definition can be used to rebind suspend-emacs keys to execute save-buffers-suspend-emacs when pressed. (defun save-buffers-suspend-emacs (&optional arg) "Offer to save each buffer, then suspend this Emacs fork. With prefix arg, silently save all file-visiting buffers, then suspend." (interactive "P") (save-some-buffers arg t) (suspend-emacs)) (substitute-key-definition 'suspend-emacs 'save-buffers-suspend-emacs (current-global-map)) I recommend users who use both TO and kept GNU Emacs add this Lisp code to their sys$login:.emacs file. I'm not sure what signal EMACS is receiving from TO or from VMS when the TO command exits, but it does appear to be getting killed by one of them. If EMACS receives a hangup signal (SIGHUP) it will checkpoint all modified files before exiting. Consideration might be given to checking for child subprocesses before TO exits, and sending them a hangup signal, rather than leaving them prey to whatever fate is currently befalling them. That way, users could at least retrieve their checkpoint files. Skip