sweep_options_collection/2,
sweep_option_arguments_collection/2,
sweep_functions_collection/2,
- sweep_function_functors_collection/2
+ sweep_function_functors_collection/2,
+ sweep_nohup/2
]).
:- use_module(library(pldoc)).
-> Exists = "true"
; Exists = []
).
+
+sweep_nohup(1, _) :- on_signal(hup, _, atom).
+sweep_nohup(0, _) :- on_signal(hup, _, default).
#'sweeprolog-top-level-sentinel)
(add-hook 'kill-buffer-hook #'comint-write-input-ring nil t)))
+(defun sweeprolog-top-level-filter (process string)
+ (let ((sweeprolog-top-level-output-filter t))
+ (comint-output-filter process string))
+ (when (string-match (rx "Sweep top-level thread exited") string)
+ (with-current-buffer (process-buffer process)
+ (setq sweeprolog-top-level-thread-id nil))
+ (if (or (eq (process-type process) 'network)
+ (not (daemonp)))
+ (delete-process process)
+ (sweeprolog--query-once "sweep" "sweep_nohup" 1)
+ (delete-process process)
+ (sweeprolog--query-once "sweep" "sweep_nohup" 0))))
+
(defun sweeprolog-top-level-buffer (&optional name)
"Return a Prolog top-level buffer named NAME.
sweeprolog-prolog-server-port))
(sweeprolog--query-once "sweep" "sweep_accept_top_level_client" nil)))
(let ((proc (get-buffer-process buf)))
- (set-process-filter proc
- (lambda (process string)
- (let ((sweeprolog-top-level-output-filter t))
- (comint-output-filter process string))
- (when (string-match (rx "Sweep top-level thread exited") string)
- (delete-process process)
- (with-current-buffer buf
- (setq sweeprolog-top-level-thread-id nil)))))
+ (set-process-filter proc #'sweeprolog-top-level-filter)
(unless comint-last-prompt buf (accept-process-output proc 1))
(set-process-query-on-exit-flag proc nil)
(setq-local comint-input-ring-file-name