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

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

[elpa] externals/org 849dd68: org-persist.el/org-persist--read-index: Ha


From: ELPA Syncer
Subject: [elpa] externals/org 849dd68: org-persist.el/org-persist--read-index: Handle reader errors
Date: Wed, 20 Oct 2021 08:57:21 -0400 (EDT)

branch: externals/org
commit 849dd68b27156722e79f9bc7339ef313c3eeca68
Author: Ihor Radchenko <yantar92@gmail.com>
Commit: Ihor Radchenko <yantar92@gmail.com>

    org-persist.el/org-persist--read-index: Handle reader errors
    
    * lisp/org-persist.el (org-persist--read-index): Do not emit
    unrecoverable error if index file is corrupted (i.e. empty).
---
 lisp/org-persist.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/org-persist.el b/lisp/org-persist.el
index c3fd1c2..b93d3e5 100644
--- a/lisp/org-persist.el
+++ b/lisp/org-persist.el
@@ -107,7 +107,11 @@ When BUFFER is nil, return plist for global VAR."
     (when (file-exists-p (org-file-name-concat org-persist-directory 
org-persist-index-file))
       (with-temp-buffer
         (insert-file-contents (org-file-name-concat org-persist-directory 
org-persist-index-file))
-        (setq org-persist--index (read (current-buffer)))))))
+        (setq org-persist--index
+              (condition-case err
+                  (read (current-buffer))
+                ;; Recover gracefully if index file is corrupted.
+                (error nil)))))))
 
 (cl-defun org-persist-register (var &optional buffer &key inherit)
   "Register VAR in BUFFER to be persistent.



reply via email to

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