[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/sweeprolog 9ea7cd7c5a 3/5: Fix top-level buffer to thread
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/sweeprolog 9ea7cd7c5a 3/5: Fix top-level buffer to thread id association |
Date: |
Sat, 2 Dec 2023 04:00:38 -0500 (EST) |
branch: elpa/sweeprolog
commit 9ea7cd7c5af3cdc79c6a821b5c090d5e0d141646
Author: Eshel Yaron <me@eshelyaron.com>
Commit: Eshel Yaron <me@eshelyaron.com>
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.
---
sweeprolog-tests.el | 8 ++++++++
sweeprolog.el | 12 +++++++-----
2 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/sweeprolog-tests.el b/sweeprolog-tests.el
index 7eec10241c..c20a6e028a 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 cbd99fadaf..8ddfac895f 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"