From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id oEhSEGVvQGDKPwAA0tVLHw (envelope-from ) for ; Thu, 04 Mar 2021 05:25:57 +0000 Received: from aspmx2.migadu.com ([2001:41d0:2:c151::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id EPIoDGVvQGBMYwAA1q6Kng (envelope-from ) for ; Thu, 04 Mar 2021 05:25:57 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx2.migadu.com (Postfix) with ESMTPS id 93DBE1FBFD for ; Thu, 4 Mar 2021 06:25:56 +0100 (CET) Received: from localhost ([::1]:35900 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHgUk-0000iX-IG for larch@yhetil.org; Thu, 04 Mar 2021 00:25:54 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49206) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHgUD-0000iE-Ua for emacs-orgmode@gnu.org; Thu, 04 Mar 2021 00:25:21 -0500 Received: from out1.migadu.com ([2001:41d0:2:863f::]:22510) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHgUA-0003mk-A5 for emacs-orgmode@gnu.org; Thu, 04 Mar 2021 00:25:21 -0500 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1614835514; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=sI5siRHZ5xifG6VxW27dCGcqCYJbzvI+H228OhPGfRo=; b=ZlwVyYlrX5A46DpoSy/+0vpZ6H2j1HcKc+Pdi6wwMfbuGsXOTSghhjDOZi0L8pDSPs8mOM 8L1CJXatG7Wm4Br+h250OfjiW7UZTfZJoP01eOLnWUHZHHKm9wIqq4rhvdZ9Qoye0LKLqD NaezT+mkObsp3ax8yN0ddvCchnG11uS4ROzhtdHB5wTqN2Vnp/kyagtkUUakPD+8xIj4n4 0Q1NkLCpR3zKYeZRx/DcUQ0l4Fm30BmZ6Kw8l6tG6EsqJ3St1QAEYLNwZVcM6XMc4wpStq cqoIylYIg3Sq6TmlhMOxYV9SlzxPF9dGCSc6nrCpn7q7ASv/3QzQEQe3JA4lGA== From: Kyle Meyer To: Nick Savage Subject: Re: [PATCH] Reduce code duplication in ob-sql.el and ob-sqlite.el In-Reply-To: <0766206a-5df8-8d95-e6fd-2f96f06c9840@nicksavage.ca> References: <0766206a-5df8-8d95-e6fd-2f96f06c9840@nicksavage.ca> Date: Thu, 04 Mar 2021 00:25:12 -0500 Message-ID: <87eegvcwxz.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Auth-User: kyle@kyleam.com Received-SPF: pass client-ip=2001:41d0:2:863f::; envelope-from=kyle@kyleam.com; helo=out1.migadu.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1614835556; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=sI5siRHZ5xifG6VxW27dCGcqCYJbzvI+H228OhPGfRo=; b=q6JZQBzJF0snZ9ZMexzqF7iEqx0oUQ730corxkUbFgQwF6qWkkJnJMiS+tXeOPXdeayMrs EsFoskDeoeQuoSeD56i8+iOtr+5+n0Kx3anCnuoQd9i2APudaOIeLIjAYf6V9OEPIddNHa 62yyaQKJVmlk+IA5FQDGOH/LUCLknBPMovvgh2T0CR1g9l5Nvz7OQcVnDPXEZqWvOCKvjp vIRw0C3tIviA3YNONPKIPInDdpR3yu3RNHQMATCwCsZU+bRJ3RSA1g1L3elmoFqY+l3TJe Bt2VmwyMdt9mWiST/52CtUJDT16Ad0tGgdDxC8TNU0xlIb7T3jo1Ydido55ssw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1614835556; a=rsa-sha256; cv=none; b=gqrmOZmGp4Roy3d25NHcb7x5ZDMkw2xHK4K8ygoeSqKIqq2IgdDJZtFmpLU3wFlwYwkI+S 4OscMZ44Iiwvwaqdo6MudHJEJC/2fIdxmX4Dv2DAnLnJTMsiD88+FX9wS/dDfFh1XqSwN4 Kem0wuAnjD27vD3u1uWkqSPxtpe80fdzTsIbsh0VcdpTBRxbxC6S0NSHLuerzP7PHF0caP JKuumOBP0qZLxe+Iq3I55/5zCHEFZA0TxCeeQwPm/bC2zNNcQoNATlZptAkipPOLmOj+VS e3ggWSlmfQwFOR1a2vVhWZm15wnXKpaxJnocv/GWwuEn1fVZ8V4Ni02RrMwhCw== ARC-Authentication-Results: i=1; aspmx2.migadu.com; dkim=pass header.d=kyleam.com header.s=key1 header.b=ZlwVyYlr; dmarc=none; spf=pass (aspmx2.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -2.56 Authentication-Results: aspmx2.migadu.com; dkim=pass header.d=kyleam.com header.s=key1 header.b=ZlwVyYlr; dmarc=none; spf=pass (aspmx2.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 93DBE1FBFD X-Spam-Score: -2.56 X-Migadu-Scanner: scn0.migadu.com X-TUID: OfUdcT7pEbqr 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.