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

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

[nongnu] elpa/emacsql 652847dbf5 110/427: Allow memoization cache to be


From: ELPA Syncer
Subject: [nongnu] elpa/emacsql 652847dbf5 110/427: Allow memoization cache to be nil (for development).
Date: Tue, 13 Dec 2022 02:59:33 -0500 (EST)

branch: elpa/emacsql
commit 652847dbf57a476d641b0160f28ee0ba834f2092
Author: Christopher Wellons <wellons@nullprogram.com>
Commit: Christopher Wellons <wellons@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."



reply via email to

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