From: Eshel Yaron Date: Fri, 1 Dec 2023 15:29:31 +0000 (+0100) Subject: Fix top-level buffer to thread id association X-Git-Tag: V9.1.21-sweep-0.27.3~7 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9ea7cd7c5af3cdc79c6a821b5c090d5e0d141646;p=sweep.git Fix top-level buffer to thread id association * sweeprolog.el (sweeprolog-top-level-buffer): Fix thinko. * sweeprolog-tests.el (backward-sexp-over-char-literal): New test. --- diff --git a/sweeprolog-tests.el b/sweeprolog-tests.el index 7eec102..c20a6e0 100644 --- a/sweeprolog-tests.el +++ b/sweeprolog-tests.el @@ -1873,6 +1873,14 @@ head, (forward-sexp) (should (= (point) 21))) +(ert-deftest top-level-thread-id () + "Test obtaining the thread id of a top-level on startup." + (let ((buf-name (generate-new-buffer-name "*test top-level*"))) + (sweeprolog-top-level buf-name) + (should sweeprolog-top-level-thread-id) + (sweeprolog-top-level-delete-process buf-name) + (kill-buffer buf-name))) + (sweeprolog-deftest usage-example-comment () "Tests adding usage example comments." "\nfoo." diff --git a/sweeprolog.el b/sweeprolog.el index cbd99fa..8ddfac8 100644 --- a/sweeprolog.el +++ b/sweeprolog.el @@ -3509,11 +3509,13 @@ top-level." (let* ((proc (get-buffer-process buf)) (tty (process-tty-name proc))) (process-send-eof proc) - (sweeprolog--query-once "sweep" "sweep_top_level_start_pty" tty) - (unless comint-last-prompt buf (accept-process-output proc 1)) - (when (eq system-type 'gnu/linux) - ;; make sure the pty does not echo input - (call-process "stty" nil nil nil "-F" tty "-echo")))) + (prog1 (sweeprolog--query-once + "sweep" "sweep_top_level_start_pty" tty) + (unless comint-last-prompt buf + (accept-process-output proc 1)) + (when (eq system-type 'gnu/linux) + ;; make sure the pty does not echo input + (call-process "stty" nil nil nil "-F" tty "-echo"))))) (unless sweeprolog-prolog-server-port (sweeprolog-start-prolog-server)) (make-comint-in-buffer "sweeprolog-top-level"