org-persist.el/org-persist--read-index: Provide warning if reader fails

* lisp/org-persist.el (org-persist--read-index): Inform user when
reader fails to read existing index file.
This commit is contained in:
Ihor Radchenko 2021-10-21 14:57:42 +08:00
parent 849dd68b27
commit a78282746d
No known key found for this signature in database
GPG Key ID: 6470762A7DA11D8B
1 changed files with 5 additions and 1 deletions

View File

@ -111,7 +111,11 @@ When BUFFER is nil, return plist for global VAR."
(condition-case err
(read (current-buffer))
;; Recover gracefully if index file is corrupted.
(error nil)))))))
(error
(warn "Emacs reader failed to read data for `org-persist--index' from %S. The error was: %S"
(org-file-name-concat org-persist-directory org-persist-index-file)
(error-message-string err))
nil)))))))
(cl-defun org-persist-register (var &optional buffer &key inherit)
"Register VAR in BUFFER to be persistent.