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

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

[nongnu] elpa/emacsql a6dbb52a3c 009/427: Add flatten option.


From: ELPA Syncer
Subject: [nongnu] elpa/emacsql a6dbb52a3c 009/427: Add flatten option.
Date: Tue, 13 Dec 2022 02:59:23 -0500 (EST)

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

    Add flatten option.
---
 emacsql.el | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/emacsql.el b/emacsql.el
index ed81295794..07f1404a8a 100644
--- a/emacsql.el
+++ b/emacsql.el
@@ -154,14 +154,18 @@ buffer. This is for debugging purposes."
                                         (buffer-substring
                                          (- (point-max) 2) (point-max)))))))
 
-(defun emacsql--parse (emacsql)
-  "Parse a query result into an s-expression."
+(defun emacsql--parse (emacsql &rest flatten)
+  "Parse a query result into an s-expression.
+If FLATTEN is non-nil, don't include column names."
   (with-current-buffer (emacsql-buffer emacsql)
     (let ((standard-input (current-buffer)))
       (setf (point) (point-min))
       (cl-loop until (looking-at "#")
-               for (name _= value) = (list (read) (read) (read))
-               collect (cons name value) into row
+               for name = (read)
+               do (forward-char 3)
+               for value = (read)
+               when flatten collect value into row
+               else collect (cons name value) into row
                do (forward-char)
                when (or (looking-at "\n") (looking-at "#"))
                collect row into rows and do (setf row ())



reply via email to

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