Please see the attached updated patch with the changes requested. Nick On 3/4/21 12:25 AM, Kyle Meyer wrote: > Nick Savage writes: > >> Hi everyone, >> >> See the attached patch. It is a small change to reduce code duplication >> between ob-sql.el and ob-sqlite.el by reusing org-babel-sql-expand-vars >> as suggested by the FIXME in ob-sqlite.el. > Thank you. Looks good, though I think it'd be nice to keep > org-babel-sqlite-expand-vars around for a bit, marked as obsolete. > >> Subject: [PATCH] Reduce code duplication in ob-sqlite.el and ob-sql.el >> >> * lisp/ob-sqlite.el (org-babel-sqlite-expand-vars): removed function >> to replace with ob-sql.el version >> * lisp/ob-sql.el (org-babel-sql-expand-vars): updated to support >> expanding sqlite vars > Please capitalize the first word after ":" and end the entries with a > period. > > https://www.gnu.org/prep/standards/html_node/Style-of-Change-Logs.html > >> -(defun org-babel-sqlite-expand-vars (body vars) >> - "Expand the variables held in VARS in BODY." >> - ;; FIXME: Redundancy with org-babel-sql-expand-vars! >> - (mapc >> - (lambda (pair) >> - (setq body >> - (replace-regexp-in-string >> - (format "$%s" (car pair)) >> - (let ((val (cdr pair))) >> - (if (listp val) >> - (let ((data-file (org-babel-temp-file "sqlite-data-"))) >> - (with-temp-file data-file >> - (insert (orgtbl-to-csv val nil))) >> - data-file) >> - (if (stringp val) val (format "%S" val)))) >> - body))) >> - vars) >> - body) >> - > How about marking this with (declare (obsolete ...)) and keeping it > around as a wrapper that calls org-babel-sql-expand-vars? That will > give any third-party code that may have used this for whatever reason > (perhaps unlikely) a chance to update.