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

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

[nongnu] elpa/emacsql 6c32f02139 137/427: Add emacsql-thread macro.


From: ELPA Syncer
Subject: [nongnu] elpa/emacsql 6c32f02139 137/427: Add emacsql-thread macro.
Date: Tue, 13 Dec 2022 02:59:36 -0500 (EST)

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

    Add emacsql-thread macro.
---
 emacsql.el | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/emacsql.el b/emacsql.el
index a1986e2e19..6e44c2a2bd 100644
--- a/emacsql.el
+++ b/emacsql.el
@@ -161,6 +161,17 @@ CONN-SPEC is a connection specification like the call to
          (progn ,@body)
        (emacsql-close ,(car conn-spec)))))
 
+(defmacro emacsql-thread (conn &rest statements)
+  "Thread CONN through STATEMENTS.
+A statement can be a list, containing a statement with its arguments."
+  (declare (indent 1))
+  `(let ((emacsql--conn ,conn))
+     ,@(cl-loop for statement in statements
+               when (vectorp statement)
+               collect (list 'emacsql 'emacsql--conn statement)
+               else
+               collect (append (list 'emacsql 'emacsql--conn) statement))))
+
 (defun emacsql-buffer (conn)
   "Get proccess buffer for CONN."
   (process-buffer (emacsql-process conn)))



reply via email to

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