Handle SIGHUP in daemon mode when killing a tty top-level
When Emacs is running as a daemon, and deletes the process of a
top-level that uses a tty, the top-level receives SIGHUP. But since
the top-level is a thread is the same process as Emacs itself, this
results in 'kill-emacs'. To prevent this unfortunate outcome, set a
no-op handler for SIGHUP before deleting the top-level process and
restore the original handler afterwards.
* sweep.pl (sweep_nohup/2): New predicate.
* sweeprolog.el (sweeprolog-top-level-filter): New function.
(sweeprolog-top-level-buffer): Use it.