Disable JSON pretty-printing

This commit is contained in:
contrapunctus 2022-03-26 20:09:49 +05:30
parent 1eaf2c099a
commit 3f52469f31
2 changed files with 24 additions and 26 deletions

View File

@ -124,19 +124,18 @@ prop-id of the inserted or existing property."
(defun chronometrist-sqlite-properties-to-json (plist) (defun chronometrist-sqlite-properties-to-json (plist)
"Return PLIST as a JSON string." "Return PLIST as a JSON string."
(let ((json-encoding-pretty-print t)) (json-encode
(json-encode ;; `json-encode' throws an error when it thinks
;; `json-encode' throws an error when it thinks ;; it sees "alists" which have numbers as
;; it sees "alists" which have numbers as ;; "keys", so we convert any cons cells and any
;; "keys", so we convert any cons cells and any ;; lists starting with a number to vectors
;; lists starting with a number to vectors (-tree-map (lambda (elt)
(-tree-map (lambda (elt) (cond ((chronometrist-pp-pair-p elt)
(cond ((chronometrist-pp-pair-p elt) (vector (car elt) (cdr elt)))
(vector (car elt) (cdr elt))) ((consp elt)
((consp elt) (vconcat elt))
(vconcat elt)) (t elt)))
(t elt))) plist)))
plist))))
(defcustom chronometrist-sqlite-properties-function nil (defcustom chronometrist-sqlite-properties-function nil
"Function used to control the encoding of user key-values. "Function used to control the encoding of user key-values.

View File

@ -171,19 +171,18 @@ prop-id of the inserted or existing property."
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun chronometrist-sqlite-properties-to-json (plist) (defun chronometrist-sqlite-properties-to-json (plist)
"Return PLIST as a JSON string." "Return PLIST as a JSON string."
(let ((json-encoding-pretty-print t)) (json-encode
(json-encode ;; `json-encode' throws an error when it thinks
;; `json-encode' throws an error when it thinks ;; it sees "alists" which have numbers as
;; it sees "alists" which have numbers as ;; "keys", so we convert any cons cells and any
;; "keys", so we convert any cons cells and any ;; lists starting with a number to vectors
;; lists starting with a number to vectors (-tree-map (lambda (elt)
(-tree-map (lambda (elt) (cond ((chronometrist-pp-pair-p elt)
(cond ((chronometrist-pp-pair-p elt) (vector (car elt) (cdr elt)))
(vector (car elt) (cdr elt))) ((consp elt)
((consp elt) (vconcat elt))
(vconcat elt)) (t elt)))
(t elt))) plist)))
plist))))
#+END_SRC #+END_SRC
*** properties-function :custom:variable: *** properties-function :custom:variable: