emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/geiser da990cb7e5: Avoid global state in sychronous evalua


From: ELPA Syncer
Subject: [nongnu] elpa/geiser da990cb7e5: Avoid global state in sychronous evaluations
Date: Sun, 5 Mar 2023 10:59:37 -0500 (EST)

branch: elpa/geiser
commit da990cb7e5c75f692cc2ff58c0a1a725d40ec7af
Author: jao <jao@gnu.org>
Commit: jao <jao@gnu.org>

    Avoid global state in sychronous evaluations
    
    Fixes #60, as diagnosed and solved by Fabian Brosda: if an implementation is
    fast enough, new evaluations can override the result of eval/wait before it 
is
    used (this seems to be the case during completion).
---
 elisp/geiser-eval.el | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/elisp/geiser-eval.el b/elisp/geiser-eval.el
index 91265d717e..5c721a8f2c 100644
--- a/elisp/geiser-eval.el
+++ b/elisp/geiser-eval.el
@@ -1,6 +1,6 @@
 ;;; geiser-eval.el -- sending scheme code for evaluation  -*- lexical-binding: 
t; -*-
 
-;; Copyright (C) 2009, 2010, 2011, 2012, 2013, 2015, 2021 Jose Antonio Ortega 
Ruiz
+;; Copyright (C) 2009, 2010, 2011, 2012, 2013, 2015, 2021, 2023 Jose Antonio 
Ortega Ruiz
 
 ;; This program is free software; you can redistribute it and/or
 ;; modify it under the terms of the Modified BSD License. You should
@@ -160,13 +160,14 @@ module-exports, autodoc, callers, callees and 
generic-methods.")
   (setq geiser-eval--sync-retort (geiser-eval--log s)))
 
 (defun geiser-eval--send/wait (code &optional timeout buffer)
-  (setq geiser-eval--sync-retort nil)
-  (geiser-con--send-string/wait (geiser-eval--connection)
-                                (geiser-eval--code-str code)
-                                'geiser-eval--set-sync-retort
-                                timeout
-                                buffer)
-  geiser-eval--sync-retort)
+  (let ((sync-retort nil))
+    (geiser-con--send-string/wait (geiser-eval--connection)
+                                  (geiser-eval--code-str code)
+                                  (lambda (s)
+                                    (setq sync-retort (geiser-eval--log s)))
+                                  timeout
+                                  buffer)
+    sync-retort))
 
 (defun geiser-eval-interrupt ()
   "Interrupt on-going evaluation, if any."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]