branch: externals/org
commit ffa7d41ae163b4afb6f3223ba38e8794c2e0c9e0
Merge: 084e78544c 18a2fcac24
Author: Ihor Radchenko <yanta...@posteo.net>
Commit: Ihor Radchenko <yanta...@posteo.net>

    Merge branch 'bugfix'
---
 lisp/org-persist.el | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lisp/org-persist.el b/lisp/org-persist.el
index d2c5f67608..64f1afd179 100644
--- a/lisp/org-persist.el
+++ b/lisp/org-persist.el
@@ -760,7 +760,7 @@ COLLECTION is the plist holding data collection."
 
 (defun org-persist-read:index (cont index-file _)
   "Read index container CONT from INDEX-FILE."
-  (when (file-exists-p index-file)
+  (when (and (file-exists-p index-file) (file-readable-p index-file))
     (let ((index (org-persist--read-elisp-file index-file)))
       (when index
         (catch :found
@@ -816,9 +816,10 @@ COLLECTION is the plist holding data collection."
       (when (file-exists-p org-persist-directory)
         (dolist (file (directory-files org-persist-directory 'absolute
                                        "\\`[^.][^.]"))
-          (if (file-directory-p file)
-              (delete-directory file t)
-            (delete-file file))))
+          (when (file-writable-p file)
+            (if (file-directory-p file)
+                (delete-directory file t)
+              (delete-file file)))))
       (plist-put (org-persist--get-collection container) :expiry 'never))))
 
 (defun org-persist--load-index ()

Reply via email to