]> git.eshelyaron.com Git - sweep.git/commitdiff
Fix top-level buffer to thread id association
authorEshel Yaron <me@eshelyaron.com>
Fri, 1 Dec 2023 15:29:31 +0000 (16:29 +0100)
committerEshel Yaron <me@eshelyaron.com>
Fri, 1 Dec 2023 18:14:05 +0000 (19:14 +0100)
* sweeprolog.el (sweeprolog-top-level-buffer): Fix thinko.
* sweeprolog-tests.el (backward-sexp-over-char-literal): New test.

sweeprolog-tests.el
sweeprolog.el

index 7eec10241c62759fba7c81adfe0c425699f56ead..c20a6e028a7c4a4f3ddf49dcc3b440ef3048b055 100644 (file)
@@ -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."
index cbd99fadaf23021e2082e989a9f0c09d97a30894..8ddfac895f05ec5d5db90c6714e0fe3c503e743e 100644 (file)
@@ -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"