From 1fd8f388c4ed234557e691e935e8b3c3ddefa3ed Mon Sep 17 00:00:00 2001 From: Phil Estival Date: Tue, 26 Nov 2024 12:01:48 +0100 Subject: [PATCH 06/10] ob-sql: expand body discarding nil prologue or epilogue --- lisp/ob-sql.el | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lisp/ob-sql.el b/lisp/ob-sql.el index d20edb9fd..0f3c3c15d 100644 --- a/lisp/ob-sql.el +++ b/lisp/ob-sql.el @@ -435,7 +435,6 @@ SET COLSEP '|' (org-babel-pick-name (cdr (assq :rowname-names params)) (cdr (assq :rownames params)))))))) - (defun org-babel-edit-prep:sql (info) "Prepare Org-edit buffer. Set `sql-product' in Org edit buffer according to @@ -448,11 +447,10 @@ the :engine header argument provided in INFO." (let ((prologue (cdr (assq :prologue params))) (epilogue (cdr (assq :epilogue params)))) (mapconcat 'identity - (list - prologue - (org-babel-sql-expand-vars - body (org-babel--get-vars params)) - epilogue) + (delq nil (list prologue + (org-babel-sql-expand-vars + body (org-babel--get-vars params)) + epilogue)) "\n"))) (defun org-babel-sql-expand-vars (body vars &optional sqlite) @@ -704,7 +702,6 @@ its message buffer" (with-current-buffer (get-buffer-create "*ob-sql-result*") (insert string))) - (provide 'ob-sql) ;;; ob-sql.el ends here -- 2.39.5