Am 03.08.25 um 15:17 schrieb Ihor Radchenko:
Andreas Röhler <andreas.roeh...@easy-emacs.de> writes:

   ;; Automatically write the data, but only when we have write access.
   (when (org-persist--check-write-access org-persist-directory)
+  (unless (string= "root" (getenv "USER"))
       (add-hook 'kill-emacs-hook #'org-persist-clear-storage-maybe) ;
Run last.
       (add-hook 'kill-emacs-hook #'org-persist-write-all)
       ;; `org-persist-gc' should run before `org-persist-write-all'.
       ;; So we are adding the hook after `org-persist-write-all'.
-  (add-hook 'kill-emacs-hook #'org-persist-gc))
+    (add-hook 'kill-emacs-hook #'org-persist-gc)))
This will not be enough because some parts of the code force writing
cache. Disabling the cleanup will simply make things worse in your
situation.

The issue occurred at NixOS when running Emacs as root in order to edit
configuration.nix.
...
Debugger entered--Lisp error: (permission-denied "Opening input file"
"Permission denied" "/home/MySelf/.cache/org-persist/index.eld")
insert-file-contents("/home/MySelf/.cache/org-persist/index.eld")
org-persist--read-elisp-file("/home/MySelf/.cache/org-persist/index.eld")
    org-persist-read:index((index "3.2")
"/home/MySelf/.cache/org-persist/index.eld" nil)
    org-persist-load:index((index "3.2")
Can you try the attached patch?

This patch would only shift the issue.




Reply via email to