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

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

[nongnu] elpa/emacsql 2f606fdd2d 300/427: Fix with-transaction macro to


From: ELPA Syncer
Subject: [nongnu] elpa/emacsql 2f606fdd2d 300/427: Fix with-transaction macro to return results.
Date: Tue, 13 Dec 2022 02:59:53 -0500 (EST)

branch: elpa/emacsql
commit 2f606fdd2d522af09b1117e78f96fc44363a21b2
Author: Christopher Wellons <wellons@nullprogram.com>
Commit: Christopher Wellons <wellons@nullprogram.com>

    Fix with-transaction macro to return results.
---
 emacsql.el | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/emacsql.el b/emacsql.el
index 3e6344d2f3..4905e14581 100644
--- a/emacsql.el
+++ b/emacsql.el
@@ -260,7 +260,8 @@ multiple times before the changes are committed."
   (declare (indent 1))
   `(let ((emacsql--connection ,connection)
          (emacsql--completed nil)
-         (emacsql--transaction-level (1+ emacsql--transaction-level)))
+         (emacsql--transaction-level (1+ emacsql--transaction-level))
+         (emacsql--result))
      (unwind-protect
          (while (not emacsql--completed)
            (condition-case nil
@@ -268,15 +269,16 @@ multiple times before the changes are committed."
                  (when (= 1 emacsql--transaction-level)
                    (emacsql emacsql--connection [:begin :transaction]))
                  (let ((result (progn ,@body)))
-                   (prog1 result
-                     (when (= 1 emacsql--transaction-level)
-                       (emacsql emacsql--connection [:commit]))
-                     (setf emacsql--completed t))))
+                   (setf emacsql--result result)
+                   (when (= 1 emacsql--transaction-level)
+                     (emacsql emacsql--connection [:commit]))
+                   (setf emacsql--completed t)))
              (emacsql-locked (emacsql emacsql--connection [:rollback])
                              (sleep-for 0.05))))
        (when (and (= 1 emacsql--transaction-level)
                   (not emacsql--completed))
-         (emacsql emacsql--connection [:rollback])))))
+         (emacsql emacsql--connection [:rollback])))
+     emacsql--result))
 
 (defmacro emacsql-thread (connection &rest statements)
   "Thread CONNECTION through STATEMENTS.



reply via email to

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