Skip to content
Snippets Groups Projects
Commit 950bef61 authored by Qiantan Hong's avatar Qiantan Hong
Browse files

print circle, and escape file names for `fs' backend

parent 2742e45e
Branches master
No related tags found
No related merge requests found
......@@ -51,6 +51,7 @@
(require 'cl-lib)
(require 'cl-generic)
(require 'url)
;;; Customs
(defgroup persistence nil "Persistence facility."
......@@ -153,7 +154,9 @@ Return the new list with VALUE removed."
;;; General Utilities
(defsubst store--print (form)
(let ((print-length nil) (print-level nil))
(let ((print-length nil)
(print-level nil)
(print-circle t))
(prin1 form (current-buffer)))
(insert "\n"))
......@@ -318,9 +321,14 @@ Arrange for compacting if log count exceeds (compact-ratio * size-of-table)."
;; We normalize PATH right away, saving future hassles.
(store-fs--make :path (file-name-as-directory path)))
;;We allow some more chars that is usually safe, and makes printed Lisp objects more readable
(defvar store-fs--path-allowed-chars (cl-list* ?\ ?\( ?\) ?\[ ?\] ?\# url-unreserved-chars))
(defsubst store-fs--key-to-path (key store)
;; TODO: escape illegal characters
(concat (store-fs--path store) (prin1-to-string key)))
(concat (store-fs--path store)
(let ((print-length nil)
(print-level nil))
(url-hexify-string (prin1-to-string key) store-fs--path-allowed-chars))))
(cl-defmethod store-put (key value (store store-fs))
(with-temp-buffer
(store--print value)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment