Explorar el Código

org-persist: Provide human readable access time and make sure it exist

* lisp/org-persist.el (org-persist--storage-version): Bump version.
(org-persist-read:generic):
(org-persist-load:generic):
(org-persist-write:generic): Save access time in human-readable form.
Ihor Radchenko hace 3 años
padre
commit
9b650938e7
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  1. 5 1
      lisp/org-persist.el

+ 5 - 1
lisp/org-persist.el

@@ -102,7 +102,7 @@
 (require 'org-id)
 (require 'xdg nil t)
 
-(defconst org-persist--storage-version "2.1"
+(defconst org-persist--storage-version "2.2"
   "Persistent storage layout version.")
 
 (defgroup org-persist nil
@@ -422,6 +422,7 @@ COLLECTION is the plist holding data collectin."
   `(let* ((c (org-persist--normalize-container ,container))
           (read-func-symbol (intern (format "org-persist-read:%s" (car c)))))
      (setf ,collection (plist-put ,collection :last-access (float-time)))
+     (setf ,collection (plist-put ,collection :last-access-hr (format-time-string "%FT%T%z" (float-time))))
      (unless (fboundp read-func-symbol)
        (error "org-persist: Read function %s not defined"
               read-func-symbol))
@@ -469,6 +470,7 @@ COLLECTION is the plist holding data collectin."
   `(let* ((container (org-persist--normalize-container ,container))
           (load-func-symbol (intern (format "org-persist-load:%s" (car container)))))
      (setf ,collection (plist-put ,collection :last-access (float-time)))
+     (setf ,collection (plist-put ,collection :last-access-hr (format-time-string "%FT%T%z" (float-time))))
      (unless (fboundp load-func-symbol)
        (error "org-persist: Load function %s not defined"
               load-func-symbol))
@@ -516,6 +518,8 @@ COLLECTION is the plist holding data collectin."
   "Write CONTAINER in COLLECTION."
   `(let* ((c (org-persist--normalize-container ,container))
           (write-func-symbol (intern (format "org-persist-write:%s" (car c)))))
+     (setf ,collection (plist-put ,collection :last-access (float-time)))
+     (setf ,collection (plist-put ,collection :last-access-hr (format-time-string "%FT%T%z" (float-time))))
      (unless (fboundp write-func-symbol)
        (error "org-persist: Write function %s not defined"
               write-func-symbol))