branch: elpa/emacsql commit 652847dbf57a476d641b0160f28ee0ba834f2092 Author: Christopher Wellons <well...@nullprogram.com> Commit: Christopher Wellons <well...@nullprogram.com>
Allow memoization cache to be nil (for development). --- emacsql.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/emacsql.el b/emacsql.el index 9335f45cbf..4482878968 100644 --- a/emacsql.el +++ b/emacsql.el @@ -303,7 +303,7 @@ CONN-SPEC is a connection specification like the call to FUNCTION should accept the keyword's arguments and should return a list of (<string> [arg-pos] ...)." (prog1 keyword - (clrhash emacsql-expander-cache) + (when emacsql-expander-cache (clrhash emacsql-expander-cache)) (push (list keyword arity function) emacsql-expanders))) (defmacro emacsql-defexpander (keyword args &rest body) @@ -329,8 +329,9 @@ a list of (<string> [arg-pos] ...)." (mapconcat #'car parts " ") (if subsql-p ")" ";"))) (vars (apply #'nconc (mapcar #'cdr parts)))) - (cl-return (setf (gethash sql cache) - (cons string vars)))))))) + (cl-return (if cache + (setf (gethash sql cache) (cons string vars)) + (cons string vars)))))))) (defun emacsql-format (expansion &rest args) "Fill in the variables EXPANSION with ARGS."